stluafed

1.0.1 • Public • Published

Build Status

defaults

Assigns enumerable properties of the default object(s) to the destination object for all destination properties that resolve to undefined.

Installation

npm:

$ npm install stluafed

or component:

$ component install avetisk/defaults

API

simple: defaults(obj1, obj2)

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

recursive: defaults(obj1, obj2, true)

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

License

MIT

Readme

Keywords

Package Sidebar

Install

npm i stluafed

Weekly Downloads

1

Version

1.0.1

License

MIT

Last publish

Collaborators

  • avetisk
  • joliscri.pt