Skip to content
This repository was archived by the owner on Oct 18, 2024. It is now read-only.
/ json-patch-stream Public archive

JSON-patch utilities for transforming a stream of JSON documents into a stream of JSON patches and vice versa

License

Notifications You must be signed in to change notification settings

allain/json-patch-stream

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

json-patch-stream

JSON-patch utilities for transforming a stream of JSON documents into a stream of JSON patches and vice versa

build status

Installation

This module is installed via npm:

$ npm install json-patch-stream

Example Usage

var streamify = require('stream-array'),
var stdout = require('stdout');

var jsonPatchStream = require('json-patch-stream');

streamify([{"a": 10}, {"a": 20}])
  .pipe(jsonPatchStream.toPatches())
  .pipe(stdout());

// Ouputs these two json patches
// [ { op: 'add', path: '/a', value: 10 } ]
// [ { op: 'test', path: '/a', value: 10 }, {} op: 'replace', path: '/a', value: 20 } ]

streamify([
  [ { op: 'add', path: '/a', value: 10 } ],
  [ { op: 'test', path: '/a', value: 10 }, {} op: 'replace', path: '/a', value: 20 } ]
])
.pipe(jsonPatchStream.toDocs())
.pipe(stdout());

// Outputs these two docs
// {"a": 10}
// {"a": 20}

About

JSON-patch utilities for transforming a stream of JSON documents into a stream of JSON patches and vice versa

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published