Object.alike >= 0.1.3
Purpose
Loosely compare 2 variables, ignoring undefined variables
Syntax
Object.alike
(
Objecta
Objectb
);
Even though 2 separate objects or arrays look the same, they are never "equal". This function actually looks at all the properties to determine if they are alike.
Parameters
ab
Return values
Boolean
Examples
Compare 2 identical objects
Object.alike({a: 1}, {a: 1});>>> trueCompare 2 nearly identical objects
These 2 objects are nearly the same, one of them just has an "undefined" property. This is ignored, and they're still considered to be "alike"
Object.alike({a: 1}, {a: 1, b: undefined});>>> true
Comments