Performs a [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) comparison between two values to determine if they are equivalent.
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
Name | Type | Attribute | Description |
---|---|---|---|
value | The value to compare. | ||
other | The other value to compare. |
{ "comment": "/**\r\n * Performs a\r\n * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\r\n * comparison between two values to determine if they are equivalent.\r\n *\r\n * @since 4.0.0\r\n * @category Lang\r\n * @param {*} value The value to compare.\r\n * @param {*} other The other value to compare.\r\n * @returns {boolean} Returns `true` if the values are equivalent, else `false`.\r\n * @example\r\n *\r\n * const object = { 'a': 1 }\r\n * const other = { 'a': 1 }\r\n *\r\n * eq(object, object)\r\n * // => true\r\n *\r\n * eq(object, other)\r\n * // => false\r\n *\r\n * eq('a', 'a')\r\n * // => true\r\n *\r\n * eq('a', Object('a'))\r\n * // => false\r\n *\r\n * eq(NaN, NaN)\r\n * // => true\r\n */", "meta": { "range": [ 672, 768 ], "filename": "eq.js", "lineno": 31, "path": "C:\\Users\\beaujeup\\projects\\jsdoc-template\\examples\\lodash\\lodash-repo", "code": { "id": "astnode100002171", "name": "eq", "type": "FunctionDeclaration", "paramnames": [ "value", "other" ] } }, "description": "Performs a\r[`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\rcomparison between two values to determine if they are equivalent.", "since": "4.0.0", "tags": [ { "originalTitle": "category", "title": "category", "text": "Lang", "value": "Lang" } ], "params": [ { "type": { "names": [ "*" ] }, "description": "The value to compare.", "name": "value" }, { "type": { "names": [ "*" ] }, "description": "The other value to compare.", "name": "other" } ], "returns": [ { "type": { "names": [ "boolean" ] }, "description": "Returns `true` if the values are equivalent, else `false`." } ], "examples": [ "const object = { 'a': 1 }\rconst other = { 'a': 1 }\r\req(object, object)\r// => true\r\req(object, other)\r// => false\r\req('a', 'a')\r// => true\r\req('a', Object('a'))\r// => false\r\req(NaN, NaN)\r// => true" ], "name": "eq", "longname": "eq", "kind": "function", "scope": "global", "___id": "T000002R000236", "___s": true, "filepath": "eq.js" }