Skip to content

fix: README badges & npm prepack #386

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,8 @@ lib

npm-debug.log
.idea/

packages/jsondiffpatch/README.md
packages/jsondiffpatch/MIT-LICENSE.txt

*.local.*
36 changes: 21 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,34 @@
# jsondiffpatch
<p align="center">
<h1 align="center">jsondiffpatch</h1>
<p align="center">
<a href="https://jsondiffpatch.com">jsondiffpatch.com</a>
<br/>
Diff & patch JavaScript objects
</p>
</p>

<!--- badges -->

[![Build Status](https://secure.travis-ci.org/benjamine/jsondiffpatch.svg)](http://travis-ci.org/benjamine/jsondiffpatch)
[![Code Climate](https://codeclimate.com/github/benjamine/jsondiffpatch/badges/gpa.svg)](https://codeclimate.com/github/benjamine/jsondiffpatch)
[![Test Coverage](https://codeclimate.com/github/benjamine/jsondiffpatch/badges/coverage.svg)](https://codeclimate.com/github/benjamine/jsondiffpatch)
[![NPM version](https://badge.fury.io/js/jsondiffpatch.svg)](http://badge.fury.io/js/jsondiffpatch)
[![NPM dependencies](https://david-dm.org/benjamine/jsondiffpatch.svg)](https://david-dm.org/benjamine/jsondiffpatch)

Diff & patch JavaScript objects
<p align="center">
<a href="https://github.com/benjamine/jsondiffpatch/actions?query=branch%3Amaster"><img src="https://github.com/benjamine/jsondiffpatch/actions/workflows/CI.yml/badge.svg?event=push&branch=master" alt="JsonDiffPatch CI status" /></a>
<a href="https://twitter.com/beneidel" rel="nofollow"><img src="https://img.shields.io/badge/created%[email protected]" alt="Created by Benjamin Eidelman"></a>
<a href="https://opensource.org/licenses/MIT" rel="nofollow"><img src="https://img.shields.io/github/license/benjamine/jsondiffpatch" alt="License"></a>
<a href="https://www.npmjs.com/package/jsondiffpatch" rel="nofollow"><img src="https://img.shields.io/npm/dw/jsondiffpatch.svg" alt="npm"></a>
<a href="https://github.com/benjamine/jsondiffpatch" rel="nofollow"><img src="https://img.shields.io/github/stars/benjamine/jsondiffpatch" alt="stars"></a>
</p>

---

## **[Live Demo](http://benjamine.github.io/jsondiffpatch/index.html)**
## **[Live Demo](https://jsondiffpatch.com)**

- min+gzipped ~ 16KB
- browser and server (ESM-only)
- deep diff, use delta to patch
- (optionally) uses [google-diff-match-patch](http://code.google.com/p/google-diff-match-patch/) for long text diffs (diff at character level)
- smart array diffing using [LCS](http://en.wikipedia.org/wiki/Longest_common_subsequence_problem), **_IMPORTANT NOTE:_** to match objects inside an array you must provide an `objectHash` function (this is how objects are matched, otherwise a dumb match by position is used). For more details, check [Array diff documentation](docs/arrays.md)
- reverse a delta
- unpatch (eg. revert object to its original state using a delta)
- reverse a delta, unpatch (eg. revert object to its original state using a delta)
- simplistic, pure JSON, low footprint [delta format](docs/deltas.md)
- multiple output formatters:
- html (check it at the [Live Demo](http://benjamine.github.io/jsondiffpatch/index.html))
- html (check it at the [Live Demo](https://jsondiffpatch.com))
- annotated json (html), makes the JSON delta format self-explained
- console (colored), try running `./node_modules/.bin/jsondiffpatch left.json right.json`
- JSON Patch format RFC 6902 support
Expand All @@ -31,7 +37,7 @@ Diff & patch JavaScript objects

## Supported platforms

- Any browser that supports ES6
- Any browser that [supports ES6](https://caniuse.com/es6)
- Node.js 18, 20+

## Usage
Expand Down Expand Up @@ -270,7 +276,7 @@ const jsondiffpatchInstance = jsondiffpatch.create({
</html>
```

To see formatters in action check the [Live Demo](http://benjamine.github.io/jsondiffpatch/index.html).
To see formatters in action check the [Live Demo](https://jsondiffpatch.com).

For more details check [Formatters documentation](docs/formatters.md)

Expand Down
2 changes: 1 addition & 1 deletion docs/arrays.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,4 @@ For more details check [delta format documentation](deltas.md)

#### Html

On html you will see moves as fancy curved arrows (check [Live Demo](http://benjamine.github.com/jsondiffpatch/demo/index.html) ), these are implemented using SVG elements and an embedded script tag, they will only show up [if your browser supports SVG](http://caniuse.com/svg)
On html you will see moves as fancy curved arrows (check [Live Demo](https://jsondiffpatch.com) ), these are implemented using SVG elements and an embedded script tag, they will only show up [if your browser supports SVG](http://caniuse.com/svg)
2 changes: 1 addition & 1 deletion docs/deltas.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ This format was created with a balance between readability and low footprint in
- to represent changed parts, arrays and magic numbers are used to keep a low footprint (i.e. you won't see verbosity like `"type": "added"`)
- keep it pure JSON serializable

A great way to understand this format is using the "Annotated JSON" option in the [Live Demo](http://benjamine.github.io/jsondiffpatch/index.html), and try the different left/right examples, or edit left/right JSON to see the annotated delta update as your type.
A great way to understand this format is using the "Annotated JSON" option in the [Live Demo](https://jsondiffpatch.com)), and try the different left/right examples, or edit left/right JSON to see the annotated delta update as your type.

Here's a complete reference of this format.

Expand Down
2 changes: 1 addition & 1 deletion docs/formatters.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Formatters

Some formatters are included that let you convert a JSON delta into other formats, you can see some of these used in the [Live Demo](https://benjamine.github.io/jsondiffpatch/index.html)
Some formatters are included that let you convert a JSON delta into other formats, you can see some of these used in the [Live Demo](https://jsondiffpatch.com))

## Html

Expand Down
4 changes: 2 additions & 2 deletions packages/jsondiffpatch/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jsondiffpatch",
"version": "0.6.0",
"version": "0.6.1",
"author": "Benjamin Eidelman <[email protected]>",
"description": "Diff & Patch for Javascript objects",
"contributors": [
Expand Down Expand Up @@ -30,7 +30,7 @@
"type-check": "tsc --noEmit",
"lint": "eslint . --ext .ts",
"test": "jest --coverage",
"prepack": "npm run build",
"prepack": "npm run build && cp ../../MIT-LICENSE.txt . && cp ../../README.md .",
"prepublishOnly": "npm run test && npm run lint"
},
"repository": {
Expand Down