Socket
Socket
Sign inDemoInstall

object-is

Package Overview
Dependencies
Maintainers
2
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

object-is

ES2015-compliant shim for Object.is - differentiates between -0 and +0


Version published
Weekly downloads
19M
increased by4.27%
Maintainers
2
Weekly downloads
 
Created

What is object-is?

The 'object-is' npm package provides a utility function for comparing two values, determining if they are the same value. This is particularly useful for edge cases in JavaScript comparisons, such as NaN, +0, and -0, where traditional equality checks (== or ===) might fail or not behave as expected.

What are object-is's main functionalities?

Exact equality comparison

This feature allows for the comparison of two values to determine if they are exactly the same, including more accurate handling of special JavaScript cases like NaN and +/-0.

const objectIs = require('object-is');
console.log(objectIs('foo', 'foo')); // true
console.log(objectIs(window, window)); // true
console.log(objectIs('foo', 'bar')); // false
console.log(objectIs(0, -0)); // false
console.log(objectIs(NaN, NaN)); // true

Other packages similar to object-is

Keywords

FAQs

Package last updated on 27 Nov 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc