object-is (1.1.6)
Published 2026-02-24 14:02:00 +00:00 by atheaadmin
Installation
registry=npm install object-is@1.1.6"object-is": "1.1.6"About this package
object-is 
ES2015-compliant shim for Object.is - differentiates between -0 and +0, and can compare to NaN.
Essentially, Object.is returns the same value as === - but true for NaN, and false for -0 and +0.
This package implements the es-shim API interface. It works in an ES3-supported environment and complies with the spec.
Example
Object.is = require('object-is');
var assert = require('assert');
assert.ok(Object.is());
assert.ok(Object.is(undefined));
assert.ok(Object.is(undefined, undefined));
assert.ok(Object.is(null, null));
assert.ok(Object.is(true, true));
assert.ok(Object.is(false, false));
assert.ok(Object.is('foo', 'foo'));
var arr = [1, 2];
assert.ok(Object.is(arr, arr));
assert.equal(Object.is(arr, [1, 2]), false);
assert.ok(Object.is(0, 0));
assert.ok(Object.is(-0, -0));
assert.equal(Object.is(0, -0), false);
assert.ok(Object.is(NaN, NaN));
assert.ok(Object.is(Infinity, Infinity));
assert.ok(Object.is(-Infinity, -Infinity));
Tests
Simply clone the repo, npm install, and run npm test
Dependencies
Dependencies
| ID | Version |
|---|---|
| call-bind | ^1.0.7 |
| define-properties | ^1.2.1 |
Development Dependencies
| ID | Version |
|---|---|
| @es-shims/api | ^2.4.2 |
| @ljharb/eslint-config | ^21.1.0 |
| aud | ^2.0.4 |
| auto-changelog | ^2.4.0 |
| eslint | =8.8.0 |
| functions-have-names | ^1.2.3 |
| has-symbols | ^1.0.3 |
| in-publish | ^2.0.1 |
| npmignore | ^0.3.1 |
| nyc | ^10.3.2 |
| safe-publish-latest | ^2.0.0 |
| tape | ^5.7.5 |
Keywords
is
Object.is
equality
sameValueZero
ES6
ES2015
shim
polyfill
es-shim API
