source: trip-planner-front/node_modules/object-is/README.md@ 76712b2

Last change on this file since 76712b2 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 2.0 KB
RevLine 
[6a3a178]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
15This package implements the [es-shim API](https://github.com/es-shims/api) interface. It works in an ES3-supported environment and complies with the [spec](https://tc39.es/ecma262).
16
17## Example
18
19```js
20Object.is = require('object-is');
21var assert = require('assert');
22
23assert.ok(Object.is());
24assert.ok(Object.is(undefined));
25assert.ok(Object.is(undefined, undefined));
26assert.ok(Object.is(null, null));
27assert.ok(Object.is(true, true));
28assert.ok(Object.is(false, false));
29assert.ok(Object.is('foo', 'foo'));
30
31var arr = [1, 2];
32assert.ok(Object.is(arr, arr));
33assert.notOk(Object.is(arr, [1, 2]));
34
35assert.ok(Object.is(0, 0));
36assert.ok(Object.is(-0, -0));
37assert.notOk(Object.is(0, -0));
38
39assert.ok(Object.is(NaN, NaN));
40assert.ok(Object.is(Infinity, Infinity));
41assert.ok(Object.is(-Infinity, -Infinity));
42```
43
44## Tests
45Simply clone the repo, `npm install`, and run `npm test`
46
47[1]: https://npmjs.org/package/object-is
48[2]: http://versionbadg.es/es-shims/object-is.svg
49[3]: https://travis-ci.org/es-shims/object-is.svg
50[4]: https://travis-ci.org/es-shims/object-is
51[5]: https://david-dm.org/es-shims/object-is.svg
52[6]: https://david-dm.org/es-shims/object-is
53[7]: https://david-dm.org/es-shims/object-is/dev-status.svg
54[8]: https://david-dm.org/es-shims/object-is#info=devDependencies
55[11]: https://nodei.co/npm/object-is.png?downloads=true&stars=true
56[license-image]: http://img.shields.io/npm/l/object-is.svg
57[license-url]: LICENSE
58[downloads-image]: http://img.shields.io/npm/dm/object-is.svg
59[downloads-url]: http://npm-stat.com/charts.html?package=object-is
60
Note: See TracBrowser for help on using the repository browser.