root 70a2ca66f3 first commit 6 days ago
..
.github 70a2ca66f3 first commit 6 days ago
.eslintrc 70a2ca66f3 first commit 6 days ago
.nycrc 70a2ca66f3 first commit 6 days ago
CHANGELOG.md 70a2ca66f3 first commit 6 days ago
LICENSE 70a2ca66f3 first commit 6 days ago
README.md 70a2ca66f3 first commit 6 days ago
index.d.ts 70a2ca66f3 first commit 6 days ago
index.js 70a2ca66f3 first commit 6 days ago
package.json 70a2ca66f3 first commit 6 days ago
tsconfig.json 70a2ca66f3 first commit 6 days ago

README.md

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