🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

baseliner

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

baseliner - npm Package Compare versions

Comparing version

to
1.0.2

2

package.json
{
"name": "baseliner",
"version": "1.0.1",
"version": "1.0.2",
"description": "compare objects with ease",

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

const compareToBaseline = (baseline, otherObject, field, compareFcn) => {
return compareFcn(baseline[(field, otherObject[field])]);
return compareFcn(baseline[field], otherObject[field]);
};
export default compareToBaseline;
import baseliner from "../src";
it("should compare two objects for equality", () => {
const left = { a: 13 };
const right = { a: 13 };
const base = { a: 13 };
const obj1 = { a: 13 };
const obj2 = { a: 17 };
const fcn = (x, y) => x === y;
expect(baseliner(left, right, "a", fcn)).toEqual(true);
expect(baseliner(base, obj1, "a", fcn)).toEqual(true);
expect(baseliner(base, obj2, "a", fcn)).toEqual(false);
});