Socket
Socket
Sign inDemoInstall

has

Package Overview
Dependencies
1
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    has

Object.prototype.hasOwnProperty.call shortcut


Version published
Weekly downloads
25M
increased by1.34%
Maintainers
1
Install size
28.8 kB
Created
Weekly downloads
 

Package description

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

Readme

Source

has

Object.prototype.hasOwnProperty.call shortcut

Installation

npm install --save has

Usage

var has = require('has');

has({}, 'hasOwnProperty'); // false
has(Object.prototype, 'hasOwnProperty'); // true

FAQs

Last updated on 04 Jun 2018

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc