From 21222d452c37ddfd5e7450224bcf4d5184510ef5 Mon Sep 17 00:00:00 2001 From: Rohit Paul <113459757+RohitPaul0007@users.noreply.github.com> Date: Mon, 11 Sep 2023 10:59:15 +0530 Subject: [PATCH] Update resolve-conflicts.js --- lib/order/resolve-conflicts.js | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/order/resolve-conflicts.js b/lib/order/resolve-conflicts.js index 20556517..98ce1c12 100644 --- a/lib/order/resolve-conflicts.js +++ b/lib/order/resolve-conflicts.js @@ -1,6 +1,6 @@ "use strict"; -var util = require("../util"); +let util = require("../util"); module.exports = resolveConflicts; @@ -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: [], @@ -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 => { @@ -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)); @@ -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;