Last change
on this file since eed0bf8 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
799 bytes
|
Line | |
---|
1 | /**
|
---|
2 | * Performs a
|
---|
3 | * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
|
---|
4 | * comparison between two values to determine if they are equivalent.
|
---|
5 | *
|
---|
6 | * @static
|
---|
7 | * @memberOf _
|
---|
8 | * @since 4.0.0
|
---|
9 | * @category Lang
|
---|
10 | * @param {*} value The value to compare.
|
---|
11 | * @param {*} other The other value to compare.
|
---|
12 | * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
|
---|
13 | * @example
|
---|
14 | *
|
---|
15 | * var object = { 'a': 1 };
|
---|
16 | * var other = { 'a': 1 };
|
---|
17 | *
|
---|
18 | * _.eq(object, object);
|
---|
19 | * // => true
|
---|
20 | *
|
---|
21 | * _.eq(object, other);
|
---|
22 | * // => false
|
---|
23 | *
|
---|
24 | * _.eq('a', 'a');
|
---|
25 | * // => true
|
---|
26 | *
|
---|
27 | * _.eq('a', Object('a'));
|
---|
28 | * // => false
|
---|
29 | *
|
---|
30 | * _.eq(NaN, NaN);
|
---|
31 | * // => true
|
---|
32 | */
|
---|
33 | function eq(value, other) {
|
---|
34 | return value === other || (value !== value && other !== other);
|
---|
35 | }
|
---|
36 |
|
---|
37 | module.exports = eq;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.