[gnome-maps/wip/routing: 6/8] Utils: add isDefined function.



commit d7184eb8aaa85944701f1b22c75c0eebe2ac2163
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 |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
---
diff --git a/src/utils.js b/src/utils.js
index aa9a200..7f50bd4 100644
--- a/src/utils.js
+++ b/src/utils.js
@@ -134,3 +134,7 @@ function getUIObject(res, ids) {
 function isArray(obj) {
     return Object.prototype.toString.call(obj) === '[object Array]';
 }
+
+function isDefined(obj) {
+    return (typeof obj !== 'undefined' && obj !== null);
+}


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]