@newdash/newdash
Version:
javascript/typescript utility library
41 lines (40 loc) • 885 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.eq = void 0;
/**
* Performs a
* [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
* comparison between two values to determine if they are equivalent.
*
* @since 5.5.0
* @category Lang
* @param value The value to compare.
* @param other The other value to compare.
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
* @example
*
* ```js
* const object = { 'a': 1 }
* const other = { 'a': 1 }
*
* eq(object, object)
* // => true
*
* eq(object, other)
* // => false
*
* eq('a', 'a')
* // => true
*
* eq('a', Object('a'))
* // => false
*
* eq(NaN, NaN)
* // => true
* ```
*/
function eq(value, other) {
return value === other || (value !== value && other !== other);
}
exports.eq = eq;
exports.default = eq;