New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

async-bfs

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

async-bfs - npm Package Compare versions

Comparing version 0.1.4 to 0.1.5

49

lib/bfs.js

@@ -18,25 +18,32 @@ var async = require('async');

function moveQueueTask(node, callback) {
moves(depth, node, function(err, newNodes) {
if (err) return callback(err);
if (foundGoal || !newNodes || !newNodes.length)
return callback();
var goalQueue = async.queue(goalQueueTask, goal.parallel || 4);
goalQueue.drain = callback;
newNodes.forEach(function(newNode) {
if (visited.hasOwnProperty(newNode)) return;
nodeQueue.push(newNode);
visited[newNode] = {from: node};
goalQueue.push([newNode]);
});
if (!goalQueue.length()) return callback();
function goalQueueTask(newNode, goalCallback) {
if (foundGoal) return goalCallback();
goal(newNode, function(err, isGoal) {
try {
moves(depth, node, function(err, newNodes) {
if (err) return callback(err);
if (foundGoal || !newNodes || !newNodes.length)
return callback();
var goalQueue = async.queue(goalQueueTask, goal.parallel || 4);
goalQueue.drain = callback;
newNodes.forEach(function(newNode) {
if (visited.hasOwnProperty(newNode)) return;
nodeQueue.push(newNode);
visited[newNode] = {from: node};
if (err) return goalCallback(err);
if (isGoal) foundGoal = {node: newNode};
goalCallback();
goalQueue.push([newNode]);
});
};
});
if (!goalQueue.length()) return callback();
function goalQueueTask(newNode, goalCallback) {
if (foundGoal) return goalCallback();
goal(newNode, function(err, isGoal) {
visited[newNode] = {from: node};
if (err) return goalCallback(err);
if (isGoal) foundGoal = {node: newNode};
goalCallback();
});
};
});
} catch (e) {
// In large graphs you may get a Maximum call stack size
// exceeded error. Its best to reply with an error instead
// of dying
return callback(e);
}
}

@@ -43,0 +50,0 @@ function moveQueueDone() {

{
"name": "async-bfs",
"version": "0.1.4",
"version": "0.1.5",
"description": "Flexible functional async breadth first search",

@@ -5,0 +5,0 @@ "main": "index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc