@kamicane/object

object utils

Usage no npm install needed!

<script type="module">
  import kamicaneObject from 'https://cdn.skypack.dev/@kamicane/object';
</script>

README

object

[Object: null prototype] utilities

require

const object = require('@kamicane/object')

create

object()
object(null)
object({ a: 1, b: 2, c: 3 })

assign

object({ a: 1, b: 2 }, { c: 3 }, { a: 2 })

hasOwn

object.hasOwn({ a: 1 }, 'a')

proper iterators with generator functions

;[...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