Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
FlatMap(function (v) {
if(!v) return []
//this code handles real time streaming of the hops map.
function push (to, hops) {
out.push(meta ? {id: to, hops: hops} : to)
}
var out = [], g = post.value
//the edge has already been added to g
if(!reachable) {
reachable = F.reachable(g, start, block)
for(var k in reachable)
if(block.isWanted(reachable[k]))
push(k, reachable[k][0])
} else {
var _reachable = F.reachable(g, start, block)
var patch = F.diff(reachable, _reachable, block)
for(var k in patch) {
if(patch[k] == null || patch[k][0] == null || patch[k][0] > patch[k][1])
push(k, -1)
else if(block.isWanted(patch[k]))
push(k, patch[k][0])
}
reachable = _reachable
}
return out
})