# hasown

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

Latest version **2.0.4** (published 2026-05-28) · MIT license · 0 weekly downloads

> **Native alternative:** Object.prototype.hasOwnProperty.call(obj, prop) (or in later versions of node, "Object.hasOwn(obj, prop)") — Use native JavaScript (Node 0.10.0+) (https://developer.mozilla.orgGlobal_Objects/Object/hasOwnProperty)

## Install

```sh
npm install hasown
pnpm add hasown
yarn add hasown
bun add hasown
```

## Health

**Score 65/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; high maintenance score; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 2.0.4 |
| Published | 2026-05-28 |
| First published | 2014-09-03 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >= 0.4 |
| Dependencies | 1 |
| Unpacked size | 10.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | Jordan Harband |
| Maintainers | ljharb, radubrehar |
| Keywords | has, hasOwnProperty, hasOwn, has-own, own, has, property, in, javascript, ecmascript |

## Links

- npm: https://www.npmjs.com/package/hasown
- Repository: https://github.com/inspect-js/hasOwn
- Homepage: https://github.com/inspect-js/hasOwn#readme
- Issues: https://github.com/inspect-js/hasOwn/issues
- npm.io page: https://npm.io/package/hasown

## Dependencies (1)

- [function-bind](https://npm.io/package/function-bind.md) ^1.1.2

## Alternatives

- [eslint-plugin-sonarjs](https://npm.io/package/eslint-plugin-sonarjs.md) — 2.9M weekly downloads
- [eslint-config-expo](https://npm.io/package/eslint-config-expo.md) — 1.5M weekly downloads
- [@matter/protocol](https://npm.io/package/@matter/protocol.md) — 63.5K weekly downloads
- [@eventcatalog/linter](https://npm.io/package/@eventcatalog/linter.md) — 24.8K weekly downloads
- [@inrupt/eslint-config-base](https://npm.io/package/@inrupt/eslint-config-base.md) — 4.5K weekly downloads

## Recent versions

- 2.0.4 (latest) — 2026-05-28
- 2.0.3 — 2026-04-17
- 2.0.2 — 2024-03-10
- 2.0.1 — 2024-02-11
- 2.0.0 — 2023-10-21
- 1.0.1 — 2014-09-03

## README

# hasown <sup>[![Version Badge][npm-version-svg]][package-url]</sup>

[![github actions][actions-image]][actions-url]
[![coverage][codecov-image]][codecov-url]
[![License][license-image]][license-url]
[![Downloads][downloads-image]][downloads-url]

[![npm badge][npm-badge-png]][package-url]

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

## Example

```js
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`

[package-url]: https://npmjs.org/package/hasown
[npm-version-svg]: https://versionbadg.es/inspect-js/hasown.svg
[deps-svg]: https://david-dm.org/inspect-js/hasOwn.svg
[deps-url]: https://david-dm.org/inspect-js/hasOwn
[dev-deps-svg]: https://david-dm.org/inspect-js/hasOwn/dev-status.svg
[dev-deps-url]: https://david-dm.org/inspect-js/hasOwn#info=devDependencies
[npm-badge-png]: https://nodei.co/npm/hasown.png?downloads=true&stars=true
[license-image]: https://img.shields.io/npm/l/hasown.svg
[license-url]: LICENSE
[downloads-image]: https://img.shields.io/npm/dm/hasown.svg
[downloads-url]: https://npm-stat.com/charts.html?package=hasown
[codecov-image]: https://codecov.io/gh/inspect-js/hasOwn/branch/main/graphs/badge.svg
[codecov-url]: https://app.codecov.io/gh/inspect-js/hasOwn/
[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/inspect-js/hasOwn
[actions-url]: https://github.com/inspect-js/hasOwn/actions

---
_Source: https://npm.io/package/hasown · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
