1 | # hasown <sup>[![Version Badge][npm-version-svg]][package-url]</sup>
|
---|
2 |
|
---|
3 | [![github actions][actions-image]][actions-url]
|
---|
4 | [![coverage][codecov-image]][codecov-url]
|
---|
5 | [![License][license-image]][license-url]
|
---|
6 | [![Downloads][downloads-image]][downloads-url]
|
---|
7 |
|
---|
8 | [![npm badge][npm-badge-png]][package-url]
|
---|
9 |
|
---|
10 | A robust, ES3 compatible, "has own property" predicate.
|
---|
11 |
|
---|
12 | ## Example
|
---|
13 |
|
---|
14 | ```js
|
---|
15 | const assert = require('assert');
|
---|
16 | const hasOwn = require('hasown');
|
---|
17 |
|
---|
18 | assert.equal(hasOwn({}, 'toString'), false);
|
---|
19 | assert.equal(hasOwn([], 'length'), true);
|
---|
20 | assert.equal(hasOwn({ a: 42 }, 'a'), true);
|
---|
21 | ```
|
---|
22 |
|
---|
23 | ## Tests
|
---|
24 | Simply clone the repo, `npm install`, and run `npm test`
|
---|
25 |
|
---|
26 | [package-url]: https://npmjs.org/package/hasown
|
---|
27 | [npm-version-svg]: https://versionbadg.es/inspect-js/hasown.svg
|
---|
28 | [deps-svg]: https://david-dm.org/inspect-js/hasOwn.svg
|
---|
29 | [deps-url]: https://david-dm.org/inspect-js/hasOwn
|
---|
30 | [dev-deps-svg]: https://david-dm.org/inspect-js/hasOwn/dev-status.svg
|
---|
31 | [dev-deps-url]: https://david-dm.org/inspect-js/hasOwn#info=devDependencies
|
---|
32 | [npm-badge-png]: https://nodei.co/npm/hasown.png?downloads=true&stars=true
|
---|
33 | [license-image]: https://img.shields.io/npm/l/hasown.svg
|
---|
34 | [license-url]: LICENSE
|
---|
35 | [downloads-image]: https://img.shields.io/npm/dm/hasown.svg
|
---|
36 | [downloads-url]: https://npm-stat.com/charts.html?package=hasown
|
---|
37 | [codecov-image]: https://codecov.io/gh/inspect-js/hasOwn/branch/main/graphs/badge.svg
|
---|
38 | [codecov-url]: https://app.codecov.io/gh/inspect-js/hasOwn/
|
---|
39 | [actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/inspect-js/hasOwn
|
---|
40 | [actions-url]: https://github.com/inspect-js/hasOwn/actions
|
---|