[gnome-maps/wip/routing2: 3/10] Utils: add hasValue-function
- From: Mattias Bengtsson <mattiasb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-maps/wip/routing2: 3/10] Utils: add hasValue-function
- Date: Fri, 2 May 2014 01:23:51 +0000 (UTC)
commit fcae8dc518f06d89eb7d8f9b0dbf689a25728dd2
Author: Mattias Bengtsson <mattias jc bengtsson gmail com>
Date: Sun Aug 25 02:58:29 2013 +0200
Utils: add hasValue-function
Utils.hasValue returns true if a value is neither undefined nor null.
https://bugzilla.gnome.org/show_bug.cgi?id=728695
src/utils.js | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
---
diff --git a/src/utils.js b/src/utils.js
index d7cf5bb..c1fd37e 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 hasValue(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]