merge-defaults

0.2.2 • Public • Published

Note: Lodash now includes a defaultsDeep function.

merge-defaults

Implements a deep version of _.defaults.

Important!

This module DOES NOT merge arrays or dates.

Installation

$ npm install merge-defaults

Usage

 
var _ = require('lodash');
 
// Override basic `_.defaults`
_.defaults = require('merge-defaults');
 
// Or you can add it as a new method
_.mergeDefaults = require('merge-defaults');
 

Why?

This module is a temporary solution, until lodash has something similar in core that can be called as a single method. In the mean time, this is a hack to make our code more readable. i.e. I know what _.defaults means intuitively, but I have to look up _.partialRight every time.

To get the latest status, see the original issue in the lodash repo.

I'll update this repo with install/version info if something comparable is added to lodash core at some point.

License

MIT © Mike McNeil 2014

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.2.2
    23,376
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 0.2.2
    23,376
  • 0.2.1
    3,579
  • 0.1.4
    10,323
  • 0.2.0
    1
  • 0.1.3
    1
  • 0.1.0
    4,683
  • 0.0.0
    0

Package Sidebar

Install

npm i merge-defaults

Weekly Downloads

34,124

Version

0.2.2

License

MIT

Unpacked Size

16.4 kB

Total Files

10

Last publish

Collaborators

  • rachaelshaw
  • balderdashy
  • mikermcneil