[gnome-maps/wip/routing: 51/59] Utils: add isArray-function
- From: Mattias Bengtsson <mattiasb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-maps/wip/routing: 51/59] Utils: add isArray-function
- Date: Fri, 13 Dec 2013 12:30:54 +0000 (UTC)
commit cdc86f68f2ba12e29e50c010d9b5d4afb5bf3136
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 d7d17b4..eb749b1 100644
--- a/src/utils.js
+++ b/src/utils.js
@@ -134,6 +134,10 @@ function getUIObject(res, ids) {
return ret;
}
+function isArray(obj) {
+ return Object.prototype.toString.call(obj) === '[object Array]';
+}
+
function load_icon(icon, size, loadCompleteCallback) {
if (icon instanceof Gio.FileIcon) {
_load_file_icon(icon, loadCompleteCallback);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]