[gnome-maps/wip/routing2: 5/8] Utils: add isDefined-function
- From: Mattias Bengtsson <mattiasb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-maps/wip/routing2: 5/8] Utils: add isDefined-function
- Date: Sun, 6 Apr 2014 23:26:49 +0000 (UTC)
commit 84a6a49473b16727cb2dbd3965b3f5852ff9ae98
Author: Mattias Bengtsson <mattias jc bengtsson gmail com>
Date: Sun Aug 25 02:58:29 2013 +0200
Utils: add isDefined-function
Utils.isDefined returns false if a value is either 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 d7cf5bb..2744fcc 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 readFile(filename) {
let status, buffer;
let file = Gio.File.new_for_path(filename);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]