hasown
TypeScript icon, indicating that this package has built-in type declarations

2.0.2 • Public • Published

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

Dependencies (1)

Dev Dependencies (17)

Package Sidebar

Install

npm i hasown

Weekly Downloads

36,605,720

Version

2.0.2

License

MIT

Unpacked Size

8.77 kB

Total Files

10

Last publish

Collaborators

  • ljharb
  • radubrehar