1. hasown
A robust, ES3 compatible, "has own property" predicate.
hasown
Package: hasown
Created by: inspect-js
Last modified: Sun, 10 Mar 2024 17:38:25 GMT
Version: 2.0.2
License: MIT
Downloads: 153,011,756
Repository: https://github.com/inspect-js/hasOwn

Install

npm install hasown
yarn add hasown

hasown Version Badge

github actions
coverage
License
Downloads

npm badge

A robust, ES3 compatible, "has own property" predicate.

Example

 const assert = require('assert');
const hasOwn = require('hasown');

assert.equal(hasOwn({}, 'toString'), false);
assert.equal(hasOwn([], 'length'), true);
assert.equal(hasOwn({ a: 42 }, 'a'), true);

Tests

Simply clone the repo, npm install, and run npm test

RELATED POST

10 Must-Know Windows Shortcuts That Will Save You Time

10 Must-Know Windows Shortcuts That Will Save You Time

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Navigating AWS Networking: Essential Hacks for Smooth Operation

Navigating AWS Networking: Essential Hacks for Smooth Operation

Achieving Stunning Visuals with Unity's Global Illumination

Achieving Stunning Visuals with Unity's Global Illumination

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code