Skip to content
This repository has been archived by the owner on Jan 25, 2022. It is now read-only.

Commit

Permalink
Add some details to "why has" to address #3
Browse files Browse the repository at this point in the history
  • Loading branch information
jamiebuilds authored Apr 6, 2021
1 parent 79787e6 commit 94846ab
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,19 @@ A polyfill of `Object.has()` is available in [polyfill.js](./polyfill.js).

### Why the name `has`?

`has` is a popular name for this function in user-land library code ([See Related](#related)).
`has` is a popular name for this function in user-land library code ([See Related](#related)). It also has clear parallels to the use of methods named `entries()`:

```js
Object.entries(o) // "own" properties
Map.prototype.entries()
Set.prototype.entries()
FormData.prototype.entries()

Object.has(o, p) // "own" properties
Map.prototype.has(p)
Set.prototype.has(p)
FormData.prototype.has(p)
```

Alternative Options: `hasOwn`

Expand Down

0 comments on commit 94846ab

Please sign in to comment.