Template Upload
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.
|
39
node_modules/jsonpointer/README.md
generated
vendored
Normal file
39
node_modules/jsonpointer/README.md
generated
vendored
Normal file
@ -0,0 +1,39 @@
|
||||
# JSON Pointer for nodejs
|
||||
|
||||
This is an implementation of [JSON Pointer](http://tools.ietf.org/html/draft-ietf-appsawg-json-pointer-08).
|
||||
|
||||
## 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
|
||||
|
||||
$ node test.js
|
||||
All tests pass.
|
||||
$
|
||||
|
||||
[](https://travis-ci.org/janl/node-jsonpointer)
|
||||
|
||||
## Author
|
||||
|
||||
(c) 2011-2015 Jan Lehnardt <jan@apache.org> & Marc Bachmann <https://github.com/marcbachmann>
|
||||
|
||||
## License
|
||||
|
||||
MIT License.
|
93
node_modules/jsonpointer/jsonpointer.js
generated
vendored
Normal file
93
node_modules/jsonpointer/jsonpointer.js
generated
vendored
Normal file
@ -0,0 +1,93 @@
|
||||
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;) {
|
||||
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)) {
|
||||
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') 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
|
103
node_modules/jsonpointer/package.json
generated
vendored
Normal file
103
node_modules/jsonpointer/package.json
generated
vendored
Normal file
@ -0,0 +1,103 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"jsonpointer@^4.0.0",
|
||||
"C:\\Users\\x2mjbyrn\\Source\\Repos\\Skeleton\\node_modules\\is-my-json-valid"
|
||||
]
|
||||
],
|
||||
"_from": "jsonpointer@>=4.0.0-0 <5.0.0-0",
|
||||
"_id": "jsonpointer@4.0.1",
|
||||
"_inCache": true,
|
||||
"_location": "/jsonpointer",
|
||||
"_nodeVersion": "6.9.1",
|
||||
"_npmOperationalInternal": {
|
||||
"host": "packages-12-west.internal.npmjs.com",
|
||||
"tmp": "tmp/jsonpointer-4.0.1.tgz_1482326391770_0.6748844815883785"
|
||||
},
|
||||
"_npmUser": {
|
||||
"email": "marc.brookman@gmail.com",
|
||||
"name": "marcbachmann"
|
||||
},
|
||||
"_npmVersion": "3.10.8",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"name": "jsonpointer",
|
||||
"raw": "jsonpointer@^4.0.0",
|
||||
"rawSpec": "^4.0.0",
|
||||
"scope": null,
|
||||
"spec": ">=4.0.0-0 <5.0.0-0",
|
||||
"type": "range"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/is-my-json-valid"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/jsonpointer/-/jsonpointer-4.0.1.tgz",
|
||||
"_shasum": "4fd92cb34e0e9db3c89c8622ecf51f9b978c6cb9",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "jsonpointer@^4.0.0",
|
||||
"_where": "C:\\Users\\x2mjbyrn\\Source\\Repos\\Skeleton\\node_modules\\is-my-json-valid",
|
||||
"author": {
|
||||
"email": "jan@apache.org",
|
||||
"name": "Jan Lehnardt"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "http://github.com/janl/node-jsonpointer/issues"
|
||||
},
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Joe Hildebrand",
|
||||
"email": "joe-github@cursive.net"
|
||||
},
|
||||
{
|
||||
"name": "Marc Bachmann",
|
||||
"email": "marc.brookman@gmail.com"
|
||||
}
|
||||
],
|
||||
"dependencies": {},
|
||||
"description": "Simple JSON Addressing.",
|
||||
"devDependencies": {
|
||||
"standard": "^5.3.1"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "4fd92cb34e0e9db3c89c8622ecf51f9b978c6cb9",
|
||||
"tarball": "https://registry.npmjs.org/jsonpointer/-/jsonpointer-4.0.1.tgz"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
"files": [
|
||||
"jsonpointer.js"
|
||||
],
|
||||
"gitHead": "37c73aecd5f192a00cd79c0ebbbb2034b91bcfd0",
|
||||
"homepage": "https://github.com/janl/node-jsonpointer#readme",
|
||||
"installable": true,
|
||||
"license": "MIT",
|
||||
"main": "./jsonpointer",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "jan",
|
||||
"email": "jan@apache.org"
|
||||
},
|
||||
{
|
||||
"name": "marcbachmann",
|
||||
"email": "marc.brookman@gmail.com"
|
||||
}
|
||||
],
|
||||
"name": "jsonpointer",
|
||||
"optionalDependencies": {},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+ssh://git@github.com/janl/node-jsonpointer.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "standard && node test.js"
|
||||
},
|
||||
"tags": [
|
||||
"simple",
|
||||
"util",
|
||||
"util",
|
||||
"utility"
|
||||
],
|
||||
"version": "4.0.1"
|
||||
}
|
Reference in New Issue
Block a user