9.0.0 • Published 6 months ago

rfc6902-ordered v9.0.0

Weekly downloads
11,176
License
MIT
Repository
github
Last release
6 months ago

rfc6902-ordered

npm version

https://github.com/chbrown/rfc6902 plus object key ordering

Motivated by https://github.com/chbrown/rfc6902/issues/22

The same as https://github.com/chbrown/rfc6902, except applyPatch can take an optional third parameter. It can use the output param of createPatch to preserve object key order on the object you're patching.

const rfc6902 = require('rfc6902-ordered');

let source = {
  key1: 1,
  key2: 2
};

let theirs = {
  key1: 1,
  key3: 3,
  key2: 2
};

let patch = rfc6902.createPatch(source, theirs);

// patch => [
//   { op: 'add', path: '/key3', value: 3 }
// ]

let ours = {
  key1: 1,
  key2: 2,
  key4: 4
};

rfc6902.applyPatch(ours, patch, source, theirs);

// ours => {
//   key1: 1,
//   key3: 3,
//   key2: 2,
//   key4: 4
// }
9.0.0

6 months ago

8.0.0

10 months ago

7.0.0

1 year ago

6.0.0

2 years ago

5.0.0

3 years ago

4.0.5

4 years ago

4.0.4

4 years ago

4.0.3

4 years ago

4.0.2

4 years ago

4.0.1

4 years ago

4.0.0

5 years ago

3.1.1

5 years ago

3.1.0

6 years ago

3.0.0

6 years ago

2.1.1

6 years ago

2.1.0

7 years ago

2.0.0

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago

0.1.0

7 years ago

0.0.0

7 years ago