@lcf.vs/object

1.0.2 • Public • Published

object

An utility to create an object and assign at once

Install

npm i @lcf.vs/object

Usage

import object from '@lcf.vs/object'

const empty = object()
const prototyped = object({prototyped: true})
const assigned = object(null, {assigned: true})
const together = object(prototyped, assigned, {together: true})

console.log(empty) // {}
console.log(prototyped.prototyped) // true
console.log(assigned.assigned) // true
console.log(together.prototyped && together.assigned && together.together) // true

API

/**
 * Clones the prototype and assigns the extensions on it
 * @param {object|null} [prototype=null]
 * @param {...object} extensions
 * @return {object&(prototype|null)}
 */
import object from '@lcf.vs/object'

const obj = object(prototype || null, ...extensions)

License

MIT

Package Sidebar

Install

npm i @lcf.vs/object

Weekly Downloads

0

Version

1.0.2

License

MIT

Unpacked Size

3 kB

Total Files

4

Last publish

Collaborators

  • lcf.vs