Security News
The Dark Side of Open Source
At Node Congress, Socket CEO Feross Aboukhadijeh uncovers the darker aspects of open source, where applications that rely heavily on third-party dependencies can be exploited in supply chain attacks.
Package description
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.
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
Lodash's 'has' function is similar to 'has' in that it checks if a path is a direct property of an object. However, lodash.has also allows checking for deep properties using a dot or array path notation, which 'has' does not support.
This package provides functionality similar to 'has' by checking if an object contains a certain property. The difference is mainly in the implementation and the specific API provided by the package.
Readme
Object.prototype.hasOwnProperty.call shortcut
npm install --save has
var has = require('has');
has({}, 'hasOwnProperty'); // false
has(Object.prototype, 'hasOwnProperty'); // true
FAQs
Object.prototype.hasOwnProperty.call shortcut
The npm package has receives a total of 20,960,555 weekly downloads. As such, has popularity was classified as popular.
We found that has demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
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.
Security News
At Node Congress, Socket CEO Feross Aboukhadijeh uncovers the darker aspects of open source, where applications that rely heavily on third-party dependencies can be exploited in supply chain attacks.
Research
Security News
The Socket Research team found this npm package includes code for collecting sensitive developer information, including your operating system username, Git username, and Git email.
Security News
OpenJS is warning of social engineering takeovers targeting open source projects after receiving a credible attempt on the foundation.