Object.assign, Overwrite when TYPE mismatch
$ npm install typed-assign
const typedAssign = require('typed-assign');
typedAssign({ foo: 1 }, { bar: 1 })
//=> { foo:1, bar: 1 }
typedAssign({ foo: 'hello' }, { foo: 1 })
// => { foo: 1 }
typedAssign({ foo: 1 }, { foo: 100 })
// => { foo: 1 }
typedAssign({ foo: [] }, { foo: {} })
// => { foo: {} }
typedAssign({ foo: 0 }, { bar: 'hello' }, { bar: 2 })
// => { foo: 0, bar: 1 }
Assigns enumerable own properties of source
objects to the target
object and returns the target
object. Additional source
objects will overwrite previous ones.
Thanks goes to these wonderful people (emoji key):
akameco 💻 📖 |
HANATANI Takuma 📖 |
---|
This project follows the all-contributors specification. Contributions of any kind welcome!
MIT © akameco