[gnome-maps/wip/routing: 16/21] Utils: add isDefined function.
- From: Mattias Bengtsson <mattiasb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-maps/wip/routing: 16/21] Utils: add isDefined function.
- Date: Tue, 10 Sep 2013 03:38:57 +0000 (UTC)
commit 4fd432ecb2c2030a3bf16bfe89765483a4b30fae
Author: Mattias Bengtsson <mattias jc bengtsson gmail com>
Date: Sun Aug 25 02:58:29 2013 +0200
Utils: add isDefined function.
Utils.isDefined returns true if a value isn't undefined or null.
src/utils.js | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/src/utils.js b/src/utils.js
index 3d0942b..4e441ed 100644
--- a/src/utils.js
+++ b/src/utils.js
@@ -138,6 +138,10 @@ function isArray(obj) {
return Object.prototype.toString.call(obj) === '[object Array]';
}
+function isDefined(obj) {
+ return (typeof obj !== 'undefined' && obj !== null);
+}
+
function load_icon(icon, size, loadCompleteCallback) {
if (icon instanceof Gio.FileIcon) {
_load_file_icon(icon, loadCompleteCallback);
@@ -219,4 +223,4 @@ function _load_themed_icon(icon, size, loadCompleteCallback) {
} catch(e) {
log("Failed to load pixbuf: " + e);
}
-}
+}
\ No newline at end of file
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]