Object.alike >= 0.1.3

Purpose

Loosely compare 2 variables, ignoring undefined variables

Description

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.

Syntax

Object.alike ( ObjectaObjectb );

Parameters

a

b

Return values

Boolean

Examples

Compare 2 identical objects

Object.alike({a: 1}, {a: 1});
>>> true

Compare 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