aboutsummaryrefslogtreecommitdiff
path: root/src/utility.js
diff options
context:
space:
mode:
authoralon@honor <none@none>2010-10-18 22:55:20 -0700
committeralon@honor <none@none>2010-10-18 22:55:20 -0700
commit377185c933bd55a260a525d1eb8316c8ea896da1 (patch)
tree4ce42aa8ebb201efb8056e4f70f3eb46fc33e036 /src/utility.js
parent890130e93bc1128d7b5fbdcc512e243ef78cd712 (diff)
minor fixes and cleanups
Diffstat (limited to 'src/utility.js')
-rw-r--r--src/utility.js18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/utility.js b/src/utility.js
index 2cc2408c..0be6e598 100644
--- a/src/utility.js
+++ b/src/utility.js
@@ -95,10 +95,20 @@ function searchable() {
}
function walkJSON(item, func) {
- func(item);
- for (x in item) {
- if (typeof item[x] === 'object') {
- walkJSON(item[x], func);
+ if (item.length) {
+ for (var x = 0; x < item.length; x++) {
+ var y = item[x];
+ if (y && typeof y === 'object') {
+ walkJSON(y, func);
+ }
+ }
+ } else {
+ func(item);
+ for (x in item) {
+ var y = item[x];
+ if (y && typeof y === 'object') {
+ walkJSON(y, func);
+ }
}
}
}