From 1a56db151fe6c8bcc5df81ab5c48e6cdf66f81ae Mon Sep 17 00:00:00 2001 From: Matthew Dahl Date: Fri, 5 Aug 2016 19:19:31 -0700 Subject: [PATCH 1/2] Fix bugs with lodash 4 --- lib/nesting-graph.js | 2 +- lib/rank/util.js | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/nesting-graph.js b/lib/nesting-graph.js index 2563d93a..5a5269c7 100644 --- a/lib/nesting-graph.js +++ b/lib/nesting-graph.js @@ -105,7 +105,7 @@ export function cleanup (g) { export function run (g) { var root = addDummyNode(g, 'root', {}, '_root') var depths = treeDepths(g) - var height = _.max(depths) - 1 + var height = _.max(_.values(depths)) - 1 // Note: depths is an Object not an array var nodeSep = 2 * height + 1 g.graph().nestingRoot = root diff --git a/lib/rank/util.js b/lib/rank/util.js index 0b345bc4..bc40ef3a 100644 --- a/lib/rank/util.js +++ b/lib/rank/util.js @@ -35,7 +35,11 @@ export function longestPath (g) { return dfs(e.w) - g.edge(e).minlen })) - if (rank === Number.POSITIVE_INFINITY) { + if ( + rank === Number.POSITIVE_INFINITY || // return value of _.map([]) for Lodash 3 + rank === undefined || // return value of _.map([]) for Lodash 4 + rank === null // return value of _.map([null]) + ) { rank = 0 } From d101bf6759952f64c6d023730b1a96f0cf169fbc Mon Sep 17 00:00:00 2001 From: Matthew Dahl Date: Fri, 5 Aug 2016 19:20:23 -0700 Subject: [PATCH 2/2] Bump version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index b34c64d1..bf28c31a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "dagre", - "version": "0.7.5-pre.2", + "version": "0.7.5-pre.3", "description": "Graph layout for JavaScript", "scripts": { "lint": "npm run lint-js",