Comparing version 1.0.6 to 1.0.7
@@ -13,28 +13,26 @@ "use strict"; | ||
const changes = (0, diff_1.diffChars)(original, modified); | ||
const computedDiff = { | ||
left: [], | ||
right: [], | ||
}; | ||
changes.forEach(({ added, removed, value }) => { | ||
const diffs = { left: [], right: [] }; | ||
changes.forEach((change) => { | ||
var _a, _b, _c, _d; | ||
const diffInformation = {}; | ||
const { added, removed, value } = change; | ||
const diff = {}; | ||
if (added) { | ||
diffInformation.type = 'added'; | ||
diffInformation.value = value; | ||
(_a = computedDiff.right) === null || _a === void 0 ? void 0 : _a.push(diffInformation); | ||
diff.type = "added"; | ||
diff.value = value; | ||
(_a = diffs.right) === null || _a === void 0 ? void 0 : _a.push(diff); | ||
} | ||
if (removed) { | ||
diffInformation.type = 'removed'; | ||
diffInformation.value = value; | ||
(_b = computedDiff.left) === null || _b === void 0 ? void 0 : _b.push(diffInformation); | ||
diff.type = "removed"; | ||
diff.value = value; | ||
(_b = diffs.left) === null || _b === void 0 ? void 0 : _b.push(diff); | ||
} | ||
if (!removed && !added) { | ||
diffInformation.type = 'default'; | ||
diffInformation.value = value; | ||
(_c = computedDiff.right) === null || _c === void 0 ? void 0 : _c.push(diffInformation); | ||
(_d = computedDiff.left) === null || _d === void 0 ? void 0 : _d.push(diffInformation); | ||
diff.type = "default"; | ||
diff.value = value; | ||
(_c = diffs.right) === null || _c === void 0 ? void 0 : _c.push(diff); | ||
(_d = diffs.left) === null || _d === void 0 ? void 0 : _d.push(diff); | ||
} | ||
return diffInformation; | ||
return diff; | ||
}); | ||
return computedDiff; | ||
return diffs; | ||
}; | ||
@@ -41,0 +39,0 @@ const getChanges = (original, modified) => { |
{ | ||
"name": "diffling", | ||
"version": "1.0.6", | ||
"version": "1.0.7", | ||
"description": "A versatile diff computation package, supporting various diff methods and line-by-line comparisons.", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
10422
178