1.0.1 • Published 7 years ago

stluafed v1.0.1

Weekly downloads
12
License
MIT
Repository
github
Last release
7 years ago

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

1.0.1

7 years ago

2.0.0

7 years ago

1.0.0

9 years ago

0.0.4

11 years ago

0.0.3

11 years ago

0.0.2

11 years ago

0.0.1

11 years ago