JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 7328
  • Score
    100M100P100Q136473F
  • License MIT

Merge plain objects with customised rules.

Package Exports

  • @dozerg/merge-options
  • @dozerg/merge-options/dist/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@dozerg/merge-options) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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