aboutsummaryrefslogtreecommitdiff
path: root/src/utility.js
diff options
context:
space:
mode:
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;
+}
+