Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

merge-args

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

merge-args

Merge args over defaults with type checking

  • 0.2.13
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
26
decreased by-29.73%
Maintainers
1
Weekly downloads
 
Created
Source

merge-args

Simple extended merge function that merges an args object over a target object with defaults specified and performs type checking.

Creating a new merge function with default options

const MergeArgs = require('merge-args')

var mergeArgs = MergeArgs()

var defaults = {
    foo: 'bar'
}

mergeArgs(defaults, {foo: 'bam'})

// defaults: {foo: bam}

Merge options

var mergeArgs = MergeArgs({
    concatArrays: false,
    emptyStringUndefined: false,
})

Default merge options can be overridden by passing options when creating a new merge function.

All options have a default of true but can be set to false.

concatArrays

When merging arrays concatenate. When set to false arrays will be replaced.

emptyStringUndefined

Convert empty strings to undefined after merge complete.

FAQs

Package last updated on 10 Sep 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc