[gnome-maps/wip/routing: 5/8] Utils: add isArray-function
- From: Mattias Bengtsson <mattiasb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-maps/wip/routing: 5/8] Utils: add isArray-function
- Date: Wed, 28 Aug 2013 01:13:06 +0000 (UTC)
commit 4de0427eefe053344e32cb243debb017b40af57d
Author: Mattias Bengtsson <mattias jc bengtsson gmail com>
Date: Sun Aug 25 01:24:27 2013 +0200
Utils: add isArray-function
Utils.isArray checks if an object is an array. This isn't very
straight forward in JavaScript unfortunately so best to make a
separate function for it.
More information:
- http://blog.niftysnippets.org/2010/09/say-what.html
- http://stackoverflow.com/questions/4775722/javascript-check-if-object-is-array
src/utils.js | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
---
diff --git a/src/utils.js b/src/utils.js
index 621d9ef..aa9a200 100644
--- a/src/utils.js
+++ b/src/utils.js
@@ -130,3 +130,7 @@ function getUIObject(res, ids) {
});
return ret;
}
+
+function isArray(obj) {
+ return Object.prototype.toString.call(obj) === '[object Array]';
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]