1 | var _objectIs =
|
---|
2 | /*#__PURE__*/
|
---|
3 | require("./internal/_objectIs.js");
|
---|
4 | /**
|
---|
5 | * Returns true if its arguments are identical, false otherwise. Values are
|
---|
6 | * identical if they reference the same memory. `NaN` is identical to `NaN`;
|
---|
7 | * `0` and `-0` are not identical.
|
---|
8 | *
|
---|
9 | * Note this is merely a curried version of ES6 `Object.is`.
|
---|
10 | *
|
---|
11 | * `identical` does not support the `__` placeholder.
|
---|
12 | *
|
---|
13 | * @func
|
---|
14 | * @memberOf R
|
---|
15 | * @since v0.15.0
|
---|
16 | * @category Relation
|
---|
17 | * @sig a -> a -> Boolean
|
---|
18 | * @param {*} a
|
---|
19 | * @param {*} b
|
---|
20 | * @return {Boolean}
|
---|
21 | * @example
|
---|
22 | *
|
---|
23 | * const o = {};
|
---|
24 | * R.identical(o, o); //=> true
|
---|
25 | * R.identical(1, 1); //=> true
|
---|
26 | * R.identical(1, '1'); //=> false
|
---|
27 | * R.identical([], []); //=> false
|
---|
28 | * R.identical(0, -0); //=> false
|
---|
29 | * R.identical(NaN, NaN); //=> true
|
---|
30 | */
|
---|
31 |
|
---|
32 |
|
---|
33 | var identical = function (a, b) {
|
---|
34 | switch (arguments.length) {
|
---|
35 | case 0:
|
---|
36 | return identical;
|
---|
37 |
|
---|
38 | case 1:
|
---|
39 | return function () {
|
---|
40 | return function unaryIdentical(_b) {
|
---|
41 | switch (arguments.length) {
|
---|
42 | case 0:
|
---|
43 | return unaryIdentical;
|
---|
44 |
|
---|
45 | default:
|
---|
46 | return _objectIs(a, _b);
|
---|
47 | }
|
---|
48 | };
|
---|
49 | }();
|
---|
50 |
|
---|
51 | default:
|
---|
52 | return _objectIs(a, b);
|
---|
53 | }
|
---|
54 | }; // In order to support Cross-origin Window objects as arguments to identical,
|
---|
55 | // it cannot be implemented as _curry2(_objectIs).
|
---|
56 | // The reason is that _curry2 checks if a function argument is the placeholder __
|
---|
57 | // by accessing a paritcular property. However, across URL origins access
|
---|
58 | // to most properties of Window is forbidden.
|
---|
59 |
|
---|
60 |
|
---|
61 | module.exports = identical; |
---|