source: node_modules/ramda/src/identical.js

main
Last change on this file was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago

Initial commit

  • Property mode set to 100644
File size: 1.6 KB
Line 
1var _objectIs =
2/*#__PURE__*/
3require("./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
33var 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
61module.exports = identical;
Note: See TracBrowser for help on using the repository browser.