All Projects β†’ RebeccaStevens β†’ deepmerge-ts

RebeccaStevens / deepmerge-ts

Licence: BSD-3-Clause license
Deeply merge 2 or more objects respecting type information.

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to deepmerge-ts

mergedeep
A deep merge function for 🐍.
Stars: ✭ 73 (-28.43%)
Mutual labels:  merge, deepmerge
git-json-merge
A git merge driver that use xdiff to automatically resolve merge conflicts in json files. This project was inspired by git-po-merge.
Stars: ✭ 86 (-15.69%)
Mutual labels:  merge
Aehnlich
Show/Merge differences in directories and their content (text files) in Light/Dark designs
Stars: ✭ 73 (-28.43%)
Mutual labels:  merge
Winmerge
WinMerge is an Open Source differencing and merging tool for Windows. WinMerge can compare both folders and files, presenting differences in a visual text format that is easy to understand and handle.
Stars: ✭ 2,358 (+2211.76%)
Mutual labels:  merge
zip
PHP ZipArchive toolbox
Stars: ✭ 30 (-70.59%)
Mutual labels:  merge
diffy
Tools for finding and manipulating differences between files
Stars: ✭ 47 (-53.92%)
Mutual labels:  merge
winmerge2011
Fork of WinMerge which has a different set of features
Stars: ✭ 36 (-64.71%)
Mutual labels:  merge
cidr-merger
A simple command line tool to merge ip/ip cidr/ip range, supports IPv4/IPv6
Stars: ✭ 99 (-2.94%)
Mutual labels:  merge
webgrabplus-siteinipack
Official user supported WebGrab+Plus Siteini.pack repo
Stars: ✭ 133 (+30.39%)
Mutual labels:  merge
Mergo
Written by Dario CastaΓ±Γ©.
Stars: ✭ 1,808 (+1672.55%)
Mutual labels:  merge
Pdfsam
PDFsam, a desktop application to extract pages, split, merge, mix and rotate PDF files
Stars: ✭ 1,829 (+1693.14%)
Mutual labels:  merge
gitlab-merger-bot
GitLab Merger Bot
Stars: ✭ 23 (-77.45%)
Mutual labels:  merge
php-merge
Php library to merge text. 3 way merge like git in php.
Stars: ✭ 26 (-74.51%)
Mutual labels:  merge
HacktoberFest-HelloWorld
All your PRs will be merged !! 😊
Stars: ✭ 24 (-76.47%)
Mutual labels:  merge
git-picked
List merged and cherry-picked branches
Stars: ✭ 30 (-70.59%)
Mutual labels:  merge
jdime
syntactic merge tool for java
Stars: ✭ 14 (-86.27%)
Mutual labels:  merge
markdown-to-document
A Markdown CLI to easily generate HTML documents from Markdown files
Stars: ✭ 28 (-72.55%)
Mutual labels:  merge
Nbdime
Tools for diffing and merging of Jupyter notebooks.
Stars: ✭ 2,135 (+1993.14%)
Mutual labels:  merge
defaults-deep
Like `extend` but recursively copies only the missing properties/values to the target object.
Stars: ✭ 26 (-74.51%)
Mutual labels:  merge
git-rebase-via-merge
Fix rebase conflicts with minimum pain.
Stars: ✭ 41 (-59.8%)
Mutual labels:  merge

DeepmergeTS

npm version deno version CI Coverage Status
code style: prettier GitHub Discussions BSD 3 Clause license Commitizen friendly semantic-release

Deeply merge 2 or more objects respecting type information.

classic merge animation

Donate

Any donations would be much appreciated. πŸ˜„

Installation

Node

# Install with npm
npm install deepmerge-ts

# Install with pnpm
pnpm add deepmerge-ts

# Install with yarn
yarn add deepmerge-ts

Deno

// import_map.json
{
  "imports": {
    "deepmerge-ts": "https://deno.land/x/deepmergets@__version__/dist/deno/index.ts"
  }
}

Features

  • Smart merging - High performance.
  • Merged output has correct typing.
  • Record merging support.
  • Array merging support.
  • Map and Set merging support.
  • Customized merging.

Usage

Example using default config

import { deepmerge } from "deepmerge-ts";

const x = {
  record: {
    prop1: "value1",
    prop2: "value2",
  },
  array: [1, 2, 3],
  set: new Set([1, 2, 3]),
  map: new Map([
    ["key1", "value1"],
    ["key2", "value2"],
  ]),
};

const y = {
  record: {
    prop1: "changed",
    prop3: "value3",
  },
  array: [2, 3, 4],
  set: new Set([2, 3, 4]),
  map: new Map([
    ["key2", "changed"],
    ["key3", "value3"],
  ]),
};

const merged = deepmerge(x, y);

console.log(merged);

// Prettierfied output:
//
// Object {
//   "record": Object {
//     "prop1": "changed",
//     "prop2": "value2",
//     "prop3": "value3",
//   },
//   "array": Array [1, 2, 3, 2, 3, 4],
//   "set": Set { 1, 2, 3, 4 },
//   "map": Map {
//     "key1" => "value1",
//     "key2" => "changed",
//     "key3" => "value3",
//   },
// }

You can try out this example at codesandbox.io.

Using customized config

See deepmerge custom docs.

Performance

We use smart merging instead of the classic merging strategy which some alternative libraries use. This vastly improves performance, both in execution time and memory usage.

Classic Merge (not what we do)

With classic merging, each input is merged with the next input until all inputs are merged.

This strategy has large performance issues when lots of items need to be merged.

classic merge animation

Smart Merge (what we do)

With our smart merging, we look ahead to see what can be merged and only merge those things.

In addition to performance improvements, this strategy merges multiple inputs at once; allowing for benefits such as taking averages of the inputs.

smart merge animation

API

See API docs.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].