Skip to content

Commit

Permalink
Merge pull request #6 from sandersky/master
Browse files Browse the repository at this point in the history
Fix bugs with lodash 4
  • Loading branch information
sandersky authored Aug 6, 2016
2 parents 85dc7c4 + d101bf6 commit 7378e4b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/nesting-graph.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 5 additions & 1 deletion lib/rank/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down

0 comments on commit 7378e4b

Please sign in to comment.