aboutsummaryrefslogtreecommitdiff
path: root/src/utility.js
diff options
context:
space:
mode:
authorAlon Zakai <azakai@mozilla.com>2010-12-07 21:54:29 -0800
committerAlon Zakai <azakai@mozilla.com>2010-12-07 21:54:29 -0800
commit023a34753e1e47f03eadfd91a7e639afbbead888 (patch)
tree966cd52abcd970bf1c58a6e5ec1b59e09480654b /src/utility.js
parent78b2976bcbbb7e0e36a60bd643adefc1226a09a6 (diff)
fix a few bugs related to highly-nested structs
Diffstat (limited to 'src/utility.js')
-rw-r--r--src/utility.js9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/utility.js b/src/utility.js
index 5020c911..68fab711 100644
--- a/src/utility.js
+++ b/src/utility.js
@@ -227,3 +227,12 @@ function isNumber(x) {
return x == parseFloat(x);
}
+function flatten(x) {
+ if (typeof x !== 'object') return x;
+ var ret = [];
+ for (var i = 0; i < x.length; i++) {
+ ret = ret.concat(flatten(x[i]));
+ }
+ return ret;
+}
+