@buggyorg/graphtools
Advanced tools
Comparing version 0.1.0 to 0.2.0
@@ -1,1 +0,14 @@ | ||
"use strict"; | ||
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.walk = undefined; | ||
var _walk = require('./walk'); | ||
var walk = _interopRequireWildcard(_walk); | ||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } | ||
exports.walk = walk; |
@@ -39,18 +39,25 @@ 'use strict'; | ||
// inPorts [ {port: name, payload: ?}] | ||
var inPorts = fn(graph.node(node), undefined); | ||
var inPorts = fn(node, graph.node(node), undefined); | ||
var callStack = _lodash2.default.map(inPorts, function (portData) { | ||
return { node: node, port: portData.port, payload: portData.payload }; | ||
return { node: node, port: portData.port, payload: portData.payload, path: [node] }; | ||
}); | ||
var endPoints = []; | ||
while (callStack.length !== 0) { | ||
var cur = callStack.pop(); | ||
console.log(cur); | ||
var inEdges = graph.inEdges(cur.node); | ||
var inNodes = predecessor(cur).plant(inEdges).value(); | ||
var newCallStackElements = _lodash2.default.map(inNodes, function (n) { | ||
var result = fn(graph.node(n), cur.payload); | ||
var newCallStackElements = (0, _lodash2.default)(inNodes).map(function (n) { | ||
var result = fn(n, graph.node(n), cur.payload); | ||
console.log(result); | ||
return _lodash2.default.map(result, function (res) { | ||
return { node: n, port: res.port, payload: res.payload }; | ||
return { node: n, port: res.port, payload: res.payload, path: _lodash2.default.concat(cur.path, n) }; | ||
}); | ||
}); | ||
callStack = _lodash2.default.concat(callStack, _lodash2.default.flatten(newCallStackElements)); | ||
}).flatten().value(); | ||
if (newCallStackElements.length === 0) { | ||
endPoints.push(cur); | ||
} | ||
callStack = _lodash2.default.concat(callStack, newCallStackElements); | ||
} | ||
return endPoints; | ||
} |
{ | ||
"name": "@buggyorg/graphtools", | ||
"version": "0.1.0", | ||
"version": "0.2.0", | ||
"description": "Tools for processing buggy graphs.", | ||
"main": "lib/cli.js", | ||
"main": "lib/api.js", | ||
"scripts": { | ||
@@ -7,0 +7,0 @@ "test": "node node_modules/standard/bin/cmd.js src/**/*.js && babel src -d lib && node_modules/mocha/bin/mocha --compilers js:babel-register" |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
22778
14
338
1