[gnome-maps/wip/routing: 28/33] Utils: add isDefined function.
- From: Mattias Bengtsson <mattiasb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-maps/wip/routing: 28/33] Utils: add isDefined function.
- Date: Mon, 23 Sep 2013 00:28:44 +0000 (UTC)
commit 27442725fac5817b96ee0f191a8013787a20ed33
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]