New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

diffling

Package Overview
Dependencies
Maintainers
0
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

diffling - npm Package Compare versions

Comparing version 1.0.5 to 1.0.6

42

dist/diffling.js

@@ -11,20 +11,30 @@ "use strict";

};
const getDiffType = (change) => {
if (change.added)
return "added";
if (change.removed)
return "removed";
return "default";
};
const getDiff = (original, modified) => {
const changes = (0, diff_1.diffChars)(original, modified);
return changes.reduce((diffCollection, change) => {
const diffInfo = {
type: getDiffType(change),
value: change.value
};
diffCollection.left.push(diffInfo);
diffCollection.right.push(diffInfo);
return diffCollection;
}, { left: [], right: [] });
const computedDiff = {
left: [],
right: [],
};
changes.forEach(({ added, removed, value }) => {
var _a, _b, _c, _d;
const diffInformation = {};
if (added) {
diffInformation.type = 'added';
diffInformation.value = value;
(_a = computedDiff.right) === null || _a === void 0 ? void 0 : _a.push(diffInformation);
}
if (removed) {
diffInformation.type = 'removed';
diffInformation.value = value;
(_b = computedDiff.left) === null || _b === void 0 ? void 0 : _b.push(diffInformation);
}
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);
}
return diffInformation;
});
return computedDiff;
};

@@ -31,0 +41,0 @@ const getChanges = (original, modified) => {

{
"name": "diffling",
"version": "1.0.5",
"version": "1.0.6",
"description": "A versatile diff computation package, supporting various diff methods and line-by-line comparisons.",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc