vas
Version:
simple composable data services using muxrpc
21 lines (15 loc) • 374 B
JavaScript
module.exports = walk
function walk (services, cb, path) {
path = path || []
if (!Array.isArray(services)) {
services = [services]
}
services.forEach(function (service) {
var name = service.name
var servicePath = path.concat([name])
cb(service, servicePath)
if (service.services) {
walk(service.services, cb, servicePath)
}
})
}