1.0.2 • Published 5 years ago

@lcf.vs/object v1.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
5 years ago

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

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago