Socket
Socket
Sign inDemoInstall

merge-args

Package Overview
Dependencies
1
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    merge-args

Merge args over defaults with type checking


Version published
Weekly downloads
35
increased by84.21%
Maintainers
1
Install size
1.36 MB
Created
Weekly downloads
 

Readme

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

Last updated on 15 Dec 2023

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc