just-extend
extend an object
Last updated 2 years ago by angus-c .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install just-extend 
SYNC missed versions from official npm registry.

just-extend

Part of a library of zero-dependency npm modules that do just do one thing. Guilt-free utilities for every occasion.

🍦 Try it

npm install just-extend
yarn add just-extend

Extend an object

import extend from 'just-extend';

var obj = {a: 3, b: 5};
extend(obj, {a: 4, c: 8}); // {a: 4, b: 5, c: 8}
obj; // {a: 4, b: 5, c: 8}

var obj = {a: 3, b: 5};
extend({}, obj, {a: 4, c: 8}); // {a: 4, b: 5, c: 8}
obj; // {a: 3, b: 5}

var arr = [1, 2, 3];
var obj = {a: 3, b: 5};
extend(obj, {c: arr}); // {a: 3, b: 5, c: [1, 2, 3]}
arr.push(4);
obj; // {a: 3, b: 5, c: [1, 2, 3, 4]}

var arr = [1, 2, 3];
var obj = {a: 3, b: 5};
extend(true, obj, {c: arr}); // {a: 3, b: 5, c: [1, 2, 3]}
arr.push(4);
obj; // {a: 3, b: 5, c: [1, 2, 3]}

extend({a: 4, b: 5}); // {a: 4, b: 5}
extend({a: 4, b: 5}, 3); {a: 4, b: 5}
extend({a: 4, b: 5}, true); {a: 4, b: 5}
extend('hello', {a: 4, b: 5}); // throws
extend(3, {a: 4, b: 5}); // throws

Current Tags

  • 6.2.0                                ...           latest (2 years ago)

38 Versions

  • 6.2.0                                ...           2 years ago
  • 6.1.1                                ...           2 years ago
  • 6.1.0                                ...           2 years ago
  • 6.0.1                                ...           3 years ago
  • 6.0.0                                ...           3 years ago
  • 5.1.1                                ...           3 years ago
  • 5.1.0                                ...           3 years ago
  • 5.0.0                                ...           3 years ago
  • 4.2.1                                ...           4 years ago
  • 4.2.0                                ...           4 years ago
  • 4.1.1                                ...           4 years ago
  • 4.1.0                                ...           5 years ago
  • 4.0.2                                ...           6 years ago
  • 4.0.1                                ...           6 years ago
  • 4.0.0                                ...           6 years ago
  • 3.0.0                                ...           6 years ago
  • 2.1.0                                ...           6 years ago
  • 1.1.27                                ...           7 years ago
  • 1.1.26                                ...           7 years ago
  • 1.1.25                                ...           7 years ago
  • 1.1.24                                ...           7 years ago
  • 1.1.23                                ...           7 years ago
  • 1.1.22                                ...           8 years ago
  • 1.1.21                                ...           8 years ago
  • 1.1.20                                ...           8 years ago
  • 1.1.19                                ...           8 years ago
  • 1.1.18                                ...           8 years ago
  • 1.1.17                                ...           8 years ago
  • 1.1.16                                ...           8 years ago
  • 1.1.15                                ...           8 years ago
  • 1.1.10                                ...           8 years ago
  • 1.1.9                                ...           8 years ago
  • 1.1.8                                ...           8 years ago
  • 1.1.7                                ...           8 years ago
  • 1.1.5                                ...           8 years ago
  • 1.1.1                                ...           8 years ago
  • 1.1.0                                ...           8 years ago
  • 1.0.0                                ...           8 years ago
Maintainers (1)
Downloads
Total 0
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (0)
None
Dev Dependencies (0)
None
Dependents (1)

© 2010 - cnpmjs.org x YWFE | Home | YWFE