Skip to content

Commit

Permalink
chore(release): 1.1.8-beta.1 [skip ci]
Browse files Browse the repository at this point in the history
## [1.1.8-beta.1](v1.1.7...v1.1.8-beta.1) (2021-11-22)

### Bug Fixes

* add better support for readonly types ([#17](#17)) ([0609832](0609832))
  • Loading branch information
semantic-release-bot committed Nov 22, 2021
1 parent 5493da5 commit 503bb37
Show file tree
Hide file tree
Showing 16 changed files with 2,234 additions and 0 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
# Changelog
All notable changes to this project will be documented in this file. Dates are displayed in UTC.

## [1.1.8-beta.1](https://github.com/RebeccaStevens/deepmerge-ts/compare/v1.1.7...v1.1.8-beta.1) (2021-11-22)


### Bug Fixes

* add better support for readonly types ([#17](https://github.com/RebeccaStevens/deepmerge-ts/issues/17)) ([0609832](https://github.com/RebeccaStevens/deepmerge-ts/commit/0609832ed999673046ffc0b49a86382e4df7bf9a))

## [1.1.7](https://github.com/RebeccaStevens/deepmerge-ts/compare/v1.1.6...v1.1.7) (2021-11-22)


Expand Down
29 changes: 29 additions & 0 deletions dist/deno/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
BSD 3-Clause License

Copyright (c) 2021, Rebecca Stevens
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
134 changes: 134 additions & 0 deletions dist/deno/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
<div align="center">

# DeepmergeTS

[![npm version](https://img.shields.io/npm/v/deepmerge-ts.svg)](https://www.npmjs.com/package/deepmerge-ts)
[![deno version](https://img.shields.io/github/v/tag/RebeccaStevens/deepmerge-ts?label=deno)](https://deno.land/x/deepmergets)
[![CI](https://github.com/RebeccaStevens/deepmerge-ts/actions/workflows/ci.yml/badge.svg)](https://github.com/RebeccaStevens/deepmerge-ts/actions/workflows/ci.yml)
[![Coverage Status](https://codecov.io/gh/RebeccaStevens/deepmerge-ts/branch/main/graph/badge.svg?token=MVpR1oAbIT)](https://codecov.io/gh/RebeccaStevens/deepmerge-ts)\
[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)
[![GitHub Discussions](https://img.shields.io/github/discussions/RebeccaStevens/deepmerge-ts?style=flat-square)](https://github.com/RebeccaStevens/deepmerge-ts/discussions)
[![BSD 3 Clause license](https://img.shields.io/github/license/RebeccaStevens/deepmerge-ts.svg?style=flat-square)](https://opensource.org/licenses/BSD-3-Clause)
[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg?style=flat-square)](https://commitizen.github.io/cz-cli/)
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=flat-square)](https://github.com/semantic-release/semantic-release)

Deeply merge 2 or more objects respecting type information.

![classic merge animation](./assets/header.png)

</div>

## Installation

### Node

```sh
# Install with npm
npm install deepmerge-ts --save-dev

# Install with yarn
yarn add -D deepmerge-ts
```

### Deno

```jsonc
// 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

```js
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:
//
// {
// record: {
// prop1: "changed",
// prop2: "value2",
// prop3: "value3"
// }
// array: (6) [1, 2, 3, 2, 3, 4]
// set: Set(4) {1, 2, 3, 4}
// map: Map(3) {
// "key1" => "value1",
// "key2" => "changed",
// "key3" => "value3"
// }
// }
```

### Using customized config

[See deepmerge custom docs](./docs/deepmergeCustom.md).

## 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](./assets/classic-merge.gif)

### 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](./assets/smart-merge.gif)

## API

[See API docs](./docs/API.md).
Loading

0 comments on commit 503bb37

Please sign in to comment.