# immutable-merge-patch

> An implementation of RFC 7396 for Immutable Maps

Latest version **1.0.1** (published 2017-08-24) · MIT license · 0 weekly downloads

## Install

```sh
npm install immutable-merge-patch
pnpm add immutable-merge-patch
yarn add immutable-merge-patch
bun add immutable-merge-patch
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2017-08-24 |
| First published | 2017-08-24 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Dan Mercer |
| Maintainers | drmercer |
| Keywords | immutable, merge, patch, json |

## Links

- npm: https://www.npmjs.com/package/immutable-merge-patch
- Repository: https://drmercer@github.com/drmercer/immutable-merge-patch
- Homepage: https://github.com/drmercer/immutable-merge-patch#readme
- Issues: https://github.com/drmercer/immutable-merge-patch/issues
- npm.io page: https://npm.io/package/immutable-merge-patch

## Dependencies (2)

- [immutable](https://npm.io/package/immutable.md) ^3.8.1
- [deep-equal](https://npm.io/package/deep-equal.md) ^1.0.1

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 1.0.1 (latest) — 2017-08-24
- 1.0.0 — 2017-08-24

## README

# immutable-merge-patch
An implementation of [RFC 7396 (JSON Merge Patch)](https://tools.ietf.org/html/rfc7396)
for [Immutable.js](https://facebook.github.io/immutable-js/) `Map`s.

Thoroughly tested with full code coverage using Mocha and Istanbul.

# Installation
```sh
npm install --save immutable-merge-patch
```

# Usage
```javascript
var Immutable = require("immutable");
var immutableMergePatch = require("immutable-merge-patch");

var a = Map({
	a: 1,
	b: 2,
	c: 3
});
var b = Map({
	a: 1,
	b: 5,
	c: "some string"
});

var diff = immutableMergePatch.generate(a, b);
// diff = Map { b: 5, c: "some string" }
var c = immutableMergePatch.apply(a, diff);
// c.equals(a) === true
```

# Limitations / features not specified in RFC 7396
- Non-string keys are currently totally ignored. (Have a reason for this to
	change? [Open an issue](https://github.com/drmercer/immutable-merge-patch/issues/new)
	and I'll consider it.)
- The generate function only recurses into `Immutable.Map` objects, not plain
  JavaScript objects.
- If the `Map`s passed into `generate()` are `OrderedMap`s, an `OrderedMap` is
	returned, with the keys inheriting their order from the first parameter where possible.

# License
`immutable-merge-patch` is licensed under the MIT License.

### P.S. It's also [![forthebadge](http://forthebadge.com/images/badges/gluten-free.svg)](http://forthebadge.com). ;)

---
_Source: https://npm.io/package/immutable-merge-patch · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
