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

c3-linearization

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

c3-linearization - npm Package Compare versions

Comparing version 0.2.0 to 0.2.1

15

index.js

@@ -43,3 +43,3 @@ "use strict";

function _linearize(graph, head, results, options) {
function _linearize(graph, head, results, visiting, options) {
if (results.hasOwnProperty(head)) {

@@ -49,2 +49,7 @@ return results[head];

if (visiting.has(head)) {
throw new Error('circular dependency found');
}
visiting.add(head);
const parents = graph[head];

@@ -58,3 +63,3 @@

let sequences = parents.map(x => _linearize(graph, x, results, options));
let sequences = parents.map(x => _linearize(graph, x, results, visiting, options));

@@ -67,2 +72,5 @@ if (options.python === true) {

results[head] = res;
visiting.delete(head);
return res;

@@ -75,6 +83,7 @@ }

const results = {};
const visiting = new Set();
const heads = Object.keys(graph);
for (let head of heads) {
_linearize(graph, head, results, options);
_linearize(graph, head, results, visiting, options);
}

@@ -81,0 +90,0 @@

2

package.json
{
"name": "c3-linearization",
"version": "0.2.0",
"version": "0.2.1",
"description": "A package that implements the C3 linearization algorithm",

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

@@ -52,2 +52,9 @@ const assert = require('assert');

it('reports circular dependencies correctly', function () {
assert.throws(
function() { linearize({ a: ['b'], b: ['c'], c: ['b'] }) },
'circular dependency found'
)
})
})
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