Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Immutable data can make things fast. The problem is trying to model your data as immutable is very challenging. You might have seen libraries like Immutable.js and seamless-immutable and feared switching.
EvilDiff comes to the rescue!
It will compare two pieces of data, apply any changes it finds, and clone along the path. Unchanged data keep their old pointer and changed data gets new pointers along its path.
Install evil-diff using npm or yarn.
npm install evil-diff
Then require it into any module.
import EvilDiff from 'evil-diff';
var objDiff = EvilDiff.revise(obj1, obj2);
No changes between two objects returns original object:
const result1 = { 'John': {name: {first: 'John', last: 'Doe'}, zipCode: '86469'} };
const result2 = { 'John': {name: {first: 'John', last: 'Doe'}, zipCode: '86469'} };
assertFalse(result1 === result2); // not same object
assertdeepEqual(result1, result2); // but same data
const revisedResult = EvilDiff.revise(result1, result2);
assertTrue(revisedResult === result1); //Data was unchanged, returns old pointer
Changes return new references, but preserve references for unchanged properties
const result1 = { 'John': {name: {first: 'John', last: 'Doe'}, zipCode: '86469'} };
const result2 = { 'John': {name: {first: 'John', last: 'Doe'}, zipCode: '91752'} };
assertFalse(result1 === result3); // not same object
assertNotDeepEqual(result1, result3); // different data
const revisedResult = EvilDiff.revise(result1, result3);
assertFalse(revisedResult === result1 || revisedResult === result3); //Data was changed, new object
assertDeepEqual(revisedResult, result3); // Data matches result3
assertTrue(revisedResult.John.name === result1.John.name); // Unchanged data keeps same reference
FAQs
evil-diff
The npm package evil-diff receives a total of 6 weekly downloads. As such, evil-diff popularity was classified as not popular.
We found that evil-diff demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.