-
Notifications
You must be signed in to change notification settings - Fork 9
Syntax
Alex edited this page May 31, 2015
·
3 revisions
var root = {
object: {
number: 1
},
string: 'foo'
};
for(let item of new RecursiveIterator(root)) {
console.log(item.path.join('.'), item.node);
}
// or
for(let {parent, node, key, path, deep} of new RecursiveIterator(root)) {
console.log(path.join('.'), node);
}
// or
for(let {node, path} of new RecursiveIterator(root, 1)) {
console.log(path.join('.'), node);
}
var root = {
object: {
number: 1
},
string: 'foo'
};
var iterator = new RecursiveIterator(root);
for(var item = iterator.next(); !item.done; item = iterator.next()) {
var state = item.value;
console.log(state.path.join('.'), state.node);
}