Socket
Socket
Sign inDemoInstall

rfc6902

Package Overview
Dependencies
Maintainers
1
Versions
43
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rfc6902

Complete implementation of RFC6902 (patch and diff)


Version published
Weekly downloads
97K
increased by3.83%
Maintainers
1
Weekly downloads
 
Created
Source

rfc6902

Complete implementation of RFC6902 (including RFC6901), for creating and consuming application/json-patch+json documents.

No fancy Object.observe, no TypeScript, no missing "diff" function.

Demo

Simple web app using the browser-compiled version of the code.

  • Currently only demos diff(input, output) functionality.

Determinism

If you've ever implemented Levenshtein's algorithm, or played tricks with git stash to get a reasonable sequence of commits, you'll realize that computing diffs is rarely deterministic. (This explains why 2 out of the 94 tests are currently failing.)

Applying json-patch documents is way easier than generating them, which might explain why there are more than five patch-applying RFC6902 implementations in NPM, but only one (yours truly) that attempts to generate patch documents from two distinct objects.

So when comparing your data objects, you'll want to ensure that the patches it generates meet your needs.

Of course, this only applies to generating the patches. Applying them is deterministic and completely specified by RFC6902.

Installation

From npm:

npm install rfc6902

Or github:

git clone https://github.com/chbrown/rfc6902.git
cd rfc6902
npm install -g

Import:

var rfc6902 = require('rfc6902');

License

Copyright © 2014 Christopher Brown. MIT Licensed.

Keywords

FAQs

Package last updated on 23 Jan 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc