Skip to content

igorskyflyer/npm-odin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

11 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ”ฑ Odin ๐Ÿ”บ

๐Ÿ”ฑ Odin is an Object wrapper that allows you to create objects and set their attributes - all at once! ๐Ÿ”บ


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.

About

๐Ÿ”ฑ Odin is an Object wrapper that allows you to create objects and set their attributes - all at once! ๐Ÿ”บ

Topics

Resources

License

Stars

Watchers

Forks