Skip to content

Extend objects, like jquery extend, only no mutation, returns fresh object and doesnt modify object parameters.

Notifications You must be signed in to change notification settings

yornaath/extend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

extend

Merge properties from two objects into one new object.

Installation

$ component install gorillatron/extend

API

extend( deep, objects... )

Like jquery extend, but doesnt mutate passed objects, only returns a fresh object with the extended properties.

var defaults = {
  hide: false,
  delay: 1500,
  css: {
    color: 'blue'
  }
}

var settings = extend(true, defaults,{
  delay: 1700,
  css: {
    border: '1px solid red'
  }
})

expect(settings).to.eql({
  hide: false,
  delay: 1700,
  css: {
    color: 'blue',
    border: '1px solid red'
  }
})

License

MIT

About

Extend objects, like jquery extend, only no mutation, returns fresh object and doesnt modify object parameters.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published