+8
-2
@@ -6,3 +6,9 @@ function bfsearch(tree, callback) { | ||
| const node = queue.shift(); | ||
| callback(node); | ||
| const resp = callback(node); | ||
| // if there is a truthy response, assume we found what we are looking for | ||
| if (resp) { | ||
| return resp; | ||
| } | ||
@@ -17,2 +23,2 @@ if (!node.children) continue; | ||
| module.exports = bfsearch; | ||
| module.exports = bfsearch; |
+1
-1
| { | ||
| "name": "bfsearch", | ||
| "version": "1.0.2", | ||
| "version": "1.1.0", | ||
| "description": "Breadth-first search a tree", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
1126
14.55%16
45.45%