isEquivalent()

Verifies if 2 objects are completely equivalent. Equivalence is verified in type, value, key-value pairs, etc...

Arguments

Required:

_a: any, b: any

Returns

(boolean): true if equivalent, false if not.

Example

console.log(isEquivalent("hello", "hello"));
// => true

console.log(isEquivalent(1, 1));
// => true

console.log(isEquivalent("1", 1));
// => false

console.log(isEquivalent({ greeting: "hello" }, { greeting: "hello" }));
// => true

console.log(isEquivalent({ greeting: "hello" }, { greeting: "goodbye" }));
// => false

console.log(isEquivalent({ greeting: "hello" }, { farewell: "hello" }));
// => false

console.log(isEquivalent({ greeting: "hello" }, { greeting: "hello", farewell: "goodbye" }));
// => false