recursive-find
v1.0.2
Published
Recursively find values of an object that match a test function
Downloads
7
Readme
recursive-find
Recursively find values of an object that match a test function
npm install recursive-find
example
var recursiveFind = require('recursive-find')
var data = {
title: 'El Duderino',
url: 'http://dooder.com',
links: [
{url: 'http://dooder.com/about'},
{url: 'http://dooder.com/contact'},
{url: 'http://google.com'}
],
}
var urls = recursiveFind(data, function(value) {
return typeof value === 'string' && value.indexOf('http://dooder.com') >= 0
})
console.log(urls)
// [ 'http://dooder.com',
// 'http://dooder.com/about',
// 'http://dooder.com/contact' ]
license
MIT