🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

@dozerg/merge-options

Package Overview
Dependencies
Maintainers
0
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dozerg/merge-options

Merge plain objects with customised rules.

1.0.11
latest
Source
npm
Version published
Weekly downloads
1.1K
-6.09%
Maintainers
0
Weekly downloads
 
Created
Source

Merge Options

npm Downloads Build Status

Merge plain objects with customised rules.

Install

npm i @dozerg/merge-options

Usage

import { mergeOptions, Merger, concatArray } from '@dozerg/merge-options';

interface T {
  foo: number;
  bar?: string[];
}

const obj_1 = mergeOptions(undefined, {foo: 3, bar: ['abc']}, {foo: 4, bar: ['def']});
// obj_1 = {foo: 4, bar: ['def']}

const merger: Merger<T> = {
  bar: concatArray();
}

const obj_2 = mergeOptions(merger, {foo: 3, bar: ['abc']}, {foo: 4, bar: ['def']});
// obj_2 = {foo: 4, bar: ['abc', 'def']}

APIs

License

MIT © Zhao DAI daidodo@gmail.com

Keywords

merge

FAQs

Package last updated on 21 Dec 2024

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