Skip to content
This repository has been 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.

Notifications You must be signed in to change notification settings

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

  •  
  •  
  •