0.1.1 • Published 7 years ago

typed-assign v0.1.1

Weekly downloads
2
License
MIT
Repository
github
Last release
7 years ago

typed-assign

Build Status tested with jest styled with prettier All Contributors

Object.assingn, Overwrite when TYPE mismatch

Install

$ npm install typed-assign

Usage

const typedAssign = require('typed-assign');

typedAssign({ foo: 1 }, { bar: 1 })
//=> { foo:1 ,bar: 1 }

typedAssign({ foo: 'hello' }, { foo: 1 })
// => { foo: 1 }

typedAssign({ foo: [] }, { foo: {} })
// => { foo: {} }

typedAssign({ foo: 0 }, { bar: 'hello' }, { bar: 2 })
// => { foo: 0, bar: 1 }

API

typedAssign(target: Object, ...sources: Object[])

Assigns enumerable own properties of source objects to the target object and returns the target object. Additional source objects will overwrite previous ones.

Contributors

Thanks goes to these wonderful people (emoji key):

akameco💻 📖 ⚠️ 🚇

This project follows the all-contributors specification. Contributions of any kind welcome!

License

MIT © akameco