Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@buggyorg/dynatype-network-graph

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@buggyorg/dynatype-network-graph - npm Package Compare versions

Comparing version 0.1.8 to 0.1.9

ack.png

30

lib/dynatype-network.js

@@ -235,3 +235,2 @@ 'use strict';

var paths = replaceGenericInput(graph, nodes[j]);
// var types = ''
var pathsToReplace = [];

@@ -241,8 +240,2 @@ for (var i = 0; i < paths.length; i++) {

var type = processGraph.node(currentPath[0].node).outputPorts[currentPath[0].port] || processGraph.node(currentPath[0].node).inputPorts[currentPath[0].port];
/* if (types === '') {
types = type
} else if (type !== types) {
var error = 'Type mismatch: Two pathes ending in node ' + currentPath[currentPath.length - 1].node + ' have different types: ' + types + ' and ' + type
throw new Error(error)
}*/
if (type === 'generic') {

@@ -457,24 +450,3 @@ pathsToReplace = pathsToReplace.concat([currentPath]);

function isGenericFree(graph) {
var nodes = graph.nodes();
for (var i = 0; i < nodes.length; i++) {
var inp = graph.node(nodes[i]).inputPorts;
if (inp !== undefined) {
var inpKeys = Object.keys(inp);
for (var j = 0; j < inpKeys.length; j++) {
if (isGeneric(inp[inpKeys[j]])) {
return false;
}
}
}
var outp = graph.node(nodes[i]).outputPorts;
if (outp !== undefined) {
var outpKeys = Object.keys(outp);
for (var _j2 = 0; _j2 < outpKeys.length; _j2++) {
if (isGeneric(outp[outpKeys[_j2]])) {
return false;
}
}
}
}
return true;
return genericNodes(graph).length === 0;
}
{
"name": "@buggyorg/dynatype-network-graph",
"version": "0.1.8",
"version": "0.1.9",
"description": "",

@@ -5,0 +5,0 @@ "main": "lib/dynatype-network.js",

@@ -188,3 +188,2 @@ var grlib = require('graphlib')

var paths = replaceGenericInput(graph, nodes[j])
// var types = ''
var pathsToReplace = []

@@ -195,8 +194,2 @@ for (let i = 0; i < paths.length; i++) {

processGraph.node(currentPath[0].node).inputPorts[currentPath[0].port]
/* if (types === '') {
types = type
} else if (type !== types) {
var error = 'Type mismatch: Two pathes ending in node ' + currentPath[currentPath.length - 1].node + ' have different types: ' + types + ' and ' + type
throw new Error(error)
}*/
if (type === 'generic') {

@@ -389,24 +382,3 @@ pathsToReplace = pathsToReplace.concat([currentPath])

export function isGenericFree (graph) {
var nodes = graph.nodes()
for (let i = 0; i < nodes.length; i++) {
var inp = graph.node(nodes[i]).inputPorts
if (inp !== undefined) {
var inpKeys = Object.keys(inp)
for (let j = 0; j < inpKeys.length; j++) {
if (isGeneric(inp[inpKeys[j]])) {
return false
}
}
}
var outp = graph.node(nodes[i]).outputPorts
if (outp !== undefined) {
var outpKeys = Object.keys(outp)
for (let j = 0; j < outpKeys.length; j++) {
if (isGeneric(outp[outpKeys[j]])) {
return false
}
}
}
}
return true
return genericNodes(graph).length === 0
}

@@ -135,3 +135,2 @@ /* global describe, it */

expect(dtypenet.isGenericFree(genGraph)).to.be.true
// console.log(JSON.stringify(grlib.json.write(genGraph), null, 2))
expect(genGraph.node('mapInc').inputPorts['data']).to.equal('[int64]')

@@ -195,2 +194,16 @@ expect(genGraph.node('mapInc:apply').inputPorts['value']).to.equal('int64')

it('can process graphs with continuations', () => {
var gaGraph = grlib.json.read(JSON.parse(fs.readFileSync('./test/fixtures/factorial_mux.json')))
var typedGraph = dtypenet.replaceGenerics(gaGraph)
expect(typedGraph).to.be.ok
expect(dtypenet.genericNodes(typedGraph)).to.have.length(0)
})
it('can handle ackermann example', () => {
var gaGraph = grlib.json.read(JSON.parse(fs.readFileSync('./test/fixtures/ack.json')))
var typedGraph = dtypenet.replaceGenerics(gaGraph)
expect(typedGraph).to.be.ok
expect(dtypenet.genericNodes(typedGraph)).to.have.length(0)
})
/*

@@ -197,0 +210,0 @@ it('backtracks second path if first contains just generics', () => {

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