soft-extend

1.0.0 • Public • Published

Soft-extend

Extend any object softly, i. e. do not replace existing properties, just append the new ones.

var sextend = require('soft-extend');
 
var defaults = {
    intensity: 100,
    hold: true,
    coords: {
        x: 0,
        y: 0
    },
    data: [1, 2, 3]
}
 
//the very common use-case
function MyClass(options){
    this.options = sextend(options || {}, defaults);
}

NPM

Package Sidebar

Install

npm i soft-extend

Weekly Downloads

1

Version

1.0.0

License

unlicensed

Unpacked Size

1.87 kB

Total Files

3

Last publish

Collaborators

  • dfcreative
  • dy