08-27-周三_17-09-29
This commit is contained in:
21
node_modules/jsonpointer/LICENSE.md
generated
vendored
Normal file
21
node_modules/jsonpointer/LICENSE.md
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2011-2015 Jan Lehnardt <jan@apache.org> & Marc Bachmann <https://github.com/marcbachmann>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
45
node_modules/jsonpointer/README.md
generated
vendored
Normal file
45
node_modules/jsonpointer/README.md
generated
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
# JSON Pointer for Node.js
|
||||
|
||||
This is an implementation of [JSON Pointer](https://tools.ietf.org/html/rfc6901).
|
||||
|
||||
## CLI
|
||||
|
||||
Looking to filter JSON from the command line? Check out [jsonpointer-cli](https://github.com/joeyespo/jsonpointer-cli).
|
||||
|
||||
## Usage
|
||||
```javascript
|
||||
var jsonpointer = require('jsonpointer');
|
||||
var obj = { foo: 1, bar: { baz: 2}, qux: [3, 4, 5]};
|
||||
|
||||
jsonpointer.get(obj, '/foo'); // returns 1
|
||||
jsonpointer.get(obj, '/bar/baz'); // returns 2
|
||||
jsonpointer.get(obj, '/qux/0'); // returns 3
|
||||
jsonpointer.get(obj, '/qux/1'); // returns 4
|
||||
jsonpointer.get(obj, '/qux/2'); // returns 5
|
||||
jsonpointer.get(obj, '/quo'); // returns undefined
|
||||
|
||||
jsonpointer.set(obj, '/foo', 6); // sets obj.foo = 6;
|
||||
jsonpointer.set(obj, '/qux/-', 6) // sets obj.qux = [3, 4, 5, 6]
|
||||
|
||||
var pointer = jsonpointer.compile('/foo')
|
||||
pointer.get(obj) // returns 1
|
||||
pointer.set(obj, 1) // sets obj.foo = 1
|
||||
```
|
||||
|
||||
## Testing
|
||||
|
||||
$ npm test
|
||||
All tests pass.
|
||||
$
|
||||
|
||||
[](https://github.com/janl/node-jsonpointer/actions/workflows/node.js.yml)
|
||||
|
||||
## Author
|
||||
|
||||
(c) 2011-2021 Jan Lehnardt <jan@apache.org> & Marc Bachmann <https://github.com/marcbachmann>
|
||||
|
||||
Thanks to all contributors.
|
||||
|
||||
## License
|
||||
|
||||
MIT License.
|
35
node_modules/jsonpointer/jsonpointer.d.ts
generated
vendored
Normal file
35
node_modules/jsonpointer/jsonpointer.d.ts
generated
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
interface JSONPointer {
|
||||
/**
|
||||
* Looks up a JSON pointer in an object
|
||||
*/
|
||||
get(object: Object): any;
|
||||
|
||||
|
||||
/**
|
||||
* Set a value for a JSON pointer on object
|
||||
*/
|
||||
set(object: Object, value: any): void;
|
||||
}
|
||||
|
||||
|
||||
declare namespace JSONPointer {
|
||||
/**
|
||||
* Looks up a JSON pointer in an object
|
||||
*/
|
||||
function get(object: Object, pointer: string): any;
|
||||
|
||||
|
||||
/**
|
||||
* Set a value for a JSON pointer on object
|
||||
*/
|
||||
function set(object: Object, pointer: string, value: any): void;
|
||||
|
||||
|
||||
/**
|
||||
* Builds a JSONPointer instance from a pointer value.
|
||||
*/
|
||||
function compile(pointer: string): JSONPointer;
|
||||
}
|
||||
|
||||
|
||||
export = JSONPointer;
|
100
node_modules/jsonpointer/jsonpointer.js
generated
vendored
Normal file
100
node_modules/jsonpointer/jsonpointer.js
generated
vendored
Normal file
@@ -0,0 +1,100 @@
|
||||
var hasExcape = /~/
|
||||
var escapeMatcher = /~[01]/g
|
||||
function escapeReplacer (m) {
|
||||
switch (m) {
|
||||
case '~1': return '/'
|
||||
case '~0': return '~'
|
||||
}
|
||||
throw new Error('Invalid tilde escape: ' + m)
|
||||
}
|
||||
|
||||
function untilde (str) {
|
||||
if (!hasExcape.test(str)) return str
|
||||
return str.replace(escapeMatcher, escapeReplacer)
|
||||
}
|
||||
|
||||
function setter (obj, pointer, value) {
|
||||
var part
|
||||
var hasNextPart
|
||||
|
||||
for (var p = 1, len = pointer.length; p < len;) {
|
||||
if (pointer[p] === 'constructor' || pointer[p] === 'prototype' || pointer[p] === '__proto__') return obj
|
||||
|
||||
part = untilde(pointer[p++])
|
||||
hasNextPart = len > p
|
||||
|
||||
if (typeof obj[part] === 'undefined') {
|
||||
// support setting of /-
|
||||
if (Array.isArray(obj) && part === '-') {
|
||||
part = obj.length
|
||||
}
|
||||
|
||||
// support nested objects/array when setting values
|
||||
if (hasNextPart) {
|
||||
if ((pointer[p] !== '' && pointer[p] < Infinity) || pointer[p] === '-') obj[part] = []
|
||||
else obj[part] = {}
|
||||
}
|
||||
}
|
||||
|
||||
if (!hasNextPart) break
|
||||
obj = obj[part]
|
||||
}
|
||||
|
||||
var oldValue = obj[part]
|
||||
if (value === undefined) delete obj[part]
|
||||
else obj[part] = value
|
||||
return oldValue
|
||||
}
|
||||
|
||||
function compilePointer (pointer) {
|
||||
if (typeof pointer === 'string') {
|
||||
pointer = pointer.split('/')
|
||||
if (pointer[0] === '') return pointer
|
||||
throw new Error('Invalid JSON pointer.')
|
||||
} else if (Array.isArray(pointer)) {
|
||||
for (const part of pointer) {
|
||||
if (typeof part !== 'string' && typeof part !== 'number') {
|
||||
throw new Error('Invalid JSON pointer. Must be of type string or number.')
|
||||
}
|
||||
}
|
||||
return pointer
|
||||
}
|
||||
|
||||
throw new Error('Invalid JSON pointer.')
|
||||
}
|
||||
|
||||
function get (obj, pointer) {
|
||||
if (typeof obj !== 'object') throw new Error('Invalid input object.')
|
||||
pointer = compilePointer(pointer)
|
||||
var len = pointer.length
|
||||
if (len === 1) return obj
|
||||
|
||||
for (var p = 1; p < len;) {
|
||||
obj = obj[untilde(pointer[p++])]
|
||||
if (len === p) return obj
|
||||
if (typeof obj !== 'object' || obj === null) return undefined
|
||||
}
|
||||
}
|
||||
|
||||
function set (obj, pointer, value) {
|
||||
if (typeof obj !== 'object') throw new Error('Invalid input object.')
|
||||
pointer = compilePointer(pointer)
|
||||
if (pointer.length === 0) throw new Error('Invalid JSON pointer for set.')
|
||||
return setter(obj, pointer, value)
|
||||
}
|
||||
|
||||
function compile (pointer) {
|
||||
var compiled = compilePointer(pointer)
|
||||
return {
|
||||
get: function (object) {
|
||||
return get(object, compiled)
|
||||
},
|
||||
set: function (object, value) {
|
||||
return set(object, compiled, value)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
exports.get = get
|
||||
exports.set = set
|
||||
exports.compile = compile
|
129
node_modules/jsonpointer/package.json
generated
vendored
Normal file
129
node_modules/jsonpointer/package.json
generated
vendored
Normal file
@@ -0,0 +1,129 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
{
|
||||
"name": "jsonpointer",
|
||||
"raw": "jsonpointer@^5.0.0",
|
||||
"rawSpec": "^5.0.0",
|
||||
"scope": null,
|
||||
"spec": ">=5.0.0 <6.0.0",
|
||||
"type": "range"
|
||||
},
|
||||
"/root/gitbook/node_modules/is-my-json-valid"
|
||||
]
|
||||
],
|
||||
"_from": "jsonpointer@>=5.0.0 <6.0.0",
|
||||
"_hasShrinkwrap": false,
|
||||
"_id": "jsonpointer@5.0.1",
|
||||
"_inCache": true,
|
||||
"_installable": true,
|
||||
"_location": "/jsonpointer",
|
||||
"_nodeVersion": "17.8.0",
|
||||
"_npmOperationalInternal": {
|
||||
"host": "s3://npm-registry-packages",
|
||||
"tmp": "tmp/jsonpointer_5.0.1_1657716370640_0.4108376362887427"
|
||||
},
|
||||
"_npmUser": {
|
||||
"email": "marc.brookman@gmail.com",
|
||||
"name": "marcbachmann"
|
||||
},
|
||||
"_npmVersion": "8.5.5",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"name": "jsonpointer",
|
||||
"raw": "jsonpointer@^5.0.0",
|
||||
"rawSpec": "^5.0.0",
|
||||
"scope": null,
|
||||
"spec": ">=5.0.0 <6.0.0",
|
||||
"type": "range"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/is-my-json-valid"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/jsonpointer/-/jsonpointer-5.0.1.tgz",
|
||||
"_shasum": "2110e0af0900fd37467b5907ecd13a7884a1b559",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "jsonpointer@^5.0.0",
|
||||
"_where": "/root/gitbook/node_modules/is-my-json-valid",
|
||||
"author": {
|
||||
"email": "jan@apache.org",
|
||||
"name": "Jan Lehnardt"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "http://github.com/janl/node-jsonpointer/issues"
|
||||
},
|
||||
"contributors": [
|
||||
{
|
||||
"email": "joe-github@cursive.net",
|
||||
"name": "Joe Hildebrand"
|
||||
},
|
||||
{
|
||||
"email": "marc.brookman@gmail.com",
|
||||
"name": "Marc Bachmann"
|
||||
}
|
||||
],
|
||||
"dependencies": {},
|
||||
"description": "Simple JSON Addressing.",
|
||||
"devDependencies": {
|
||||
"semantic-release": "^18.0.0",
|
||||
"standard": "^16.0.4"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"fileCount": 5,
|
||||
"integrity": "sha512-p/nXbhSEcu3pZRdkW1OfJhpsVtW1gd4Wa1fnQc9YLiTfAjn0312eMKimbdIQzuZl9aa9xUGaRlP9T/CJE/ditQ==",
|
||||
"npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJizr6SACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrozhAAj0CvR+5e0Qv2DOwpj+Hcrx/n6vDcRDsCQkTmATSQDjwSTxx1\r\nDt9hRzaHHv+kxMPIm5/MOgw7ZqWh6XLKT94blKLaBd1o2f4hIDb1i6bq84XL\r\nvAao8MjYD+9DEqYYdNkI7JrY0oJx3jEkIBwgVpgmDokXAIUOhnmyr/4fHp7H\r\nU18oDodKt4OCBhxw3DAc4aP/dhgF6J0Geg3NUysWUvuMCK1yJeBMjubpVmgl\r\n1wE3LgA49B3OTtyKyAW2N+Uv+Kwtw6magTCJweGt7q650bWpFAMyTwN47rCK\r\nZrFA73iBSBrGTJ0/xnQTdepdHNvDLgYoxg3vOyjvR0AGx7WwEAb0eyfM/sQq\r\n4frYjIf1dZ+xcB2Zr9R0FkAyG5ofLbk6yOtF7Zv8+8MqtdvS88/el0ovfedg\r\nNzwEXwwGyE3R+Blcey3pPCKEDNUxB4l6h42j7cE5UQog7aUFBj45S3qVw1fk\r\naMLC3ii9rgPkxO0ftN6Rxh55ukSgxiN8TxNQrPbhEpgHEo+CLpUoTH6+9Fzy\r\ny7sfwya/StYmHnMNki3wMoiMqCVhRrCJPV4qmjJDWLzb7BZGvAIirqa4/S39\r\n2bDHu/B4c4iJPZm6neUUFCxZldv9CLnKSP93BFWRQKO1pFx5ri6btWz4n53e\r\n7ooLymt1JIYurrj7LZKcyznpq3ZWDhwLZnE=\r\n=3B9o\r\n-----END PGP SIGNATURE-----\r\n",
|
||||
"shasum": "2110e0af0900fd37467b5907ecd13a7884a1b559",
|
||||
"signatures": [
|
||||
{
|
||||
"keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA",
|
||||
"sig": "MEYCIQDWqIiPd4TqapqfQ8HQU2Vz+x4i3Mi4LLB8MjGAqk3dyQIhAPbzwEm7IFj4+Lo5nyc0m34FZ47Rdu6FxQrgrY0bsg/N"
|
||||
}
|
||||
],
|
||||
"tarball": "https://registry.npmjs.org/jsonpointer/-/jsonpointer-5.0.1.tgz",
|
||||
"unpackedSize": 6751
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
"gitHead": "d0d9af9c406a0e0ca34d32f99e27b00499aff824",
|
||||
"homepage": "https://github.com/janl/node-jsonpointer#readme",
|
||||
"license": "MIT",
|
||||
"main": "./jsonpointer",
|
||||
"maintainers": [
|
||||
{
|
||||
"email": "jan@apache.org",
|
||||
"name": "jan"
|
||||
},
|
||||
{
|
||||
"email": "marc.brookman@gmail.com",
|
||||
"name": "marcbachmann"
|
||||
}
|
||||
],
|
||||
"name": "jsonpointer",
|
||||
"optionalDependencies": {},
|
||||
"readme": "ERROR: No README data found!",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/janl/node-jsonpointer.git"
|
||||
},
|
||||
"scripts": {
|
||||
"semantic-release": "semantic-release pre && npm publish && semantic-release post",
|
||||
"test": "npm run test:standard && npm run test:all",
|
||||
"test:all": "node test.js",
|
||||
"test:standard": "standard"
|
||||
},
|
||||
"standard": {
|
||||
"ignore": [
|
||||
"test.js"
|
||||
]
|
||||
},
|
||||
"tags": [
|
||||
"util",
|
||||
"simple",
|
||||
"util",
|
||||
"utility"
|
||||
],
|
||||
"typings": "jsonpointer.d.ts",
|
||||
"version": "5.0.1"
|
||||
}
|
Reference in New Issue
Block a user