Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

rfc6902-ordered

Package Overview
Dependencies
Maintainers
1
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rfc6902-ordered

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

  • 3.1.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
5.9K
decreased by-23.16%
Maintainers
1
Weekly downloads
 
Created
Source

rfc6902-ordered

Greenkeeper badge npm version Build Status

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
// }

Keywords

FAQs

Package last updated on 28 Sep 2018

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