Skip to content

Lcfvs/object

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

An utility to create an object and assign at once

npm i @lcf.vs/object

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
/**
 * 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)

MIT

About

An utility to create an object and assign at once

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published