Socket
Socket
Sign inDemoInstall

@dagrejs/dagre

Package Overview
Dependencies
Maintainers
0
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dagrejs/dagre - npm Package Compare versions

Comparing version 1.1.3 to 1.1.4

4

lib/acyclic.js

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

function dfs(v) {
if (visited.hasOwnProperty(v)) {
if (Object.hasOwn(visited, v)) {
return;

@@ -43,3 +43,3 @@ }

g.outEdges(v).forEach(e => {
if (stack.hasOwnProperty(e.w)) {
if (Object.hasOwn(stack, e.w)) {
fas.push(e);

@@ -46,0 +46,0 @@ } else {

@@ -13,3 +13,3 @@ let util = require("./util");

if (node.hasOwnProperty("minRank")) {
if (Object.hasOwn(node, "minRank")) {
node.borderLeft = [];

@@ -16,0 +16,0 @@ node.borderRight = [];

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

edge.points.forEach(reverseYOne);
if (edge.hasOwnProperty("y")) {
if (Object.hasOwn(edge, "y")) {
reverseYOne(edge);

@@ -61,3 +61,3 @@ }

edge.points.forEach(swapXYOne);
if (edge.hasOwnProperty("x")) {
if (Object.hasOwn(edge, "x")) {
swapXYOne(edge);

@@ -64,0 +64,0 @@ }

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

inputLabel.points = layoutLabel.points;
if (layoutLabel.hasOwnProperty("x")) {
if (Object.hasOwn(layoutLabel, "x")) {
inputLabel.x = layoutLabel.x;

@@ -237,3 +237,3 @@ inputLabel.y = layoutLabel.y;

let edge = g.edge(e);
if (edge.hasOwnProperty("x")) {
if (Object.hasOwn(edge, "x")) {
getExtremes(edge);

@@ -258,4 +258,4 @@ }

});
if (edge.hasOwnProperty("x")) { edge.x -= minX; }
if (edge.hasOwnProperty("y")) { edge.y -= minY; }
if (Object.hasOwn(edge, "x")) { edge.x -= minX; }
if (Object.hasOwn(edge, "y")) { edge.y -= minY; }
});

@@ -289,3 +289,3 @@

let edge = g.edge(e);
if (edge.hasOwnProperty("x")) {
if (Object.hasOwn(edge, "x")) {
if (edge.labelpos === "l" || edge.labelpos === "r") {

@@ -292,0 +292,0 @@ edge.width -= edge.labeloffset;

@@ -34,3 +34,4 @@ let util = require("./util");

let depths = treeDepths(g);
let height = Math.max(...Object.values(depths)) - 1; // Note: depths is an Object not an array
let depthsArr = Object.values(depths);
let height = util.applyWithChunking(Math.max, depthsArr) - 1; // Note: depths is an Object not an array
let nodeSep = 2 * height + 1;

@@ -37,0 +38,0 @@

@@ -57,3 +57,3 @@ let Graph = require("@dagrejs/graphlib").Graph;

if (node.hasOwnProperty("minRank")) {
if (Object.hasOwn(node, "minRank")) {
result.setNode(v, {

@@ -60,0 +60,0 @@ borderLeft: node.borderLeft[rank],

@@ -21,3 +21,4 @@ "use strict";

let simpleNodes = g.nodes().filter(v => !g.children(v).length);
let maxRank = Math.max(...simpleNodes.map(v => g.node(v).rank));
let simpleNodesRanks = simpleNodes.map(v => g.node(v).rank);
let maxRank = util.applyWithChunking(Math.max, simpleNodesRanks);
let layers = util.range(maxRank + 1).map(() => []);

@@ -24,0 +25,0 @@

@@ -23,3 +23,3 @@ let barycenter = require("./barycenter");

subgraphs[entry.v] = subgraphResult;
if (subgraphResult.hasOwnProperty("barycenter")) {
if (Object.hasOwn(subgraphResult, "barycenter")) {
mergeBarycenters(entry, subgraphResult);

@@ -40,3 +40,3 @@ }

brPred = g.node(g.predecessors(br)[0]);
if (!result.hasOwnProperty("barycenter")) {
if (!Object.hasOwn(result, "barycenter")) {
result.barycenter = 0;

@@ -43,0 +43,0 @@ result.weight = 0;

@@ -7,3 +7,3 @@ let util = require("../util");

let parts = util.partition(entries, entry => {
return entry.hasOwnProperty("barycenter");
return Object.hasOwn(entry, "barycenter");
});

@@ -10,0 +10,0 @@ let sortable = parts.lhs,

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

}
return !!conflicts[v] && conflicts[v].hasOwnProperty(w);
return !!conflicts[v] && Object.hasOwn(conflicts[v], w);
}

@@ -317,4 +317,4 @@

let alignToVals = Object.values(alignTo),
alignToMin = Math.min(...alignToVals),
alignToMax = Math.max(...alignToVals);
alignToMin = util.applyWithChunking(Math.min, alignToVals),
alignToMax = util.applyWithChunking(Math.max, alignToVals);

@@ -329,5 +329,5 @@ ["u", "d"].forEach(vert => {

let xsVals = Object.values(xs);
let delta = alignToMin - Math.min(...xsVals);
let delta = alignToMin - util.applyWithChunking(Math.min, xsVals);
if (horiz !== "l") {
delta = alignToMax - Math.max(...xsVals);
delta = alignToMax - util.applyWithChunking(Math.max,xsVals);
}

@@ -395,3 +395,3 @@

sum += vLabel.width / 2;
if (vLabel.hasOwnProperty("labelpos")) {
if (Object.hasOwn(vLabel, "labelpos")) {
switch (vLabel.labelpos.toLowerCase()) {

@@ -411,3 +411,3 @@ case "l": delta = -vLabel.width / 2; break;

sum += wLabel.width / 2;
if (wLabel.hasOwnProperty("labelpos")) {
if (Object.hasOwn(wLabel, "labelpos")) {
switch (wLabel.labelpos.toLowerCase()) {

@@ -414,0 +414,0 @@ case "l": delta = wLabel.width / 2; break;

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

tree.neighbors(v).forEach(w => {
if (!visited.hasOwnProperty(w)) {
if (!Object.hasOwn(visited, w)) {
nextLim = dfsAssignLowLim(tree, visited, nextLim, w, v);

@@ -138,0 +138,0 @@ }

"use strict";
const { applyWithChunking } = require("../util");
module.exports = {

@@ -34,3 +36,3 @@ longestPath: longestPath,

var label = g.node(v);
if (visited.hasOwnProperty(v)) {
if (Object.hasOwn(visited, v)) {
return label.rank;

@@ -40,3 +42,3 @@ }

var rank = Math.min(...g.outEdges(v).map(e => {
let outEdgesMinLens = g.outEdges(v).map(e => {
if (e == null) {

@@ -47,4 +49,6 @@ return Number.POSITIVE_INFINITY;

return dfs(e.w) - g.edge(e).minlen;
}));
});
var rank = applyWithChunking(Math.min, outEdgesMinLens);
if (rank === Number.POSITIVE_INFINITY) {

@@ -51,0 +55,0 @@ rank = 0;

@@ -10,2 +10,3 @@ /* eslint "no-console": off */

addDummyNode,
applyWithChunking,
asNonCompoundGraph,

@@ -157,3 +158,3 @@ buildLayerMatrix,

function normalizeRanks(g) {
let min = Math.min(...g.nodes().map(v => {
let nodeRanks = g.nodes().map(v => {
let rank = g.node(v).rank;

@@ -165,6 +166,7 @@ if (rank === undefined) {

return rank;
}));
});
let min = applyWithChunking(Math.min, nodeRanks);
g.nodes().forEach(v => {
let node = g.node(v);
if (node.hasOwnProperty("rank")) {
if (Object.hasOwn(node, "rank")) {
node.rank -= min;

@@ -177,3 +179,4 @@ }

// Ranks may not start at 0, so we need to offset them
let offset = Math.min(...g.nodes().map(v => g.node(v).rank));
let nodeRanks = g.nodes().map(v => g.node(v).rank);
let offset = applyWithChunking(Math.min, nodeRanks);

@@ -212,4 +215,25 @@ let layers = [];

function splitToChunks(array, chunkSize = CHUNKING_THRESHOLD) {
const chunks = [];
for (let i = 0; i < array.length; i += chunkSize) {
const chunk = array.slice(i, i + chunkSize);
chunks.push(chunk);
}
return chunks;
}
const CHUNKING_THRESHOLD = 65535;
function applyWithChunking(fn, argsArray) {
if(argsArray.length > CHUNKING_THRESHOLD) {
const chunks = splitToChunks(argsArray);
return fn.apply(null, chunks.map(chunk => fn.apply(null, chunk)));
} else {
return fn.apply(null, argsArray);
}
}
function maxRank(g) {
return Math.max(...g.nodes().map(v => {
const nodes = g.nodes();
const nodeRanks = nodes.map(v => {
let rank = g.node(v).rank;

@@ -219,5 +243,6 @@ if (rank === undefined) {

}
return rank;
});
return rank;
}));
return applyWithChunking(Math.max, nodeRanks);
}

@@ -224,0 +249,0 @@

@@ -1,1 +0,1 @@

module.exports = "1.1.3";
module.exports = "1.1.4";
{
"name": "@dagrejs/dagre",
"version": "1.1.3",
"version": "1.1.4",
"description": "Graph layout for JavaScript",

@@ -27,3 +27,3 @@ "author": "Chris Pettitt <cpettitt@gmail.com>",

"dependencies": {
"@dagrejs/graphlib": "2.2.2"
"@dagrejs/graphlib": "2.2.4"
},

@@ -30,0 +30,0 @@ "devDependencies": {

# dagre - Graph layout for JavaScript
[![Build Status](https://github.com/dagrejs/dagre/workflows/Build%20Status/badge.svg?branch=master)](https://github.com/dagrejs/dagre/actions?query=workflow%3A%22Build+Status%22)
[![npm](https://img.shields.io/npm/v/dagre.svg)](https://www.npmjs.com/package/dagre)
[![npm](https://img.shields.io/npm/v/@dagrejs/dagre.svg)](https://www.npmjs.com/package/@dagrejs/dagre)

@@ -6,0 +6,0 @@

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

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