Skip to content

Commit

Permalink
Merge pull request #244 from mwaldstein/master
Browse files Browse the repository at this point in the history
Move to modular lodash
  • Loading branch information
lutzroeder committed Dec 9, 2018
2 parents 8dc461f + db45b92 commit f60d1a0
Show file tree
Hide file tree
Showing 8 changed files with 38 additions and 35,544 deletions.
2,927 changes: 0 additions & 2,927 deletions dist/dagre.core.js

Large diffs are not rendered by default.

503 changes: 0 additions & 503 deletions dist/dagre.core.min.js

Large diffs are not rendered by default.

21,238 changes: 0 additions & 21,238 deletions dist/dagre.js

Large diffs are not rendered by default.

10,861 changes: 0 additions & 10,861 deletions dist/dagre.min.js

Large diffs are not rendered by default.

29 changes: 28 additions & 1 deletion lib/lodash.js
Expand Up @@ -4,7 +4,34 @@ var lodash;

if (typeof require === "function") {
try {
lodash = require("lodash");
lodash = {
cloneDeep: require("lodash/cloneDeep"),
constant: require("lodash/constant"),
defaults: require("lodash/defaults"),
each: require("lodash/each"),
filter: require("lodash/filter"),
find: require("lodash/find"),
flatten: require("lodash/flatten"),
forEach: require("lodash/forEach"),
forIn: require("lodash/forIn"),
has: require("lodash/has"),
isUndefined: require("lodash/isUndefined"),
last: require("lodash/last"),
map: require("lodash/map"),
mapValues: require("lodash/mapValues"),
max: require("lodash/max"),
merge: require("lodash/merge"),
min: require("lodash/min"),
minBy: require("lodash/minBy"),
now: require("lodash/now"),
pick: require("lodash/pick"),
range: require("lodash/range"),
reduce: require("lodash/reduce"),
sortBy: require("lodash/sortBy"),
uniqueId: require("lodash/uniqueId"),
values: require("lodash/values"),
zipObject: require("lodash/zipObject"),
};
} catch (e) {}
}

Expand Down
7 changes: 2 additions & 5 deletions lib/order/cross-count.js
Expand Up @@ -35,12 +35,9 @@ function twoLayerCrossCount(g, northLayer, southLayer) {
var southPos = _.zipObject(southLayer,
_.map(southLayer, function (v, i) { return i; }));
var southEntries = _.flatten(_.map(northLayer, function(v) {
return _.chain(g.outEdges(v))
.map(function(e) {
return _.sortBy(_.map(g.outEdges(v), function(e) {
return { pos: southPos[e.w], weight: g.edge(e).weight };
})
.sortBy("pos")
.value();
}), "pos");
}), true);

// Build the accumulator tree
Expand Down
11 changes: 5 additions & 6 deletions lib/order/resolve-conflicts.js
Expand Up @@ -93,12 +93,11 @@ function doResolveConflicts(sourceSet) {
_.forEach(entry.out, handleOut(entry));
}

return _.chain(entries)
.filter(function(entry) { return !entry.merged; })
.map(function(entry) {
return _.pick(entry, ["vs", "i", "barycenter", "weight"]);
})
.value();
return _.map(_.filter(entries, function(entry) { return !entry.merged; }),
function(entry) {
return _.pick(entry, ["vs", "i", "barycenter", "weight"]);
});

}

function mergeEntries(target, source) {
Expand Down
6 changes: 3 additions & 3 deletions lib/position/bk.js
Expand Up @@ -250,8 +250,8 @@ function horizontalCompaction(g, layering, root, align, reverseSep) {
}
}

iterate(pass1, _.bind(blockG.predecessors, blockG));
iterate(pass2, _.bind(blockG.successors, blockG));
iterate(pass1, blockG.predecessors.bind(blockG));
iterate(pass2, blockG.successors.bind(blockG));

// Assign x coordinates to all nodes
_.forEach(align, function(v) {
Expand Down Expand Up @@ -359,7 +359,7 @@ function positionX(g) {
});
}

var neighborFn = _.bind(vert === "u" ? g.predecessors : g.successors, g);
var neighborFn = (vert === "u" ? g.predecessors : g.successors).bind(g);
var align = verticalAlignment(g, adjustedLayering, conflicts, neighborFn);
var xs = horizontalCompaction(g, adjustedLayering,
align.root, align.align,
Expand Down

0 comments on commit f60d1a0

Please sign in to comment.