# @mapstore/patcher

> This lib allows to use jsonpath rules inside a json patch rules

Latest version **0.1.1** (published 2021-08-20) · ISC license · 0 weekly downloads

## Install

```sh
npm install @mapstore/patcher
pnpm add @mapstore/patcher
yarn add @mapstore/patcher
bun add @mapstore/patcher
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.1 |
| Published | 2021-08-20 |
| First published | 2021-08-20 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 76.3 KB |
| Known vulnerabilities | 0 (+7 in 2 direct dependencies) |
| Install scripts | no |
| Author | GeoSolutions S.a.s. |
| Maintainers | offtherailz, mv88, allyoucanmap, mbarto |

## Links

- npm: https://www.npmjs.com/package/@mapstore/patcher
- npm.io page: https://npm.io/package/@mapstore/patcher

## Dependencies (3)

- [jiff](https://npm.io/package/jiff.md) 0.7.3
- [lodash](https://npm.io/package/lodash.md) 4.17.20
- [jsonpath](https://npm.io/package/jsonpath.md) 1.1.0

## Recent versions

- 0.1.1 (latest) — 2021-08-20
- 0.1.0 — 2021-08-20

## README

# Patcher

This lib allows to use jsonpath rules inside a json patch rules

## How to use it


```js
import {mergeConfigsPatch} from '@mapstore/patcher';


const sourceFile = {
  name: "Alfredo",
  isValid: true,
  children: [{
    name: "Luke"
  }]
}
const jsonPathRules = [{
  "op": "remove",
  "jsonpath": "$.name"
}]
const jsonPatchRules = [{
  "op": "remove",
  "path": "/name"
}]

const resultJsonPath = mergeConfigsPatch(sourceFile, jsonPathRules);
const resultJsonPatch = mergeConfigsPatch(sourceFile, jsonPatchRules);

console.log(resultJsonPath === resultJsonPatch)
true

console.log(resultJsonPath)
{
  isValid: true,
  children: [{
    name: "Luke"
  }]
}
```

## references

[jsonpath](https://goessner.net/articles/JsonPath/)

[json-patch](http://jsonpatch.com/)

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