You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

has

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

has

Object.prototype.hasOwnProperty.call shortcut

1.0.0
Source
npmnpm
Version published
Weekly downloads
26M
4.05%
Maintainers
1
Weekly downloads
 
Created

What is has?

The 'has' npm package is a utility module that provides a function to check if an object has a property with a given key. It is a safer way to check for properties than the built-in JavaScript 'in' operator or property access, as it doesn't check the prototype chain and avoids potential issues with objects that have modified prototypes or lack a prototype altogether.

What are has's main functionalities?

Check for own property

This feature allows you to check if an object has a specific own property. It returns true if the property exists directly on the object, and false otherwise.

const has = require('has');
const obj = { a: 1 };
console.log(has(obj, 'a')); // true
console.log(has(obj, 'b')); // false

Other packages similar to has

FAQs

Package last updated on 07 Oct 2014

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