Comparing version 1.6.3 to 1.6.4
{ | ||
"name": "deepdash", | ||
"version": "1.6.3", | ||
"version": "1.6.4", | ||
"description": "Object tree traversal for lodash", | ||
@@ -5,0 +5,0 @@ "main": "deepdash.js", |
@@ -150,3 +150,3 @@ 'use strict'; | ||
//https://stackoverflow.com/questions/48270845/deep-filtering-array-of-objects-javascript | ||
it('deep-filtering-array-of-objects-javascript', function() { | ||
it('deep-filtering-array-of-objects-javascript', () => { | ||
var types = [ | ||
@@ -253,2 +253,54 @@ { | ||
}); | ||
// https://stackoverflow.com/questions/53381935/javascript-find-deeply-nested-objects | ||
it('javascript-find-deeply-nested-objects', () => { | ||
var obj = [ | ||
{ | ||
label: 'first', | ||
id: 1, | ||
children: [], | ||
}, | ||
{ | ||
label: 'second', | ||
id: 2, | ||
children: [ | ||
{ | ||
label: 'third', | ||
id: 3, | ||
children: [ | ||
{ | ||
label: 'fifth', | ||
id: 5, | ||
children: [], | ||
}, | ||
{ | ||
label: 'sixth', | ||
id: 6, | ||
children: [ | ||
{ | ||
label: 'seventh', | ||
id: 7, | ||
children: [], | ||
}, | ||
], | ||
}, | ||
], | ||
}, | ||
{ | ||
label: 'fourth', | ||
id: 4, | ||
children: [], | ||
}, | ||
], | ||
}, | ||
]; | ||
var children = _.filterDeep( | ||
obj, | ||
function(value, key, path, depth, parent) { | ||
if (key == 'children' && parent.id == 6 && value.length) return true; | ||
}, | ||
{ leafsOnly: false } | ||
); | ||
expect(children.length).to.not.equal(0); | ||
// console.log(children); | ||
}); | ||
}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
59875
1609