Open CyanSalt opened 6 years ago
path: es5-object-is
/** * Inspired by Allen Wirfs-Brock * @see {https://tc39.github.io/ecma262/#sec-samevalue} */ function is(a, b) { var target = {} Object.defineProperty(target, '_', {value: a, configurable: false}) try { Object.defineProperty(target, '_', {value: b}) } catch (e) { return false } return true }
is(1, 1) // true is(1, 2) // false is(0, 0) // true is(0, -0) // false is(NaN, NaN) // true is([], []) // false is({}, {}) // false is({}, {}) // false is(Object.prototype, Object.prototype) // true is(null, null) // true is() // true
path: es5-object-is