JSPM

extend-object

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 357864
  • Score
    100M100P100Q167194F
  • License MIT

Underscore's extend method as a standalone Common JS module.

Package Exports

  • extend-object

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 (extend-object) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

extend-object

underscore's extend method adapted and extracted as a standalone CommonJS module.

Note this does not shim Array.prototype.forEach so if you're in <IE8 you'll need to polyfill it. But basically any other browser will work.

usage

var extend = require('extend-object');

var obj = {hi: 'there'};

extend(obj, {hello: 'you'});

console.log(obj); // {hi: 'there', hello: 'you'}

// it extends the first object in place
console.log(obj === extend(obj, {})); // 'true'

// you can pass as many objects as you want
extend(obj, {something: 'else'}, {other: 'item'});

// if there are conflicting keys the last one wins
extend(obj, {something: 'ok'}, {something: 'newer'});
console.log(obj.something); // 'newer'

install

npm install extend-object

credits

All credit goes to Jeremy Ashkenas and the other underscore.js authors.

license

MIT as per underscore.