Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
@teamteanpm2024/animi-repellendus-perferendis
Advanced tools
[![NPM](https://nodei.co/npm/@teamteanpm2024/animi-repellendus-perferendis.png?compact=true)](https://www.npmjs.com/package/@teamteanpm2024/animi-repellendus-perferendis)
Deep object diffing function for JavaScript; returns true if input 1 differs in any way from input 2. Original code was taken from Differentia.js and ported to TypeScript.
The testDiff function was originally created as a unit testing utility and it was primarily designed/used to test Differentia's search algorithm strategy system, setting a "gold standard" for that library's quality and algorithmic correctness.
The key difference with this version of testDiff is that I removed its "search index" functionality, as it introduced more complexity than it was worth.
Feel free to scavenge the original code as I have: https://github.com/Floofies/Differentia.js/blob/master/spec/testUtils.js
Run npm run build
to compile and test module dist/index.js
.
I have pre-compiled the most up-to-date files in dist
. Enjoy.
unitTest.js
can be safely ignored, as it's a development-only dependency for test.mjs
.
import { testDiff } from "testDiff";
testDiff( input1:any, input2:any, [ deep:boolean = false ] );
input1
, input2
Two values/objects to compare against each other.
deep
(Optional) (Default = true
)TestDiff performs "deep" object/array traversal by default, comparing all reachable values; set this operand to false
to disable traversal and nested comparisons.
Returns true
if input1
's structure, properties, or values differ in any way from input2
, or false
if otherwsie.
Can handle any arbitrary values, as well as objects/arrays.
const myArray1 = "Hello World!";
const myArray2 = "This is a test";
const result = testDiff(myArray1, myArray2);
// result = true
const myArray1 = [1,2,3];
const myArray2 = [4,5,6];
const result = testDiff(myArray1, myArray2);
// result = true
const myArray1 = ["Hello",["World!"]];
const myArray2 = ["Hello",["Developer!"]];
const result = testDiff(myArray1, myArray2);
// result = true
In this example, the function returns false
even though the arrays' contents differ; they are regarded as the same because there are no differences at the top, and disabling traversal prevents the algorithm from seeing deeper differences.
const myArray1 = ["Hello",["World!"]];
const myArray2 = ["Hello",["Developer!"]];
const result = testDiff(myArray1, myArray2, false);
// result = false
FAQs
[![NPM](https://nodei.co/npm/@teamteanpm2024/animi-repellendus-perferendis.png?compact=true)](https://www.npmjs.com/package/@teamteanpm2024/animi-repellendus-perferendis)
The npm package @teamteanpm2024/animi-repellendus-perferendis receives a total of 1 weekly downloads. As such, @teamteanpm2024/animi-repellendus-perferendis popularity was classified as not popular.
We found that @teamteanpm2024/animi-repellendus-perferendis demonstrated a healthy version release cadence and project activity because the last version was released less than 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.