Skip to content
This repository was archived by the owner on Nov 15, 2018. It is now read-only.
/ defaults Public archive

Assigns enumerable properties from the default object to destination object for all properties that resolve to undefined.

avetisk/defaults

Repository files navigation

Build Status

defaults

Merge recursively objects into a new one, only if prop's key is not already defined.

Installation

$ yarn add stluafed

API

defaults(...objects)

defaults(
  {
    x: 1,
    z: {
      a: 11
    }
  },
  {
    x: 2,
    y: 2,
    z: {
      a: 'trololol',
      b: 22
    }
  },
  true
);
// > {x: 1, y: 2, z: {a: 11, b: 22}}

License

MIT

About

Assigns enumerable properties from the default object to destination object for all properties that resolve to undefined.

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •