https://github.com/kamicane/object
[Object: null prototype] utilities
https://github.com/kamicane/object
Last synced: 5 months ago
JSON representation
[Object: null prototype] utilities
- Host: GitHub
- URL: https://github.com/kamicane/object
- Owner: kamicane
- Created: 2019-12-30T15:12:31.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-01-01T11:29:49.000Z (over 6 years ago)
- Last Synced: 2025-10-06T11:29:21.771Z (9 months ago)
- Language: JavaScript
- Homepage:
- Size: 28.3 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# object
`[Object: null prototype]` utilities
## require
```js
const object = require('@kamicane/object')
```
## create
```js
object()
object(null)
object({ a: 1, b: 2, c: 3 })
```
## assign
```js
object({ a: 1, b: 2 }, { c: 3 }, { a: 2 })
```
## hasOwn
```js
object.hasOwn({ a: 1 }, 'a')
```
## proper iterators with generator functions
```js
;[...object.keys({ a: 1, b: 2, c: 3 })]
;[...object.values({ a: 1, b: 2, c: 3 })]
;[...object.entries({ a: 1, b: 2, c: 3 })]
```
> While it is easy to imagine that all iterators could be expressed as arrays, this is not true. Arrays must be allocated in their entirety, but iterators are consumed only as necessary and thus can express sequences of unlimited size. - [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Iterators_and_Generators)