d2l-json-patch-gen
Advanced tools
Comparing version 0.0.1-security to 1.1.0
{ | ||
"name": "d2l-json-patch-gen", | ||
"version": "0.0.1-security", | ||
"description": "security holding package", | ||
"repository": "npm/security-holder" | ||
"version": "1.1.0", | ||
"description": "JavaScript library that generates JSON patches (RFC 6902)", | ||
"homepage": "https://github.com/Brightspace/d2l-json-patch-gen", | ||
"bugs": "https://github.com/Brightspace/d2l-json-patch-gen/issues", | ||
"main": "./lib/diff.js", | ||
"scripts": { | ||
"test": "mocha" | ||
}, | ||
"keywords": [ | ||
"json-patch", | ||
"diff", | ||
"rfc 6902", | ||
"generate" | ||
], | ||
"author": "Greg Sexton", | ||
"license": "Apache 2.0", | ||
"peerDependencies": { | ||
"lodash": "^4.17.11" | ||
}, | ||
"devDependencies": { | ||
"chai": "^1.10.0", | ||
"jsonpatch": "^1.0.1", | ||
"jsverify": "^0.4.5", | ||
"mocha": "^2.0.1", | ||
"underscore": "^1.7.0" | ||
} | ||
} |
@@ -1,9 +0,86 @@ | ||
# Security holding package | ||
## Introduction | ||
This package name is not currently in use, but was formerly occupied | ||
by another package. To avoid malicious use, npm is hanging on to the | ||
package name, but loosely, and we'll probably give it to you if you | ||
want it. | ||
d2l-json-patch-gen is a small, [thoroughly tested] [tests] library for | ||
generating a [JSON Patch] [rfc6902] from two JavaScript | ||
objects or arrays. | ||
You may adopt this package by contacting support@npmjs.com and | ||
requesting the name. | ||
This library has no dependencies. It supports generating patches of | ||
arbitrarily nested objects and arrays to any depth. | ||
d2l-json-patch-gen does not apply patches. There are several libraries | ||
that can perform this for you: | ||
* [jsonpatch](https://www.npmjs.org/package/jsonpatch) | ||
* [jsonpatch-js](https://github.com/bruth/jsonpatch-js) | ||
* [fast-json-patch](https://github.com/Starcounter-Jack/Fast-JSON-Patch) | ||
* [rfc6902][rfcproj] | ||
If you wish to modify an object and then generate a patch from the | ||
modifications just performed, [this library] [starcounter] may work | ||
better for you. It uses an observer to achieve this. Json-patch-gen | ||
takes a different approach: it recursively compares the two values | ||
given. | ||
It appears that [rfc6902][rfcproj] can also generate patches. I missed | ||
this while researching a solution to this problem. I've not compared | ||
the projects. There is room for different approaches to generating | ||
patches so I suggest trying both libraries to see which works better | ||
for you. | ||
[tests]: https://github.com/gregsexton/d2l-json-patch-gen/blob/master/test/diff.js | ||
[rfc6902]: https://tools.ietf.org/html/rfc6902 | ||
[starcounter]: https://github.com/Starcounter-Jack/Fast-JSON-Patch | ||
[rfcproj]: https://www.npmjs.org/package/rfc6902 | ||
## Installation | ||
npm install d2l-json-patch-gen --save | ||
or | ||
bower install d2l-json-patch-gen | ||
Once installed, the module exports a single function that takes two | ||
values to diff. | ||
var diff = require('d2l-json-patch-gen'); | ||
You can also use this library in the browser by loading with a script | ||
tag. A single 'diff' function will be exported to the global scope. | ||
## Examples | ||
Here is a simple example repl session: | ||
> var diff = require('d2l-json-patch-gen'); | ||
undefined | ||
> diff({},{}); | ||
[] | ||
> diff([],[1]) | ||
[ { op: 'add', path: '/0', value: 1 } ] | ||
> diff({foo: 'bar'}, {foo: 'baz'}) | ||
[ { op: 'replace', path: '/foo', value: 'baz' } ] | ||
> diff({foo: 'bar'}, {}) | ||
[ { op: 'remove', path: '/foo' } ] | ||
> diff({}, {foo: 'bar'}) | ||
[ { op: 'add', path: '/foo', value: 'bar' } ] | ||
> diff({foo: {bar: 'baz'}}, {foo: {bar: 'quux'}}) | ||
[ { op: 'replace', path: '/foo/bar', value: 'quux' } ] | ||
> diff([1,2,3], [2,3,4]) | ||
[ { op: 'add', path: '/3', value: 4 }, | ||
{ op: 'remove', path: '/0' } ] | ||
> diff([{foo: 'bar'},3], [{foo: 'baz'},3,4]) | ||
[ { op: 'add', path: '/2', value: 4 }, | ||
{ op: 'replace', path: '/0/foo', value: 'baz' } ] | ||
> diff({foo: {bar: [1,2,3]}}, {foo: {bar: [2,3,4]}}) | ||
[ { op: 'add', path: '/foo/bar/3', value: 4 }, | ||
{ op: 'remove', path: '/foo/bar/0' } ] |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Known malware
Supply chain riskThis package is malware. We have asked the package registry to remove it.
Found 1 instance in 1 package
Empty package
Supply chain riskPackage does not contain any code. It may be removed, is name squatting, or the result of a faulty package publish.
Found 1 instance in 1 package
No contributors or author data
MaintenancePackage does not specify a list of contributors or an author in package.json.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No License Found
License(Experimental) License information could not be found.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
31105
6
0
375
2
0
87
0
1
5
2