Skip to content
forked from component/clone

recursively copy the properties of an object to another

Notifications You must be signed in to change notification settings

publicclass/copy

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

copy

Build Status

Recursively copies the properties of an object to another.

The difference between this and clone is that this one will copy any changes from one object to another without creating a new object. And thus is useful in memory-sensitive cases.

Example

var obj = {
  a: 'b',
  c: [
    new Date(),
    'tobi',
    'jane'
  ]
}
var other = {
  a: 'a'
}
copy(obj,other)

// other = {a: 'b', c: [...]}

API

copy(obj,to)

Copies all properties from obj recursively into to.

License

MIT

About

recursively copy the properties of an object to another

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%