+ function findRecursive(collection, searchTerm) {
+ var items = _.filter(collection, function(item) {
+ return item.label && _.includes(item.label.toLowerCase().replace(/ /g, ''), searchTerm);
+ });
+ _.each(collection, function(item) {
+ if (_.isPlainObject(item) && item.child) {
+ var childMatches = findRecursive(item.child, searchTerm);
+ if (childMatches.length) {
+ Array.prototype.push.apply(items, childMatches);
+ }
+ }
+ });
+ return items;
+ }
+