Comparing version 1.4.0 to 1.4.1
{ | ||
"name": "deepdash", | ||
"version": "1.4.0", | ||
"version": "1.4.1", | ||
"description": "Object tree traversal for lodash", | ||
@@ -5,0 +5,0 @@ "main": "deepdash.js", |
@@ -109,3 +109,3 @@ <img src="deepdash.svg?sanitize=true" width="64px"/> | ||
### eachDeep (forEachDeep) | ||
`_.eachDeep(object, [iteratee=_.identity], [options={ track: false }])` | ||
`_.eachDeep(object, [iteratee=_.identity], [options={ track: false }])`<br> | ||
Invokes given callback for each field and element of given object or array, nested too. | ||
@@ -115,7 +115,7 @@ | ||
- object: (Object) The object to iterate over. | ||
- \[iteratee\]: (Function) The function (_.identity by default) invoked per iteration. | ||
- \[iteratee\]: (Function) The function invoked per iteration. | ||
`iteratee` will be called with: | ||
- value, key, path, depth, parent, parentKey, parentPath, \[parents\] | ||
- \[options\]: (Object) | ||
- \[track\]: (Boolean) option (false by default) to track parents from current back to the root, useful for circular reference detecting. If true, `iteratee` will have additional `parents` object argument with `values`, `keys` and `paths` arrays inside. | ||
- \[track\]: (Boolean) track parents from current back to the root, useful for circular reference detecting. If true, `iteratee` will have additional `parents` object argument with `values`, `keys` and `paths` arrays inside. | ||
@@ -145,3 +145,3 @@ **Example:** | ||
### keysDeep (paths) | ||
`_.keysDeep(object, [iteratee=_.identity], [options={ checkCircular: false, includeCircularPath: true }])` | ||
`_.keysDeep(object, [iteratee=_.identity], [options={ checkCircular: false, includeCircularPath: true, leafsOnly: false }])`<br> | ||
Creates an array of the paths of object or array. | ||
@@ -152,5 +152,5 @@ | ||
- \[options\]: (Object) | ||
- \[checkCircular\]: (Boolean) option (false by default) to avoid circular references. | ||
- \[includeCircularPath\]: (Boolean) option (true by default) return path to circular reference, if found some, or skip it. | ||
- \[leafsOnly\]: (Boolean) option (false by default) return paths to childless values only. | ||
- \[checkCircular\]: (Boolean) check each value to not be one of the parents, to avoid circular references. | ||
- \[includeCircularPath\]: (Boolean) include path to circular reference, if found some, or skip it. Option ignored if `checkCircular:false`. | ||
- \[leafsOnly\]: (Boolean) return paths to childless values only. By default all the paths will be returned, including parents. | ||
@@ -168,2 +168,11 @@ **Example:** | ||
console.log(keys); | ||
keys = _.keysDeep({ | ||
a: { | ||
b: { | ||
c: [1, 2, 3], | ||
"hello world":{} | ||
}, | ||
}, | ||
},{ leafsOnly: true }); | ||
console.log(keys); | ||
``` | ||
@@ -179,2 +188,8 @@ Console: | ||
'a.b["hello world"]' ] | ||
[ | ||
'a.b.c[0]', | ||
'a.b.c[1]', | ||
'a.b.c[2]', | ||
'a.b["hello world"]' ] | ||
``` | ||
@@ -181,0 +196,0 @@ |
27047
14
639
193