JSPM

soft-extend

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 42
  • Score
    100M100P100Q58881F
  • License unlicensed

Non-destructive extend. Just appends new properties to an object, keeping old ones.

Package Exports

  • soft-extend

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (soft-extend) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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