🔱 Odin 🔺
🎡
Usage Install it by executing
npm i "@igor.dvlpr/odin"
then, import it into your project, i.e.:
const { odin } = require('@igor.dvlpr/odin')
const cloned = odin({ a: 1, b: 2 }, { c: 3 }) // returns { a: 1, b: 2, c: 3 }
📚
API odin(target: object, source: object): object
Assigns all properties of the source object to the target object.
target: object
- the target object to copy properties to,
source: object
- the source object to copy properties from.
Returns the target object.
If the target object is not provided and empty object is returned.
If the source object is not provided the target object is returned unchanged.
NOTE: this function uses the method of shallow copying of the source object, for deep/true copied objects consider using clone.js.
For more info, see, shallow copy vs deep copy.