Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

object.hasown

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

object.hasown

ES spec-compliant shim for Object.hasOwn

  • 1.1.4
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created

What is object.hasown?

The object.hasown npm package is a polyfill for the `Object.hasOwn` method, which is a standardized way of checking if an object has a property as its own (not inherited from its prototype chain). This package provides a reliable way to perform this check across different JavaScript environments, including those that do not support the `Object.hasOwn` method natively.

What are object.hasown's main functionalities?

Checking for own property

This feature allows you to check if an object has a specific property as its own. The code sample demonstrates checking for the existence of properties 'a' and 'b' on an object.

const hasOwn = require('object.hasown');
const object = { a: 1 };
const hasA = hasOwn(object, 'a'); // true
const hasB = hasOwn(object, 'b'); // false

Other packages similar to object.hasown

Keywords

FAQs

Package last updated on 22 Mar 2024

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