Skip to content

Commit

Permalink
Merge pull request #413 from RohitPaul0007/patch-56
Browse files Browse the repository at this point in the history
Update resolve-conflicts.js
  • Loading branch information
rustedgrail authored Sep 11, 2023
2 parents cd5aeca + 21222d4 commit 838ecce
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions lib/order/resolve-conflicts.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use strict";

var util = require("../util");
let util = require("../util");

module.exports = resolveConflicts;

Expand Down Expand Up @@ -30,9 +30,9 @@ module.exports = resolveConflicts;
* elements in `vs`.
*/
function resolveConflicts(entries, cg) {
var mappedEntries = {};
let mappedEntries = {};
entries.forEach((entry, i) => {
var tmp = mappedEntries[entry.v] = {
let tmp = mappedEntries[entry.v] = {
indegree: 0,
"in": [],
out: [],
Expand All @@ -46,21 +46,21 @@ function resolveConflicts(entries, cg) {
});

cg.edges().forEach(e => {
var entryV = mappedEntries[e.v];
var entryW = mappedEntries[e.w];
let entryV = mappedEntries[e.v];
let entryW = mappedEntries[e.w];
if (entryV !== undefined && entryW !== undefined) {
entryW.indegree++;
entryV.out.push(mappedEntries[e.w]);
}
});

var sourceSet = Object.values(mappedEntries).filter(entry => !entry.indegree);
let sourceSet = Object.values(mappedEntries).filter(entry => !entry.indegree);

return doResolveConflicts(sourceSet);
}

function doResolveConflicts(sourceSet) {
var entries = [];
let entries = [];

function handleIn(vEntry) {
return uEntry => {
Expand All @@ -85,7 +85,7 @@ function doResolveConflicts(sourceSet) {
}

while (sourceSet.length) {
var entry = sourceSet.pop();
let entry = sourceSet.pop();
entries.push(entry);
entry["in"].reverse().forEach(handleIn(entry));
entry.out.forEach(handleOut(entry));
Expand All @@ -97,8 +97,8 @@ function doResolveConflicts(sourceSet) {
}

function mergeEntries(target, source) {
var sum = 0;
var weight = 0;
let sum = 0;
let weight = 0;

if (target.weight) {
sum += target.barycenter * target.weight;
Expand Down

0 comments on commit 838ecce

Please sign in to comment.