Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including object-is with all npm packages installed. Try it out:

var objectIs = require("object-is")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

object-is v1.0.2

ES2015-compliant shim for - differentiates between -0 and +0

#object-is Version Badge

Build Status dependency status dev dependency status License Downloads

npm badge

ES2015-compliant shim for - differentiates between -0 and +0, and can compare to NaN.

Essentially, returns the same value as === - but true for NaN, and false for -0 and +0.

Example = require('object-is');
var assert = require('assert');

assert.ok(, undefined));
assert.ok(, null));
assert.ok(, true));
assert.ok(, false));
assert.ok('foo', 'foo'));

var arr = [1, 2];
assert.ok(, arr));
assert.notOk(, [1, 2]));

assert.ok(, 0));
assert.ok(, -0));
assert.notOk(, -0));

assert.ok(, NaN));
assert.ok(, Infinity));
assert.ok(, -Infinity));


Simply clone the repo, npm install, and run npm test

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free