• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..22-Nov-2021-

.github/workflows/H22-Nov-2021-1611

node_modules/H22-Nov-2021-2,3992,162

test/H03-May-2022-

.eslintrcH A D22-Nov-202142 64

.travis.ymlH A D22-Nov-2021252 1312

CHANGELOG.mdH A D22-Nov-202111 KiB12697

LICENSEH A D22-Nov-20211.1 KiB2116

README.mdH A D22-Nov-20211.8 KiB5945

package.jsonH A D22-Nov-20212 KiB8887

README.md

1#object-is <sup>[![Version Badge][2]][1]</sup>
2
3[![Build Status][3]][4]
4[![dependency status][5]][6]
5[![dev dependency status][7]][8]
6[![License][license-image]][license-url]
7[![Downloads][downloads-image]][downloads-url]
8
9[![npm badge][11]][1]
10
11ES2015-compliant shim for Object.is - differentiates between -0 and +0, and can compare to NaN.
12
13Essentially, Object.is returns the same value as === - but true for NaN, and false for -0 and +0.
14
15## Example
16
17```js
18Object.is = require('object-is');
19var assert = require('assert');
20
21assert.ok(Object.is());
22assert.ok(Object.is(undefined));
23assert.ok(Object.is(undefined, undefined));
24assert.ok(Object.is(null, null));
25assert.ok(Object.is(true, true));
26assert.ok(Object.is(false, false));
27assert.ok(Object.is('foo', 'foo'));
28
29var arr = [1, 2];
30assert.ok(Object.is(arr, arr));
31assert.notOk(Object.is(arr, [1, 2]));
32
33assert.ok(Object.is(0, 0));
34assert.ok(Object.is(-0, -0));
35assert.notOk(Object.is(0, -0));
36
37assert.ok(Object.is(NaN, NaN));
38assert.ok(Object.is(Infinity, Infinity));
39assert.ok(Object.is(-Infinity, -Infinity));
40```
41
42## Tests
43Simply clone the repo, `npm install`, and run `npm test`
44
45[1]: https://npmjs.org/package/object-is
46[2]: http://versionbadg.es/es-shims/object-is.svg
47[3]: https://travis-ci.org/es-shims/object-is.svg
48[4]: https://travis-ci.org/es-shims/object-is
49[5]: https://david-dm.org/es-shims/object-is.svg
50[6]: https://david-dm.org/es-shims/object-is
51[7]: https://david-dm.org/es-shims/object-is/dev-status.svg
52[8]: https://david-dm.org/es-shims/object-is#info=devDependencies
53[11]: https://nodei.co/npm/object-is.png?downloads=true&stars=true
54[license-image]: http://img.shields.io/npm/l/object-is.svg
55[license-url]: LICENSE
56[downloads-image]: http://img.shields.io/npm/dm/object-is.svg
57[downloads-url]: http://npm-stat.com/charts.html?package=object-is
58
59