NPM Smell 🍑💨

trivial and outdated NPM packages

extend-shallow outdated npm logo

Reimplements the native Object.assign() method.

Weekly Downloads
55,875,319
Dependencies
4
Latest Release
7 years ago
This dependency re-creates a native JavaScript API. It is recommended to use the native API instead
Outdated
natively supported
since 9 years (chrome, firefox, safari, nodejs)

Dependency Tree

extend-shallow
  assign-symbols
  is-extendable
    is-plain-object
      isobject

About

This dependency reimplements the Object.assign method which is used to shallowly copy properties from one or more source objects to a target object.

It also needs 4 dependencies to do what Object.assign can do natively.

// merge 2 objects
const obj1 = {
    foo: "bar"
};

const obj2 = {
    baz: "qux"
};

const merged = Object.assign({}, obj1, obj2);

console.log(merged); // { foo: "bar", baz: "qux" }

or you can use the spread operator for a more concise syntax:

// merge 2 objects
const obj1 = {
    foo: "bar"
};

const obj2 = {
    baz: "qux"
};

const merged = {
    ...obj1,
    ...obj2
};

console.log(merged); // { foo: "bar", baz: "qux" }

The spread operator is supported by all modern browsers and Node.js versions since about 9 years.