changed action for arc cluster to use az connectedk8s proxy
This commit is contained in:
60
node_modules/jsonpath/.jscsrc
generated
vendored
Normal file
60
node_modules/jsonpath/.jscsrc
generated
vendored
Normal file
@@ -0,0 +1,60 @@
|
||||
{
|
||||
"disallowSpacesInNamedFunctionExpression": {
|
||||
"beforeOpeningRoundBrace": true
|
||||
},
|
||||
"disallowSpacesInFunctionExpression": {
|
||||
"beforeOpeningRoundBrace": true
|
||||
},
|
||||
"disallowSpacesInAnonymousFunctionExpression": {
|
||||
"beforeOpeningRoundBrace": true
|
||||
},
|
||||
"disallowSpacesInFunctionDeclaration": {
|
||||
"beforeOpeningRoundBrace": true
|
||||
},
|
||||
"disallowEmptyBlocks": true,
|
||||
"disallowSpacesInsideParentheses": true,
|
||||
"disallowQuotedKeysInObjects": true,
|
||||
"disallowSpaceAfterObjectKeys": true,
|
||||
"disallowSpaceAfterPrefixUnaryOperators": true,
|
||||
"disallowSpaceBeforePostfixUnaryOperators": true,
|
||||
"disallowSpaceBeforeBinaryOperators": [
|
||||
","
|
||||
],
|
||||
"disallowMixedSpacesAndTabs": true,
|
||||
"disallowTrailingWhitespace": true,
|
||||
"disallowTrailingComma": true,
|
||||
"disallowYodaConditions": true,
|
||||
"disallowKeywords": [ "with" ],
|
||||
"disallowMultipleLineBreaks": true,
|
||||
"requireSpaceBeforeBlockStatements": true,
|
||||
"requireParenthesesAroundIIFE": true,
|
||||
"requireSpacesInConditionalExpression": true,
|
||||
"disallowMultipleVarDecl": true,
|
||||
"requireBlocksOnNewline": 1,
|
||||
"requireCommaBeforeLineBreak": true,
|
||||
"requireSpaceBeforeBinaryOperators": true,
|
||||
"requireSpaceAfterBinaryOperators": true,
|
||||
"requireLineFeedAtFileEnd": true,
|
||||
"requireCapitalizedConstructors": true,
|
||||
"requireDotNotation": true,
|
||||
"requireSpacesInForStatement": true,
|
||||
"requireCurlyBraces": [
|
||||
"do"
|
||||
],
|
||||
"requireSpaceAfterKeywords": [
|
||||
"if",
|
||||
"else",
|
||||
"for",
|
||||
"while",
|
||||
"do",
|
||||
"switch",
|
||||
"case",
|
||||
"return",
|
||||
"try",
|
||||
"catch",
|
||||
"typeof"
|
||||
],
|
||||
"safeContextKeyword": "self",
|
||||
"validateLineBreaks": "LF",
|
||||
"validateIndentation": 2
|
||||
}
|
9
node_modules/jsonpath/.jshintrc
generated
vendored
Normal file
9
node_modules/jsonpath/.jshintrc
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"node": true,
|
||||
"undef": true,
|
||||
"unused": true,
|
||||
"lastsemic": true,
|
||||
"-W058": false, /* don't require parentheses for no-arg constructors */
|
||||
"-W054": false, /* use Function constructor responsibly */
|
||||
"-W033": false /* let jscs deal with semicolons */
|
||||
}
|
3
node_modules/jsonpath/.travis.yml
generated
vendored
Normal file
3
node_modules/jsonpath/.travis.yml
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- "0.10"
|
1
node_modules/jsonpath/Dockerfile
generated
vendored
Normal file
1
node_modules/jsonpath/Dockerfile
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
FROM node:0.11-onbuild
|
83
node_modules/jsonpath/Gruntfile.js
generated
vendored
Normal file
83
node_modules/jsonpath/Gruntfile.js
generated
vendored
Normal file
@@ -0,0 +1,83 @@
|
||||
var Browserify = require('browserify');
|
||||
var bresolve = require('browser-resolve');
|
||||
patchResolve();
|
||||
|
||||
module.exports = function (grunt) {
|
||||
grunt.initConfig({
|
||||
pkg: grunt.file.readJSON('package.json'),
|
||||
outputFolder: ".",
|
||||
|
||||
browserify: {
|
||||
main: {
|
||||
src: ['index.js'],
|
||||
dest: '<%= outputFolder %>/<%= pkg.name %>.js',
|
||||
options: {
|
||||
browserifyOptions: { standalone: '<%= pkg.name %>' },
|
||||
banner: '/*! <%= pkg.name %> <%= pkg.version %> */\n',
|
||||
alias: {
|
||||
"jsonpath": "./index.js"
|
||||
},
|
||||
require: [
|
||||
/**
|
||||
* When running in Node, we require('./aesprim') and that module takes care of monkey-patching esprima
|
||||
* using resolve, path finding, etc...
|
||||
* Anyways, Browserify doesn't support "resolve", so we need to trick the module. We'll actually be
|
||||
* returning a verbatim, non-modified "esprima" when the code runs require('./aesprim').
|
||||
* That is ok because we will modify the "esprima" source code right after the bundle process, via
|
||||
* the postBundleCB callback.
|
||||
*/
|
||||
["esprima", {expose: "./aesprim"}]
|
||||
],
|
||||
ignore: [
|
||||
'file',
|
||||
'system',
|
||||
'source-map',
|
||||
'estraverse',
|
||||
'escodegen',
|
||||
'underscore',
|
||||
'reflect',
|
||||
'JSONSelect',
|
||||
'./lib/aesprim.js'
|
||||
//'assert' //can't remove because of lib/index.js,
|
||||
],
|
||||
postBundleCB: function(err, src, next) {
|
||||
/**
|
||||
* This is ugly, but we need to make "esprima" understand '@' as a valid character.
|
||||
* It's either this or bundle a copy of the library with those few bytes of changes.
|
||||
*/
|
||||
src = src.toString("utf8").replace(/(function isIdentifierStart\(ch\) {\s+return)/m, '$1 (ch == 0x40) || ');
|
||||
next(err, new Buffer(src, "utf8"));
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
uglify: {
|
||||
options: {
|
||||
banner: '/*! <%= pkg.name %> <%= pkg.version %> */\n'
|
||||
},
|
||||
build: {
|
||||
src: '<%= outputFolder %>/<%= pkg.name %>.js',
|
||||
dest: '<%= outputFolder %>/<%= pkg.name %>.min.js'
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
grunt.loadNpmTasks('grunt-browserify');
|
||||
grunt.loadNpmTasks('grunt-contrib-uglify')
|
||||
grunt.registerTask('default', ['browserify', 'uglify']);
|
||||
|
||||
};
|
||||
|
||||
function patchResolve() {
|
||||
var _createDeps = Browserify.prototype._createDeps;
|
||||
Browserify.prototype._createDeps = function() {
|
||||
var returnValue = _createDeps.apply(this, arguments);
|
||||
this._bresolve = function(id, opts, cb) {
|
||||
opts.browser = 'alias';
|
||||
return bresolve(id, opts, cb);
|
||||
};
|
||||
return returnValue;
|
||||
}
|
||||
}
|
7
node_modules/jsonpath/LICENSE
generated
vendored
Normal file
7
node_modules/jsonpath/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
Copyright (c) 2014-2016 David Chester <david@fmail.co.uk>
|
||||
|
||||
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.
|
216
node_modules/jsonpath/README.md
generated
vendored
Normal file
216
node_modules/jsonpath/README.md
generated
vendored
Normal file
@@ -0,0 +1,216 @@
|
||||
[](https://travis-ci.org/dchester/jsonpath)
|
||||
|
||||
# jsonpath
|
||||
|
||||
Query JavaScript objects with JSONPath expressions. Robust / safe JSONPath engine for Node.js.
|
||||
|
||||
|
||||
## Query Example
|
||||
|
||||
```javascript
|
||||
var cities = [
|
||||
{ name: "London", "population": 8615246 },
|
||||
{ name: "Berlin", "population": 3517424 },
|
||||
{ name: "Madrid", "population": 3165235 },
|
||||
{ name: "Rome", "population": 2870528 }
|
||||
];
|
||||
|
||||
var jp = require('jsonpath');
|
||||
var names = jp.query(cities, '$..name');
|
||||
|
||||
// [ "London", "Berlin", "Madrid", "Rome" ]
|
||||
```
|
||||
|
||||
## Install
|
||||
|
||||
Install from npm:
|
||||
```bash
|
||||
$ npm install jsonpath
|
||||
```
|
||||
|
||||
## JSONPath Syntax
|
||||
|
||||
Here are syntax and examples adapted from [Stefan Goessner's original post](http://goessner.net/articles/JsonPath/) introducing JSONPath in 2007.
|
||||
|
||||
JSONPath | Description
|
||||
-----------------|------------
|
||||
`$` | The root object/element
|
||||
`@` | The current object/element
|
||||
`.` | Child member operator
|
||||
`..` | Recursive descendant operator; JSONPath borrows this syntax from E4X
|
||||
`*` | Wildcard matching all objects/elements regardless their names
|
||||
`[]` | Subscript operator
|
||||
`[,]` | Union operator for alternate names or array indices as a set
|
||||
`[start:end:step]` | Array slice operator borrowed from ES4 / Python
|
||||
`?()` | Applies a filter (script) expression via static evaluation
|
||||
`()` | Script expression via static evaluation
|
||||
|
||||
Given this sample data set, see example expressions below:
|
||||
|
||||
```javascript
|
||||
{
|
||||
"store": {
|
||||
"book": [
|
||||
{
|
||||
"category": "reference",
|
||||
"author": "Nigel Rees",
|
||||
"title": "Sayings of the Century",
|
||||
"price": 8.95
|
||||
}, {
|
||||
"category": "fiction",
|
||||
"author": "Evelyn Waugh",
|
||||
"title": "Sword of Honour",
|
||||
"price": 12.99
|
||||
}, {
|
||||
"category": "fiction",
|
||||
"author": "Herman Melville",
|
||||
"title": "Moby Dick",
|
||||
"isbn": "0-553-21311-3",
|
||||
"price": 8.99
|
||||
}, {
|
||||
"category": "fiction",
|
||||
"author": "J. R. R. Tolkien",
|
||||
"title": "The Lord of the Rings",
|
||||
"isbn": "0-395-19395-8",
|
||||
"price": 22.99
|
||||
}
|
||||
],
|
||||
"bicycle": {
|
||||
"color": "red",
|
||||
"price": 19.95
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Example JSONPath expressions:
|
||||
|
||||
JSONPath | Description
|
||||
------------------------------|------------
|
||||
`$.store.book[*].author` | The authors of all books in the store
|
||||
`$..author` | All authors
|
||||
`$.store.*` | All things in store, which are some books and a red bicycle
|
||||
`$.store..price` | The price of everything in the store
|
||||
`$..book[2]` | The third book
|
||||
`$..book[(@.length-1)]` | The last book via script subscript
|
||||
`$..book[-1:]` | The last book via slice
|
||||
`$..book[0,1]` | The first two books via subscript union
|
||||
`$..book[:2]` | The first two books via subscript array slice
|
||||
`$..book[?(@.isbn)]` | Filter all books with isbn number
|
||||
`$..book[?(@.price<10)]` | Filter all books cheaper than 10
|
||||
`$..book[?(@.price==8.95)]` | Filter all books that cost 8.95
|
||||
`$..book[?(@.price<30 && @.category=="fiction")]` | Filter all fiction books cheaper than 30
|
||||
`$..*` | All members of JSON structure
|
||||
|
||||
|
||||
## Methods
|
||||
|
||||
#### jp.query(obj, pathExpression[, count])
|
||||
|
||||
Find elements in `obj` matching `pathExpression`. Returns an array of elements that satisfy the provided JSONPath expression, or an empty array if none were matched. Returns only first `count` elements if specified.
|
||||
|
||||
```javascript
|
||||
var authors = jp.query(data, '$..author');
|
||||
// [ 'Nigel Rees', 'Evelyn Waugh', 'Herman Melville', 'J. R. R. Tolkien' ]
|
||||
```
|
||||
|
||||
#### jp.paths(obj, pathExpression[, count])
|
||||
|
||||
Find paths to elements in `obj` matching `pathExpression`. Returns an array of element paths that satisfy the provided JSONPath expression. Each path is itself an array of keys representing the location within `obj` of the matching element. Returns only first `count` paths if specified.
|
||||
|
||||
|
||||
```javascript
|
||||
var paths = jp.paths(data, '$..author');
|
||||
// [
|
||||
// ['$', 'store', 'book', 0, 'author'] },
|
||||
// ['$', 'store', 'book', 1, 'author'] },
|
||||
// ['$', 'store', 'book', 2, 'author'] },
|
||||
// ['$', 'store', 'book', 3, 'author'] }
|
||||
// ]
|
||||
```
|
||||
|
||||
#### jp.nodes(obj, pathExpression[, count])
|
||||
|
||||
Find elements and their corresponding paths in `obj` matching `pathExpression`. Returns an array of node objects where each node has a `path` containing an array of keys representing the location within `obj`, and a `value` pointing to the matched element. Returns only first `count` nodes if specified.
|
||||
|
||||
```javascript
|
||||
var nodes = jp.nodes(data, '$..author');
|
||||
// [
|
||||
// { path: ['$', 'store', 'book', 0, 'author'], value: 'Nigel Rees' },
|
||||
// { path: ['$', 'store', 'book', 1, 'author'], value: 'Evelyn Waugh' },
|
||||
// { path: ['$', 'store', 'book', 2, 'author'], value: 'Herman Melville' },
|
||||
// { path: ['$', 'store', 'book', 3, 'author'], value: 'J. R. R. Tolkien' }
|
||||
// ]
|
||||
```
|
||||
|
||||
#### jp.value(obj, pathExpression[, newValue])
|
||||
|
||||
Returns the value of the first element matching `pathExpression`. If `newValue` is provided, sets the value of the first matching element and returns the new value.
|
||||
|
||||
#### jp.parent(obj, pathExpression)
|
||||
|
||||
Returns the parent of the first matching element.
|
||||
|
||||
#### jp.apply(obj, pathExpression, fn)
|
||||
|
||||
Runs the supplied function `fn` on each matching element, and replaces each matching element with the return value from the function. The function accepts the value of the matching element as its only parameter. Returns matching nodes with their updated values.
|
||||
|
||||
|
||||
```javascript
|
||||
var nodes = jp.apply(data, '$..author', function(value) { return value.toUpperCase() });
|
||||
// [
|
||||
// { path: ['$', 'store', 'book', 0, 'author'], value: 'NIGEL REES' },
|
||||
// { path: ['$', 'store', 'book', 1, 'author'], value: 'EVELYN WAUGH' },
|
||||
// { path: ['$', 'store', 'book', 2, 'author'], value: 'HERMAN MELVILLE' },
|
||||
// { path: ['$', 'store', 'book', 3, 'author'], value: 'J. R. R. TOLKIEN' }
|
||||
// ]
|
||||
```
|
||||
|
||||
#### jp.parse(pathExpression)
|
||||
|
||||
Parse the provided JSONPath expression into path components and their associated operations.
|
||||
|
||||
```javascript
|
||||
var path = jp.parse('$..author');
|
||||
// [
|
||||
// { expression: { type: 'root', value: '$' } },
|
||||
// { expression: { type: 'identifier', value: 'author' }, operation: 'member', scope: 'descendant' }
|
||||
// ]
|
||||
```
|
||||
|
||||
#### jp.stringify(path)
|
||||
|
||||
Returns a path expression in string form, given a path. The supplied path may either be a flat array of keys, as returned by `jp.nodes` for example, or may alternatively be a fully parsed path expression in the form of an array of path components as returned by `jp.parse`.
|
||||
|
||||
```javascript
|
||||
var pathExpression = jp.stringify(['$', 'store', 'book', 0, 'author']);
|
||||
// "$.store.book[0].author"
|
||||
```
|
||||
|
||||
## Differences from Original Implementation
|
||||
|
||||
This implementation aims to be compatible with Stefan Goessner's original implementation with a few notable exceptions described below.
|
||||
|
||||
#### Evaluating Script Expressions
|
||||
|
||||
Script expressions (i.e, `(...)` and `?(...)`) are statically evaluated via [static-eval](https://github.com/substack/static-eval) rather than using the underlying script engine directly. That means both that the scope is limited to the instance variable (`@`), and only simple expressions (with no side effects) will be valid. So for example, `?(@.length>10)` will be just fine to match arrays with more than ten elements, but `?(process.exit())` will not get evaluated since `process` would yield a `ReferenceError`. This method is even safer than `vm.runInNewContext`, since the script engine itself is more limited and entirely distinct from the one running the application code. See more details in the [implementation](https://github.com/substack/static-eval/blob/master/index.js) of the evaluator.
|
||||
|
||||
#### Grammar
|
||||
|
||||
This project uses a formal BNF [grammar](https://github.com/dchester/jsonpath/blob/master/lib/grammar.js) to parse JSONPath expressions, an attempt at reverse-engineering the intent of the original implementation, which parses via a series of creative regular expressions. The original regex approach can sometimes be forgiving for better or for worse (e.g., `$['store]` => `$['store']`), and in other cases, can be just plain wrong (e.g. `[` => `$`).
|
||||
|
||||
#### Other Minor Differences
|
||||
|
||||
As a result of using a real parser and static evaluation, there are some arguable bugs in the original library that have not been carried through here:
|
||||
|
||||
- strings in subscripts may now be double-quoted
|
||||
- final `step` arguments in slice operators may now be negative
|
||||
- script expressions may now contain `.` and `@` characters not referring to instance variables
|
||||
- subscripts no longer act as character slices on string elements
|
||||
- non-ascii non-word characters are no-longer valid in member identifier names; use quoted subscript strings instead (e.g., `$['$']` instead of `$.$`)
|
||||
- unions now yield real unions with no duplicates rather than concatenated results
|
||||
|
||||
## License
|
||||
|
||||
[MIT](LICENSE)
|
||||
|
5
node_modules/jsonpath/fig.yml
generated
vendored
Normal file
5
node_modules/jsonpath/fig.yml
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
test:
|
||||
build: .
|
||||
command: node /usr/src/app/node_modules/.bin/mocha -u tdd test/
|
||||
volumes:
|
||||
- .:/usr/src/app
|
721
node_modules/jsonpath/generated/parser.js
generated
vendored
Normal file
721
node_modules/jsonpath/generated/parser.js
generated
vendored
Normal file
@@ -0,0 +1,721 @@
|
||||
/* parser generated by jison 0.4.13 */
|
||||
/*
|
||||
Returns a Parser object of the following structure:
|
||||
|
||||
Parser: {
|
||||
yy: {}
|
||||
}
|
||||
|
||||
Parser.prototype: {
|
||||
yy: {},
|
||||
trace: function(),
|
||||
symbols_: {associative list: name ==> number},
|
||||
terminals_: {associative list: number ==> name},
|
||||
productions_: [...],
|
||||
performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$),
|
||||
table: [...],
|
||||
defaultActions: {...},
|
||||
parseError: function(str, hash),
|
||||
parse: function(input),
|
||||
|
||||
lexer: {
|
||||
EOF: 1,
|
||||
parseError: function(str, hash),
|
||||
setInput: function(input),
|
||||
input: function(),
|
||||
unput: function(str),
|
||||
more: function(),
|
||||
less: function(n),
|
||||
pastInput: function(),
|
||||
upcomingInput: function(),
|
||||
showPosition: function(),
|
||||
test_match: function(regex_match_array, rule_index),
|
||||
next: function(),
|
||||
lex: function(),
|
||||
begin: function(condition),
|
||||
popState: function(),
|
||||
_currentRules: function(),
|
||||
topState: function(),
|
||||
pushState: function(condition),
|
||||
|
||||
options: {
|
||||
ranges: boolean (optional: true ==> token location info will include a .range[] member)
|
||||
flex: boolean (optional: true ==> flex-like lexing behaviour where the rules are tested exhaustively to find the longest match)
|
||||
backtrack_lexer: boolean (optional: true ==> lexer regexes are tested in order and for each matching regex the action code is invoked; the lexer terminates the scan when a token is returned by the action code)
|
||||
},
|
||||
|
||||
performAction: function(yy, yy_, $avoiding_name_collisions, YY_START),
|
||||
rules: [...],
|
||||
conditions: {associative list: name ==> set},
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
token location info (@$, _$, etc.): {
|
||||
first_line: n,
|
||||
last_line: n,
|
||||
first_column: n,
|
||||
last_column: n,
|
||||
range: [start_number, end_number] (where the numbers are indexes into the input string, regular zero-based)
|
||||
}
|
||||
|
||||
|
||||
the parseError function receives a 'hash' object with these members for lexer and parser errors: {
|
||||
text: (matched text)
|
||||
token: (the produced terminal token, if any)
|
||||
line: (yylineno)
|
||||
}
|
||||
while parser (grammar) errors will also provide these members, i.e. parser errors deliver a superset of attributes: {
|
||||
loc: (yylloc)
|
||||
expected: (string describing the set of expected tokens)
|
||||
recoverable: (boolean: TRUE when the parser has a error recovery rule available for this particular error)
|
||||
}
|
||||
*/
|
||||
var parser = (function(){
|
||||
var parser = {trace: function trace() { },
|
||||
yy: {},
|
||||
symbols_: {"error":2,"JSON_PATH":3,"DOLLAR":4,"PATH_COMPONENTS":5,"LEADING_CHILD_MEMBER_EXPRESSION":6,"PATH_COMPONENT":7,"MEMBER_COMPONENT":8,"SUBSCRIPT_COMPONENT":9,"CHILD_MEMBER_COMPONENT":10,"DESCENDANT_MEMBER_COMPONENT":11,"DOT":12,"MEMBER_EXPRESSION":13,"DOT_DOT":14,"STAR":15,"IDENTIFIER":16,"SCRIPT_EXPRESSION":17,"INTEGER":18,"END":19,"CHILD_SUBSCRIPT_COMPONENT":20,"DESCENDANT_SUBSCRIPT_COMPONENT":21,"[":22,"SUBSCRIPT":23,"]":24,"SUBSCRIPT_EXPRESSION":25,"SUBSCRIPT_EXPRESSION_LIST":26,"SUBSCRIPT_EXPRESSION_LISTABLE":27,",":28,"STRING_LITERAL":29,"ARRAY_SLICE":30,"FILTER_EXPRESSION":31,"QQ_STRING":32,"Q_STRING":33,"$accept":0,"$end":1},
|
||||
terminals_: {2:"error",4:"DOLLAR",12:"DOT",14:"DOT_DOT",15:"STAR",16:"IDENTIFIER",17:"SCRIPT_EXPRESSION",18:"INTEGER",19:"END",22:"[",24:"]",28:",",30:"ARRAY_SLICE",31:"FILTER_EXPRESSION",32:"QQ_STRING",33:"Q_STRING"},
|
||||
productions_: [0,[3,1],[3,2],[3,1],[3,2],[5,1],[5,2],[7,1],[7,1],[8,1],[8,1],[10,2],[6,1],[11,2],[13,1],[13,1],[13,1],[13,1],[13,1],[9,1],[9,1],[20,3],[21,4],[23,1],[23,1],[26,1],[26,3],[27,1],[27,1],[27,1],[25,1],[25,1],[25,1],[29,1],[29,1]],
|
||||
performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */
|
||||
/**/) {
|
||||
/* this == yyval */
|
||||
if (!yy.ast) {
|
||||
yy.ast = _ast;
|
||||
_ast.initialize();
|
||||
}
|
||||
|
||||
var $0 = $$.length - 1;
|
||||
switch (yystate) {
|
||||
case 1:yy.ast.set({ expression: { type: "root", value: $$[$0] } }); yy.ast.unshift(); return yy.ast.yield()
|
||||
break;
|
||||
case 2:yy.ast.set({ expression: { type: "root", value: $$[$0-1] } }); yy.ast.unshift(); return yy.ast.yield()
|
||||
break;
|
||||
case 3:yy.ast.unshift(); return yy.ast.yield()
|
||||
break;
|
||||
case 4:yy.ast.set({ operation: "member", scope: "child", expression: { type: "identifier", value: $$[$0-1] }}); yy.ast.unshift(); return yy.ast.yield()
|
||||
break;
|
||||
case 5:
|
||||
break;
|
||||
case 6:
|
||||
break;
|
||||
case 7:yy.ast.set({ operation: "member" }); yy.ast.push()
|
||||
break;
|
||||
case 8:yy.ast.set({ operation: "subscript" }); yy.ast.push()
|
||||
break;
|
||||
case 9:yy.ast.set({ scope: "child" })
|
||||
break;
|
||||
case 10:yy.ast.set({ scope: "descendant" })
|
||||
break;
|
||||
case 11:
|
||||
break;
|
||||
case 12:yy.ast.set({ scope: "child", operation: "member" })
|
||||
break;
|
||||
case 13:
|
||||
break;
|
||||
case 14:yy.ast.set({ expression: { type: "wildcard", value: $$[$0] } })
|
||||
break;
|
||||
case 15:yy.ast.set({ expression: { type: "identifier", value: $$[$0] } })
|
||||
break;
|
||||
case 16:yy.ast.set({ expression: { type: "script_expression", value: $$[$0] } })
|
||||
break;
|
||||
case 17:yy.ast.set({ expression: { type: "numeric_literal", value: parseInt($$[$0]) } })
|
||||
break;
|
||||
case 18:
|
||||
break;
|
||||
case 19:yy.ast.set({ scope: "child" })
|
||||
break;
|
||||
case 20:yy.ast.set({ scope: "descendant" })
|
||||
break;
|
||||
case 21:
|
||||
break;
|
||||
case 22:
|
||||
break;
|
||||
case 23:
|
||||
break;
|
||||
case 24:$$[$0].length > 1? yy.ast.set({ expression: { type: "union", value: $$[$0] } }) : this.$ = $$[$0]
|
||||
break;
|
||||
case 25:this.$ = [$$[$0]]
|
||||
break;
|
||||
case 26:this.$ = $$[$0-2].concat($$[$0])
|
||||
break;
|
||||
case 27:this.$ = { expression: { type: "numeric_literal", value: parseInt($$[$0]) } }; yy.ast.set(this.$)
|
||||
break;
|
||||
case 28:this.$ = { expression: { type: "string_literal", value: $$[$0] } }; yy.ast.set(this.$)
|
||||
break;
|
||||
case 29:this.$ = { expression: { type: "slice", value: $$[$0] } }; yy.ast.set(this.$)
|
||||
break;
|
||||
case 30:this.$ = { expression: { type: "wildcard", value: $$[$0] } }; yy.ast.set(this.$)
|
||||
break;
|
||||
case 31:this.$ = { expression: { type: "script_expression", value: $$[$0] } }; yy.ast.set(this.$)
|
||||
break;
|
||||
case 32:this.$ = { expression: { type: "filter_expression", value: $$[$0] } }; yy.ast.set(this.$)
|
||||
break;
|
||||
case 33:this.$ = $$[$0]
|
||||
break;
|
||||
case 34:this.$ = $$[$0]
|
||||
break;
|
||||
}
|
||||
},
|
||||
table: [{3:1,4:[1,2],6:3,13:4,15:[1,5],16:[1,6],17:[1,7],18:[1,8],19:[1,9]},{1:[3]},{1:[2,1],5:10,7:11,8:12,9:13,10:14,11:15,12:[1,18],14:[1,19],20:16,21:17,22:[1,20]},{1:[2,3],5:21,7:11,8:12,9:13,10:14,11:15,12:[1,18],14:[1,19],20:16,21:17,22:[1,20]},{1:[2,12],12:[2,12],14:[2,12],22:[2,12]},{1:[2,14],12:[2,14],14:[2,14],22:[2,14]},{1:[2,15],12:[2,15],14:[2,15],22:[2,15]},{1:[2,16],12:[2,16],14:[2,16],22:[2,16]},{1:[2,17],12:[2,17],14:[2,17],22:[2,17]},{1:[2,18],12:[2,18],14:[2,18],22:[2,18]},{1:[2,2],7:22,8:12,9:13,10:14,11:15,12:[1,18],14:[1,19],20:16,21:17,22:[1,20]},{1:[2,5],12:[2,5],14:[2,5],22:[2,5]},{1:[2,7],12:[2,7],14:[2,7],22:[2,7]},{1:[2,8],12:[2,8],14:[2,8],22:[2,8]},{1:[2,9],12:[2,9],14:[2,9],22:[2,9]},{1:[2,10],12:[2,10],14:[2,10],22:[2,10]},{1:[2,19],12:[2,19],14:[2,19],22:[2,19]},{1:[2,20],12:[2,20],14:[2,20],22:[2,20]},{13:23,15:[1,5],16:[1,6],17:[1,7],18:[1,8],19:[1,9]},{13:24,15:[1,5],16:[1,6],17:[1,7],18:[1,8],19:[1,9],22:[1,25]},{15:[1,29],17:[1,30],18:[1,33],23:26,25:27,26:28,27:32,29:34,30:[1,35],31:[1,31],32:[1,36],33:[1,37]},{1:[2,4],7:22,8:12,9:13,10:14,11:15,12:[1,18],14:[1,19],20:16,21:17,22:[1,20]},{1:[2,6],12:[2,6],14:[2,6],22:[2,6]},{1:[2,11],12:[2,11],14:[2,11],22:[2,11]},{1:[2,13],12:[2,13],14:[2,13],22:[2,13]},{15:[1,29],17:[1,30],18:[1,33],23:38,25:27,26:28,27:32,29:34,30:[1,35],31:[1,31],32:[1,36],33:[1,37]},{24:[1,39]},{24:[2,23]},{24:[2,24],28:[1,40]},{24:[2,30]},{24:[2,31]},{24:[2,32]},{24:[2,25],28:[2,25]},{24:[2,27],28:[2,27]},{24:[2,28],28:[2,28]},{24:[2,29],28:[2,29]},{24:[2,33],28:[2,33]},{24:[2,34],28:[2,34]},{24:[1,41]},{1:[2,21],12:[2,21],14:[2,21],22:[2,21]},{18:[1,33],27:42,29:34,30:[1,35],32:[1,36],33:[1,37]},{1:[2,22],12:[2,22],14:[2,22],22:[2,22]},{24:[2,26],28:[2,26]}],
|
||||
defaultActions: {27:[2,23],29:[2,30],30:[2,31],31:[2,32]},
|
||||
parseError: function parseError(str, hash) {
|
||||
if (hash.recoverable) {
|
||||
this.trace(str);
|
||||
} else {
|
||||
throw new Error(str);
|
||||
}
|
||||
},
|
||||
parse: function parse(input) {
|
||||
var self = this, stack = [0], vstack = [null], lstack = [], table = this.table, yytext = '', yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1;
|
||||
var args = lstack.slice.call(arguments, 1);
|
||||
this.lexer.setInput(input);
|
||||
this.lexer.yy = this.yy;
|
||||
this.yy.lexer = this.lexer;
|
||||
this.yy.parser = this;
|
||||
if (typeof this.lexer.yylloc == 'undefined') {
|
||||
this.lexer.yylloc = {};
|
||||
}
|
||||
var yyloc = this.lexer.yylloc;
|
||||
lstack.push(yyloc);
|
||||
var ranges = this.lexer.options && this.lexer.options.ranges;
|
||||
if (typeof this.yy.parseError === 'function') {
|
||||
this.parseError = this.yy.parseError;
|
||||
} else {
|
||||
this.parseError = Object.getPrototypeOf(this).parseError;
|
||||
}
|
||||
function popStack(n) {
|
||||
stack.length = stack.length - 2 * n;
|
||||
vstack.length = vstack.length - n;
|
||||
lstack.length = lstack.length - n;
|
||||
}
|
||||
function lex() {
|
||||
var token;
|
||||
token = self.lexer.lex() || EOF;
|
||||
if (typeof token !== 'number') {
|
||||
token = self.symbols_[token] || token;
|
||||
}
|
||||
return token;
|
||||
}
|
||||
var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected;
|
||||
while (true) {
|
||||
state = stack[stack.length - 1];
|
||||
if (this.defaultActions[state]) {
|
||||
action = this.defaultActions[state];
|
||||
} else {
|
||||
if (symbol === null || typeof symbol == 'undefined') {
|
||||
symbol = lex();
|
||||
}
|
||||
action = table[state] && table[state][symbol];
|
||||
}
|
||||
if (typeof action === 'undefined' || !action.length || !action[0]) {
|
||||
var errStr = '';
|
||||
expected = [];
|
||||
for (p in table[state]) {
|
||||
if (this.terminals_[p] && p > TERROR) {
|
||||
expected.push('\'' + this.terminals_[p] + '\'');
|
||||
}
|
||||
}
|
||||
if (this.lexer.showPosition) {
|
||||
errStr = 'Parse error on line ' + (yylineno + 1) + ':\n' + this.lexer.showPosition() + '\nExpecting ' + expected.join(', ') + ', got \'' + (this.terminals_[symbol] || symbol) + '\'';
|
||||
} else {
|
||||
errStr = 'Parse error on line ' + (yylineno + 1) + ': Unexpected ' + (symbol == EOF ? 'end of input' : '\'' + (this.terminals_[symbol] || symbol) + '\'');
|
||||
}
|
||||
this.parseError(errStr, {
|
||||
text: this.lexer.match,
|
||||
token: this.terminals_[symbol] || symbol,
|
||||
line: this.lexer.yylineno,
|
||||
loc: yyloc,
|
||||
expected: expected
|
||||
});
|
||||
}
|
||||
if (action[0] instanceof Array && action.length > 1) {
|
||||
throw new Error('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol);
|
||||
}
|
||||
switch (action[0]) {
|
||||
case 1:
|
||||
stack.push(symbol);
|
||||
vstack.push(this.lexer.yytext);
|
||||
lstack.push(this.lexer.yylloc);
|
||||
stack.push(action[1]);
|
||||
symbol = null;
|
||||
if (!preErrorSymbol) {
|
||||
yyleng = this.lexer.yyleng;
|
||||
yytext = this.lexer.yytext;
|
||||
yylineno = this.lexer.yylineno;
|
||||
yyloc = this.lexer.yylloc;
|
||||
if (recovering > 0) {
|
||||
recovering--;
|
||||
}
|
||||
} else {
|
||||
symbol = preErrorSymbol;
|
||||
preErrorSymbol = null;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
len = this.productions_[action[1]][1];
|
||||
yyval.$ = vstack[vstack.length - len];
|
||||
yyval._$ = {
|
||||
first_line: lstack[lstack.length - (len || 1)].first_line,
|
||||
last_line: lstack[lstack.length - 1].last_line,
|
||||
first_column: lstack[lstack.length - (len || 1)].first_column,
|
||||
last_column: lstack[lstack.length - 1].last_column
|
||||
};
|
||||
if (ranges) {
|
||||
yyval._$.range = [
|
||||
lstack[lstack.length - (len || 1)].range[0],
|
||||
lstack[lstack.length - 1].range[1]
|
||||
];
|
||||
}
|
||||
r = this.performAction.apply(yyval, [
|
||||
yytext,
|
||||
yyleng,
|
||||
yylineno,
|
||||
this.yy,
|
||||
action[1],
|
||||
vstack,
|
||||
lstack
|
||||
].concat(args));
|
||||
if (typeof r !== 'undefined') {
|
||||
return r;
|
||||
}
|
||||
if (len) {
|
||||
stack = stack.slice(0, -1 * len * 2);
|
||||
vstack = vstack.slice(0, -1 * len);
|
||||
lstack = lstack.slice(0, -1 * len);
|
||||
}
|
||||
stack.push(this.productions_[action[1]][0]);
|
||||
vstack.push(yyval.$);
|
||||
lstack.push(yyval._$);
|
||||
newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
|
||||
stack.push(newState);
|
||||
break;
|
||||
case 3:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}};
|
||||
var _ast = {
|
||||
|
||||
initialize: function() {
|
||||
this._nodes = [];
|
||||
this._node = {};
|
||||
this._stash = [];
|
||||
},
|
||||
|
||||
set: function(props) {
|
||||
for (var k in props) this._node[k] = props[k];
|
||||
return this._node;
|
||||
},
|
||||
|
||||
node: function(obj) {
|
||||
if (arguments.length) this._node = obj;
|
||||
return this._node;
|
||||
},
|
||||
|
||||
push: function() {
|
||||
this._nodes.push(this._node);
|
||||
this._node = {};
|
||||
},
|
||||
|
||||
unshift: function() {
|
||||
this._nodes.unshift(this._node);
|
||||
this._node = {};
|
||||
},
|
||||
|
||||
yield: function() {
|
||||
var _nodes = this._nodes;
|
||||
this.initialize();
|
||||
return _nodes;
|
||||
}
|
||||
};
|
||||
/* generated by jison-lex 0.2.1 */
|
||||
var lexer = (function(){
|
||||
var lexer = {
|
||||
|
||||
EOF:1,
|
||||
|
||||
parseError:function parseError(str, hash) {
|
||||
if (this.yy.parser) {
|
||||
this.yy.parser.parseError(str, hash);
|
||||
} else {
|
||||
throw new Error(str);
|
||||
}
|
||||
},
|
||||
|
||||
// resets the lexer, sets new input
|
||||
setInput:function (input) {
|
||||
this._input = input;
|
||||
this._more = this._backtrack = this.done = false;
|
||||
this.yylineno = this.yyleng = 0;
|
||||
this.yytext = this.matched = this.match = '';
|
||||
this.conditionStack = ['INITIAL'];
|
||||
this.yylloc = {
|
||||
first_line: 1,
|
||||
first_column: 0,
|
||||
last_line: 1,
|
||||
last_column: 0
|
||||
};
|
||||
if (this.options.ranges) {
|
||||
this.yylloc.range = [0,0];
|
||||
}
|
||||
this.offset = 0;
|
||||
return this;
|
||||
},
|
||||
|
||||
// consumes and returns one char from the input
|
||||
input:function () {
|
||||
var ch = this._input[0];
|
||||
this.yytext += ch;
|
||||
this.yyleng++;
|
||||
this.offset++;
|
||||
this.match += ch;
|
||||
this.matched += ch;
|
||||
var lines = ch.match(/(?:\r\n?|\n).*/g);
|
||||
if (lines) {
|
||||
this.yylineno++;
|
||||
this.yylloc.last_line++;
|
||||
} else {
|
||||
this.yylloc.last_column++;
|
||||
}
|
||||
if (this.options.ranges) {
|
||||
this.yylloc.range[1]++;
|
||||
}
|
||||
|
||||
this._input = this._input.slice(1);
|
||||
return ch;
|
||||
},
|
||||
|
||||
// unshifts one char (or a string) into the input
|
||||
unput:function (ch) {
|
||||
var len = ch.length;
|
||||
var lines = ch.split(/(?:\r\n?|\n)/g);
|
||||
|
||||
this._input = ch + this._input;
|
||||
this.yytext = this.yytext.substr(0, this.yytext.length - len - 1);
|
||||
//this.yyleng -= len;
|
||||
this.offset -= len;
|
||||
var oldLines = this.match.split(/(?:\r\n?|\n)/g);
|
||||
this.match = this.match.substr(0, this.match.length - 1);
|
||||
this.matched = this.matched.substr(0, this.matched.length - 1);
|
||||
|
||||
if (lines.length - 1) {
|
||||
this.yylineno -= lines.length - 1;
|
||||
}
|
||||
var r = this.yylloc.range;
|
||||
|
||||
this.yylloc = {
|
||||
first_line: this.yylloc.first_line,
|
||||
last_line: this.yylineno + 1,
|
||||
first_column: this.yylloc.first_column,
|
||||
last_column: lines ?
|
||||
(lines.length === oldLines.length ? this.yylloc.first_column : 0)
|
||||
+ oldLines[oldLines.length - lines.length].length - lines[0].length :
|
||||
this.yylloc.first_column - len
|
||||
};
|
||||
|
||||
if (this.options.ranges) {
|
||||
this.yylloc.range = [r[0], r[0] + this.yyleng - len];
|
||||
}
|
||||
this.yyleng = this.yytext.length;
|
||||
return this;
|
||||
},
|
||||
|
||||
// When called from action, caches matched text and appends it on next action
|
||||
more:function () {
|
||||
this._more = true;
|
||||
return this;
|
||||
},
|
||||
|
||||
// When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead.
|
||||
reject:function () {
|
||||
if (this.options.backtrack_lexer) {
|
||||
this._backtrack = true;
|
||||
} else {
|
||||
return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n' + this.showPosition(), {
|
||||
text: "",
|
||||
token: null,
|
||||
line: this.yylineno
|
||||
});
|
||||
|
||||
}
|
||||
return this;
|
||||
},
|
||||
|
||||
// retain first n characters of the match
|
||||
less:function (n) {
|
||||
this.unput(this.match.slice(n));
|
||||
},
|
||||
|
||||
// displays already matched input, i.e. for error messages
|
||||
pastInput:function () {
|
||||
var past = this.matched.substr(0, this.matched.length - this.match.length);
|
||||
return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\n/g, "");
|
||||
},
|
||||
|
||||
// displays upcoming input, i.e. for error messages
|
||||
upcomingInput:function () {
|
||||
var next = this.match;
|
||||
if (next.length < 20) {
|
||||
next += this._input.substr(0, 20-next.length);
|
||||
}
|
||||
return (next.substr(0,20) + (next.length > 20 ? '...' : '')).replace(/\n/g, "");
|
||||
},
|
||||
|
||||
// displays the character position where the lexing error occurred, i.e. for error messages
|
||||
showPosition:function () {
|
||||
var pre = this.pastInput();
|
||||
var c = new Array(pre.length + 1).join("-");
|
||||
return pre + this.upcomingInput() + "\n" + c + "^";
|
||||
},
|
||||
|
||||
// test the lexed token: return FALSE when not a match, otherwise return token
|
||||
test_match:function (match, indexed_rule) {
|
||||
var token,
|
||||
lines,
|
||||
backup;
|
||||
|
||||
if (this.options.backtrack_lexer) {
|
||||
// save context
|
||||
backup = {
|
||||
yylineno: this.yylineno,
|
||||
yylloc: {
|
||||
first_line: this.yylloc.first_line,
|
||||
last_line: this.last_line,
|
||||
first_column: this.yylloc.first_column,
|
||||
last_column: this.yylloc.last_column
|
||||
},
|
||||
yytext: this.yytext,
|
||||
match: this.match,
|
||||
matches: this.matches,
|
||||
matched: this.matched,
|
||||
yyleng: this.yyleng,
|
||||
offset: this.offset,
|
||||
_more: this._more,
|
||||
_input: this._input,
|
||||
yy: this.yy,
|
||||
conditionStack: this.conditionStack.slice(0),
|
||||
done: this.done
|
||||
};
|
||||
if (this.options.ranges) {
|
||||
backup.yylloc.range = this.yylloc.range.slice(0);
|
||||
}
|
||||
}
|
||||
|
||||
lines = match[0].match(/(?:\r\n?|\n).*/g);
|
||||
if (lines) {
|
||||
this.yylineno += lines.length;
|
||||
}
|
||||
this.yylloc = {
|
||||
first_line: this.yylloc.last_line,
|
||||
last_line: this.yylineno + 1,
|
||||
first_column: this.yylloc.last_column,
|
||||
last_column: lines ?
|
||||
lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length :
|
||||
this.yylloc.last_column + match[0].length
|
||||
};
|
||||
this.yytext += match[0];
|
||||
this.match += match[0];
|
||||
this.matches = match;
|
||||
this.yyleng = this.yytext.length;
|
||||
if (this.options.ranges) {
|
||||
this.yylloc.range = [this.offset, this.offset += this.yyleng];
|
||||
}
|
||||
this._more = false;
|
||||
this._backtrack = false;
|
||||
this._input = this._input.slice(match[0].length);
|
||||
this.matched += match[0];
|
||||
token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
|
||||
if (this.done && this._input) {
|
||||
this.done = false;
|
||||
}
|
||||
if (token) {
|
||||
return token;
|
||||
} else if (this._backtrack) {
|
||||
// recover context
|
||||
for (var k in backup) {
|
||||
this[k] = backup[k];
|
||||
}
|
||||
return false; // rule action called reject() implying the next rule should be tested instead.
|
||||
}
|
||||
return false;
|
||||
},
|
||||
|
||||
// return next match in input
|
||||
next:function () {
|
||||
if (this.done) {
|
||||
return this.EOF;
|
||||
}
|
||||
if (!this._input) {
|
||||
this.done = true;
|
||||
}
|
||||
|
||||
var token,
|
||||
match,
|
||||
tempMatch,
|
||||
index;
|
||||
if (!this._more) {
|
||||
this.yytext = '';
|
||||
this.match = '';
|
||||
}
|
||||
var rules = this._currentRules();
|
||||
for (var i = 0; i < rules.length; i++) {
|
||||
tempMatch = this._input.match(this.rules[rules[i]]);
|
||||
if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
|
||||
match = tempMatch;
|
||||
index = i;
|
||||
if (this.options.backtrack_lexer) {
|
||||
token = this.test_match(tempMatch, rules[i]);
|
||||
if (token !== false) {
|
||||
return token;
|
||||
} else if (this._backtrack) {
|
||||
match = false;
|
||||
continue; // rule action called reject() implying a rule MISmatch.
|
||||
} else {
|
||||
// else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)
|
||||
return false;
|
||||
}
|
||||
} else if (!this.options.flex) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (match) {
|
||||
token = this.test_match(match, rules[index]);
|
||||
if (token !== false) {
|
||||
return token;
|
||||
}
|
||||
// else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)
|
||||
return false;
|
||||
}
|
||||
if (this._input === "") {
|
||||
return this.EOF;
|
||||
} else {
|
||||
return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), {
|
||||
text: "",
|
||||
token: null,
|
||||
line: this.yylineno
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
// return next match that has a token
|
||||
lex:function lex() {
|
||||
var r = this.next();
|
||||
if (r) {
|
||||
return r;
|
||||
} else {
|
||||
return this.lex();
|
||||
}
|
||||
},
|
||||
|
||||
// activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
|
||||
begin:function begin(condition) {
|
||||
this.conditionStack.push(condition);
|
||||
},
|
||||
|
||||
// pop the previously active lexer condition state off the condition stack
|
||||
popState:function popState() {
|
||||
var n = this.conditionStack.length - 1;
|
||||
if (n > 0) {
|
||||
return this.conditionStack.pop();
|
||||
} else {
|
||||
return this.conditionStack[0];
|
||||
}
|
||||
},
|
||||
|
||||
// produce the lexer rule set which is active for the currently active lexer condition state
|
||||
_currentRules:function _currentRules() {
|
||||
if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
|
||||
return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
|
||||
} else {
|
||||
return this.conditions["INITIAL"].rules;
|
||||
}
|
||||
},
|
||||
|
||||
// return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
|
||||
topState:function topState(n) {
|
||||
n = this.conditionStack.length - 1 - Math.abs(n || 0);
|
||||
if (n >= 0) {
|
||||
return this.conditionStack[n];
|
||||
} else {
|
||||
return "INITIAL";
|
||||
}
|
||||
},
|
||||
|
||||
// alias for begin(condition)
|
||||
pushState:function pushState(condition) {
|
||||
this.begin(condition);
|
||||
},
|
||||
|
||||
// return the number of states currently on the stack
|
||||
stateStackSize:function stateStackSize() {
|
||||
return this.conditionStack.length;
|
||||
},
|
||||
options: {},
|
||||
performAction: function anonymous(yy,yy_,$avoiding_name_collisions,YY_START
|
||||
/**/) {
|
||||
|
||||
var YYSTATE=YY_START;
|
||||
switch($avoiding_name_collisions) {
|
||||
case 0:return 4
|
||||
break;
|
||||
case 1:return 14
|
||||
break;
|
||||
case 2:return 12
|
||||
break;
|
||||
case 3:return 15
|
||||
break;
|
||||
case 4:return 16
|
||||
break;
|
||||
case 5:return 22
|
||||
break;
|
||||
case 6:return 24
|
||||
break;
|
||||
case 7:return 28
|
||||
break;
|
||||
case 8:return 30
|
||||
break;
|
||||
case 9:return 18
|
||||
break;
|
||||
case 10:yy_.yytext = yy_.yytext.substr(1,yy_.yyleng-2); return 32;
|
||||
break;
|
||||
case 11:yy_.yytext = yy_.yytext.substr(1,yy_.yyleng-2); return 33;
|
||||
break;
|
||||
case 12:return 17
|
||||
break;
|
||||
case 13:return 31
|
||||
break;
|
||||
}
|
||||
},
|
||||
rules: [/^(?:\$)/,/^(?:\.\.)/,/^(?:\.)/,/^(?:\*)/,/^(?:[a-zA-Z_]+[a-zA-Z0-9_]*)/,/^(?:\[)/,/^(?:\])/,/^(?:,)/,/^(?:((-?(?:0|[1-9][0-9]*)))?\:((-?(?:0|[1-9][0-9]*)))?(\:((-?(?:0|[1-9][0-9]*)))?)?)/,/^(?:(-?(?:0|[1-9][0-9]*)))/,/^(?:"(?:\\["bfnrt/\\]|\\u[a-fA-F0-9]{4}|[^"\\])*")/,/^(?:'(?:\\['bfnrt/\\]|\\u[a-fA-F0-9]{4}|[^'\\])*')/,/^(?:\(.+?\)(?=\]))/,/^(?:\?\(.+?\)(?=\]))/],
|
||||
conditions: {"INITIAL":{"rules":[0,1,2,3,4,5,6,7,8,9,10,11,12,13],"inclusive":true}}
|
||||
};
|
||||
return lexer;
|
||||
})();
|
||||
parser.lexer = lexer;
|
||||
function Parser () {
|
||||
this.yy = {};
|
||||
}
|
||||
Parser.prototype = parser;parser.Parser = Parser;
|
||||
return new Parser;
|
||||
})();
|
||||
|
||||
|
||||
if (typeof require !== 'undefined' && typeof exports !== 'undefined') {
|
||||
exports.parser = parser;
|
||||
exports.Parser = parser.Parser;
|
||||
exports.parse = function () { return parser.parse.apply(parser, arguments); };
|
||||
exports.main = function commonjsMain(args) {
|
||||
if (!args[1]) {
|
||||
console.log('Usage: '+args[0]+' FILE');
|
||||
process.exit(1);
|
||||
}
|
||||
var source = require('fs').readFileSync(require('path').normalize(args[1]), "utf8");
|
||||
return exports.parser.parse(source);
|
||||
};
|
||||
if (typeof module !== 'undefined' && require.main === module) {
|
||||
exports.main(process.argv.slice(1));
|
||||
}
|
||||
}
|
4
node_modules/jsonpath/include/action.js
generated
vendored
Normal file
4
node_modules/jsonpath/include/action.js
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
if (!yy.ast) {
|
||||
yy.ast = _ast;
|
||||
_ast.initialize();
|
||||
}
|
34
node_modules/jsonpath/include/module.js
generated
vendored
Normal file
34
node_modules/jsonpath/include/module.js
generated
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
var _ast = {
|
||||
|
||||
initialize: function() {
|
||||
this._nodes = [];
|
||||
this._node = {};
|
||||
this._stash = [];
|
||||
},
|
||||
|
||||
set: function(props) {
|
||||
for (var k in props) this._node[k] = props[k];
|
||||
return this._node;
|
||||
},
|
||||
|
||||
node: function(obj) {
|
||||
if (arguments.length) this._node = obj;
|
||||
return this._node;
|
||||
},
|
||||
|
||||
push: function() {
|
||||
this._nodes.push(this._node);
|
||||
this._node = {};
|
||||
},
|
||||
|
||||
unshift: function() {
|
||||
this._nodes.unshift(this._node);
|
||||
this._node = {};
|
||||
},
|
||||
|
||||
yield: function() {
|
||||
var _nodes = this._nodes;
|
||||
this.initialize();
|
||||
return _nodes;
|
||||
}
|
||||
};
|
1
node_modules/jsonpath/index.js
generated
vendored
Normal file
1
node_modules/jsonpath/index.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = require('./lib/index');
|
6842
node_modules/jsonpath/jsonpath.js
generated
vendored
Normal file
6842
node_modules/jsonpath/jsonpath.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
4
node_modules/jsonpath/jsonpath.min.js
generated
vendored
Normal file
4
node_modules/jsonpath/jsonpath.min.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
18
node_modules/jsonpath/lib/aesprim.js
generated
vendored
Normal file
18
node_modules/jsonpath/lib/aesprim.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
var fs = require('fs');
|
||||
var Module = require('module');
|
||||
|
||||
var file = require.resolve('esprima');
|
||||
var source = fs.readFileSync(file, 'utf-8');
|
||||
|
||||
// inject '@' as a valid identifier!
|
||||
source = source.replace(/(function isIdentifierStart\(ch\) {\s+return)/m, '$1 (ch == 0x40) || ');
|
||||
|
||||
//If run as script just output patched file
|
||||
if (require.main === module)
|
||||
console.log(source);
|
||||
else {
|
||||
var _module = new Module('aesprim');
|
||||
_module._compile(source, __filename);
|
||||
|
||||
module.exports = _module.exports;
|
||||
}
|
6
node_modules/jsonpath/lib/dict.js
generated
vendored
Normal file
6
node_modules/jsonpath/lib/dict.js
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
module.exports = {
|
||||
identifier: "[a-zA-Z_]+[a-zA-Z0-9_]*",
|
||||
integer: "-?(?:0|[1-9][0-9]*)",
|
||||
qq_string: "\"(?:\\\\[\"bfnrt/\\\\]|\\\\u[a-fA-F0-9]{4}|[^\"\\\\])*\"",
|
||||
q_string: "'(?:\\\\[\'bfnrt/\\\\]|\\\\u[a-fA-F0-9]{4}|[^\'\\\\])*'"
|
||||
};
|
106
node_modules/jsonpath/lib/grammar.js
generated
vendored
Normal file
106
node_modules/jsonpath/lib/grammar.js
generated
vendored
Normal file
@@ -0,0 +1,106 @@
|
||||
var dict = require('./dict');
|
||||
var fs = require('fs');
|
||||
var grammar = {
|
||||
|
||||
lex: {
|
||||
|
||||
macros: {
|
||||
esc: "\\\\",
|
||||
int: dict.integer
|
||||
},
|
||||
|
||||
rules: [
|
||||
["\\$", "return 'DOLLAR'"],
|
||||
["\\.\\.", "return 'DOT_DOT'"],
|
||||
["\\.", "return 'DOT'"],
|
||||
["\\*", "return 'STAR'"],
|
||||
[dict.identifier, "return 'IDENTIFIER'"],
|
||||
["\\[", "return '['"],
|
||||
["\\]", "return ']'"],
|
||||
[",", "return ','"],
|
||||
["({int})?\\:({int})?(\\:({int})?)?", "return 'ARRAY_SLICE'"],
|
||||
["{int}", "return 'INTEGER'"],
|
||||
[dict.qq_string, "yytext = yytext.substr(1,yyleng-2); return 'QQ_STRING';"],
|
||||
[dict.q_string, "yytext = yytext.substr(1,yyleng-2); return 'Q_STRING';"],
|
||||
["\\(.+?\\)(?=\\])", "return 'SCRIPT_EXPRESSION'"],
|
||||
["\\?\\(.+?\\)(?=\\])", "return 'FILTER_EXPRESSION'"]
|
||||
]
|
||||
},
|
||||
|
||||
start: "JSON_PATH",
|
||||
|
||||
bnf: {
|
||||
|
||||
JSON_PATH: [
|
||||
[ 'DOLLAR', 'yy.ast.set({ expression: { type: "root", value: $1 } }); yy.ast.unshift(); return yy.ast.yield()' ],
|
||||
[ 'DOLLAR PATH_COMPONENTS', 'yy.ast.set({ expression: { type: "root", value: $1 } }); yy.ast.unshift(); return yy.ast.yield()' ],
|
||||
[ 'LEADING_CHILD_MEMBER_EXPRESSION', 'yy.ast.unshift(); return yy.ast.yield()' ],
|
||||
[ 'LEADING_CHILD_MEMBER_EXPRESSION PATH_COMPONENTS', 'yy.ast.set({ operation: "member", scope: "child", expression: { type: "identifier", value: $1 }}); yy.ast.unshift(); return yy.ast.yield()' ] ],
|
||||
|
||||
PATH_COMPONENTS: [
|
||||
[ 'PATH_COMPONENT', '' ],
|
||||
[ 'PATH_COMPONENTS PATH_COMPONENT', '' ] ],
|
||||
|
||||
PATH_COMPONENT: [
|
||||
[ 'MEMBER_COMPONENT', 'yy.ast.set({ operation: "member" }); yy.ast.push()' ],
|
||||
[ 'SUBSCRIPT_COMPONENT', 'yy.ast.set({ operation: "subscript" }); yy.ast.push() ' ] ],
|
||||
|
||||
MEMBER_COMPONENT: [
|
||||
[ 'CHILD_MEMBER_COMPONENT', 'yy.ast.set({ scope: "child" })' ],
|
||||
[ 'DESCENDANT_MEMBER_COMPONENT', 'yy.ast.set({ scope: "descendant" })' ] ],
|
||||
|
||||
CHILD_MEMBER_COMPONENT: [
|
||||
[ 'DOT MEMBER_EXPRESSION', '' ] ],
|
||||
|
||||
LEADING_CHILD_MEMBER_EXPRESSION: [
|
||||
[ 'MEMBER_EXPRESSION', 'yy.ast.set({ scope: "child", operation: "member" })' ] ],
|
||||
|
||||
DESCENDANT_MEMBER_COMPONENT: [
|
||||
[ 'DOT_DOT MEMBER_EXPRESSION', '' ] ],
|
||||
|
||||
MEMBER_EXPRESSION: [
|
||||
[ 'STAR', 'yy.ast.set({ expression: { type: "wildcard", value: $1 } })' ],
|
||||
[ 'IDENTIFIER', 'yy.ast.set({ expression: { type: "identifier", value: $1 } })' ],
|
||||
[ 'SCRIPT_EXPRESSION', 'yy.ast.set({ expression: { type: "script_expression", value: $1 } })' ],
|
||||
[ 'INTEGER', 'yy.ast.set({ expression: { type: "numeric_literal", value: parseInt($1) } })' ],
|
||||
[ 'END', '' ] ],
|
||||
|
||||
SUBSCRIPT_COMPONENT: [
|
||||
[ 'CHILD_SUBSCRIPT_COMPONENT', 'yy.ast.set({ scope: "child" })' ],
|
||||
[ 'DESCENDANT_SUBSCRIPT_COMPONENT', 'yy.ast.set({ scope: "descendant" })' ] ],
|
||||
|
||||
CHILD_SUBSCRIPT_COMPONENT: [
|
||||
[ '[ SUBSCRIPT ]', '' ] ],
|
||||
|
||||
DESCENDANT_SUBSCRIPT_COMPONENT: [
|
||||
[ 'DOT_DOT [ SUBSCRIPT ]', '' ] ],
|
||||
|
||||
SUBSCRIPT: [
|
||||
[ 'SUBSCRIPT_EXPRESSION', '' ],
|
||||
[ 'SUBSCRIPT_EXPRESSION_LIST', '$1.length > 1? yy.ast.set({ expression: { type: "union", value: $1 } }) : $$ = $1' ] ],
|
||||
|
||||
SUBSCRIPT_EXPRESSION_LIST: [
|
||||
[ 'SUBSCRIPT_EXPRESSION_LISTABLE', '$$ = [$1]'],
|
||||
[ 'SUBSCRIPT_EXPRESSION_LIST , SUBSCRIPT_EXPRESSION_LISTABLE', '$$ = $1.concat($3)' ] ],
|
||||
|
||||
SUBSCRIPT_EXPRESSION_LISTABLE: [
|
||||
[ 'INTEGER', '$$ = { expression: { type: "numeric_literal", value: parseInt($1) } }; yy.ast.set($$)' ],
|
||||
[ 'STRING_LITERAL', '$$ = { expression: { type: "string_literal", value: $1 } }; yy.ast.set($$)' ],
|
||||
[ 'ARRAY_SLICE', '$$ = { expression: { type: "slice", value: $1 } }; yy.ast.set($$)' ] ],
|
||||
|
||||
SUBSCRIPT_EXPRESSION: [
|
||||
[ 'STAR', '$$ = { expression: { type: "wildcard", value: $1 } }; yy.ast.set($$)' ],
|
||||
[ 'SCRIPT_EXPRESSION', '$$ = { expression: { type: "script_expression", value: $1 } }; yy.ast.set($$)' ],
|
||||
[ 'FILTER_EXPRESSION', '$$ = { expression: { type: "filter_expression", value: $1 } }; yy.ast.set($$)' ] ],
|
||||
|
||||
STRING_LITERAL: [
|
||||
[ 'QQ_STRING', "$$ = $1" ],
|
||||
[ 'Q_STRING', "$$ = $1" ] ]
|
||||
}
|
||||
};
|
||||
if (fs.readFileSync) {
|
||||
grammar.moduleInclude = fs.readFileSync(require.resolve("../include/module.js"));
|
||||
grammar.actionInclude = fs.readFileSync(require.resolve("../include/action.js"));
|
||||
}
|
||||
|
||||
module.exports = grammar;
|
260
node_modules/jsonpath/lib/handlers.js
generated
vendored
Normal file
260
node_modules/jsonpath/lib/handlers.js
generated
vendored
Normal file
@@ -0,0 +1,260 @@
|
||||
var aesprim = require('./aesprim');
|
||||
var slice = require('./slice');
|
||||
var _evaluate = require('static-eval');
|
||||
var _uniq = require('underscore').uniq;
|
||||
|
||||
var Handlers = function() {
|
||||
return this.initialize.apply(this, arguments);
|
||||
}
|
||||
|
||||
Handlers.prototype.initialize = function() {
|
||||
this.traverse = traverser(true);
|
||||
this.descend = traverser();
|
||||
}
|
||||
|
||||
Handlers.prototype.keys = Object.keys;
|
||||
|
||||
Handlers.prototype.resolve = function(component) {
|
||||
|
||||
var key = [ component.operation, component.scope, component.expression.type ].join('-');
|
||||
var method = this._fns[key];
|
||||
|
||||
if (!method) throw new Error("couldn't resolve key: " + key);
|
||||
return method.bind(this);
|
||||
};
|
||||
|
||||
Handlers.prototype.register = function(key, handler) {
|
||||
|
||||
if (!handler instanceof Function) {
|
||||
throw new Error("handler must be a function");
|
||||
}
|
||||
|
||||
this._fns[key] = handler;
|
||||
};
|
||||
|
||||
Handlers.prototype._fns = {
|
||||
|
||||
'member-child-identifier': function(component, partial) {
|
||||
var key = component.expression.value;
|
||||
var value = partial.value;
|
||||
if (value instanceof Object && key in value) {
|
||||
return [ { value: value[key], path: partial.path.concat(key) } ]
|
||||
}
|
||||
},
|
||||
|
||||
'member-descendant-identifier':
|
||||
_traverse(function(key, value, ref) { return key == ref }),
|
||||
|
||||
'subscript-child-numeric_literal':
|
||||
_descend(function(key, value, ref) { return key === ref }),
|
||||
|
||||
'member-child-numeric_literal':
|
||||
_descend(function(key, value, ref) { return String(key) === String(ref) }),
|
||||
|
||||
'subscript-descendant-numeric_literal':
|
||||
_traverse(function(key, value, ref) { return key === ref }),
|
||||
|
||||
'member-child-wildcard':
|
||||
_descend(function() { return true }),
|
||||
|
||||
'member-descendant-wildcard':
|
||||
_traverse(function() { return true }),
|
||||
|
||||
'subscript-descendant-wildcard':
|
||||
_traverse(function() { return true }),
|
||||
|
||||
'subscript-child-wildcard':
|
||||
_descend(function() { return true }),
|
||||
|
||||
'subscript-child-slice': function(component, partial) {
|
||||
if (is_array(partial.value)) {
|
||||
var args = component.expression.value.split(':').map(_parse_nullable_int);
|
||||
var values = partial.value.map(function(v, i) { return { value: v, path: partial.path.concat(i) } });
|
||||
return slice.apply(null, [values].concat(args));
|
||||
}
|
||||
},
|
||||
|
||||
'subscript-child-union': function(component, partial) {
|
||||
var results = [];
|
||||
component.expression.value.forEach(function(component) {
|
||||
var _component = { operation: 'subscript', scope: 'child', expression: component.expression };
|
||||
var handler = this.resolve(_component);
|
||||
var _results = handler(_component, partial);
|
||||
if (_results) {
|
||||
results = results.concat(_results);
|
||||
}
|
||||
}, this);
|
||||
|
||||
return unique(results);
|
||||
},
|
||||
|
||||
'subscript-descendant-union': function(component, partial, count) {
|
||||
|
||||
var jp = require('..');
|
||||
var self = this;
|
||||
|
||||
var results = [];
|
||||
var nodes = jp.nodes(partial, '$..*').slice(1);
|
||||
|
||||
nodes.forEach(function(node) {
|
||||
if (results.length >= count) return;
|
||||
component.expression.value.forEach(function(component) {
|
||||
var _component = { operation: 'subscript', scope: 'child', expression: component.expression };
|
||||
var handler = self.resolve(_component);
|
||||
var _results = handler(_component, node);
|
||||
results = results.concat(_results);
|
||||
});
|
||||
});
|
||||
|
||||
return unique(results);
|
||||
},
|
||||
|
||||
'subscript-child-filter_expression': function(component, partial, count) {
|
||||
|
||||
// slice out the expression from ?(expression)
|
||||
var src = component.expression.value.slice(2, -1);
|
||||
var ast = aesprim.parse(src).body[0].expression;
|
||||
|
||||
var passable = function(key, value) {
|
||||
return evaluate(ast, { '@': value });
|
||||
}
|
||||
|
||||
return this.descend(partial, null, passable, count);
|
||||
|
||||
},
|
||||
|
||||
'subscript-descendant-filter_expression': function(component, partial, count) {
|
||||
|
||||
// slice out the expression from ?(expression)
|
||||
var src = component.expression.value.slice(2, -1);
|
||||
var ast = aesprim.parse(src).body[0].expression;
|
||||
|
||||
var passable = function(key, value) {
|
||||
return evaluate(ast, { '@': value });
|
||||
}
|
||||
|
||||
return this.traverse(partial, null, passable, count);
|
||||
},
|
||||
|
||||
'subscript-child-script_expression': function(component, partial) {
|
||||
var exp = component.expression.value.slice(1, -1);
|
||||
return eval_recurse(partial, exp, '$[{{value}}]');
|
||||
},
|
||||
|
||||
'member-child-script_expression': function(component, partial) {
|
||||
var exp = component.expression.value.slice(1, -1);
|
||||
return eval_recurse(partial, exp, '$.{{value}}');
|
||||
},
|
||||
|
||||
'member-descendant-script_expression': function(component, partial) {
|
||||
var exp = component.expression.value.slice(1, -1);
|
||||
return eval_recurse(partial, exp, '$..value');
|
||||
}
|
||||
};
|
||||
|
||||
Handlers.prototype._fns['subscript-child-string_literal'] =
|
||||
Handlers.prototype._fns['member-child-identifier'];
|
||||
|
||||
Handlers.prototype._fns['member-descendant-numeric_literal'] =
|
||||
Handlers.prototype._fns['subscript-descendant-string_literal'] =
|
||||
Handlers.prototype._fns['member-descendant-identifier'];
|
||||
|
||||
function eval_recurse(partial, src, template) {
|
||||
|
||||
var jp = require('./index');
|
||||
var ast = aesprim.parse(src).body[0].expression;
|
||||
var value = evaluate(ast, { '@': partial.value });
|
||||
var path = template.replace(/\{\{\s*value\s*\}\}/g, value);
|
||||
|
||||
var results = jp.nodes(partial.value, path);
|
||||
results.forEach(function(r) {
|
||||
r.path = partial.path.concat(r.path.slice(1));
|
||||
});
|
||||
|
||||
return results;
|
||||
}
|
||||
|
||||
function is_array(val) {
|
||||
return Array.isArray(val);
|
||||
}
|
||||
|
||||
function is_object(val) {
|
||||
// is this a non-array, non-null object?
|
||||
return val && !(val instanceof Array) && val instanceof Object;
|
||||
}
|
||||
|
||||
function traverser(recurse) {
|
||||
|
||||
return function(partial, ref, passable, count) {
|
||||
|
||||
var value = partial.value;
|
||||
var path = partial.path;
|
||||
|
||||
var results = [];
|
||||
|
||||
var descend = function(value, path) {
|
||||
|
||||
if (is_array(value)) {
|
||||
value.forEach(function(element, index) {
|
||||
if (results.length >= count) { return }
|
||||
if (passable(index, element, ref)) {
|
||||
results.push({ path: path.concat(index), value: element });
|
||||
}
|
||||
});
|
||||
value.forEach(function(element, index) {
|
||||
if (results.length >= count) { return }
|
||||
if (recurse) {
|
||||
descend(element, path.concat(index));
|
||||
}
|
||||
});
|
||||
} else if (is_object(value)) {
|
||||
this.keys(value).forEach(function(k) {
|
||||
if (results.length >= count) { return }
|
||||
if (passable(k, value[k], ref)) {
|
||||
results.push({ path: path.concat(k), value: value[k] });
|
||||
}
|
||||
})
|
||||
this.keys(value).forEach(function(k) {
|
||||
if (results.length >= count) { return }
|
||||
if (recurse) {
|
||||
descend(value[k], path.concat(k));
|
||||
}
|
||||
});
|
||||
}
|
||||
}.bind(this);
|
||||
descend(value, path);
|
||||
return results;
|
||||
}
|
||||
}
|
||||
|
||||
function _descend(passable) {
|
||||
return function(component, partial, count) {
|
||||
return this.descend(partial, component.expression.value, passable, count);
|
||||
}
|
||||
}
|
||||
|
||||
function _traverse(passable) {
|
||||
return function(component, partial, count) {
|
||||
return this.traverse(partial, component.expression.value, passable, count);
|
||||
}
|
||||
}
|
||||
|
||||
function evaluate() {
|
||||
try { return _evaluate.apply(this, arguments) }
|
||||
catch (e) { }
|
||||
}
|
||||
|
||||
function unique(results) {
|
||||
results = results.filter(function(d) { return d })
|
||||
return _uniq(
|
||||
results,
|
||||
function(r) { return r.path.map(function(c) { return String(c).replace('-', '--') }).join('-') }
|
||||
);
|
||||
}
|
||||
|
||||
function _parse_nullable_int(val) {
|
||||
var sval = String(val);
|
||||
return sval.match(/^-?[0-9]+$/) ? parseInt(sval) : null;
|
||||
}
|
||||
|
||||
module.exports = Handlers;
|
249
node_modules/jsonpath/lib/index.js
generated
vendored
Normal file
249
node_modules/jsonpath/lib/index.js
generated
vendored
Normal file
@@ -0,0 +1,249 @@
|
||||
var assert = require('assert');
|
||||
var dict = require('./dict');
|
||||
var Parser = require('./parser');
|
||||
var Handlers = require('./handlers');
|
||||
|
||||
var JSONPath = function() {
|
||||
this.initialize.apply(this, arguments);
|
||||
};
|
||||
|
||||
JSONPath.prototype.initialize = function() {
|
||||
this.parser = new Parser();
|
||||
this.handlers = new Handlers();
|
||||
};
|
||||
|
||||
JSONPath.prototype.parse = function(string) {
|
||||
assert.ok(_is_string(string), "we need a path");
|
||||
return this.parser.parse(string);
|
||||
};
|
||||
|
||||
JSONPath.prototype.parent = function(obj, string) {
|
||||
|
||||
assert.ok(obj instanceof Object, "obj needs to be an object");
|
||||
assert.ok(string, "we need a path");
|
||||
|
||||
var node = this.nodes(obj, string)[0];
|
||||
var key = node.path.pop(); /* jshint unused:false */
|
||||
return this.value(obj, node.path);
|
||||
}
|
||||
|
||||
JSONPath.prototype.apply = function(obj, string, fn) {
|
||||
|
||||
assert.ok(obj instanceof Object, "obj needs to be an object");
|
||||
assert.ok(string, "we need a path");
|
||||
assert.equal(typeof fn, "function", "fn needs to be function")
|
||||
|
||||
var nodes = this.nodes(obj, string).sort(function(a, b) {
|
||||
// sort nodes so we apply from the bottom up
|
||||
return b.path.length - a.path.length;
|
||||
});
|
||||
|
||||
nodes.forEach(function(node) {
|
||||
var key = node.path.pop();
|
||||
var parent = this.value(obj, this.stringify(node.path));
|
||||
var val = node.value = fn.call(obj, parent[key]);
|
||||
parent[key] = val;
|
||||
}, this);
|
||||
|
||||
return nodes;
|
||||
}
|
||||
|
||||
JSONPath.prototype.value = function(obj, path, value) {
|
||||
|
||||
assert.ok(obj instanceof Object, "obj needs to be an object");
|
||||
assert.ok(path, "we need a path");
|
||||
|
||||
if (arguments.length >= 3) {
|
||||
var node = this.nodes(obj, path).shift();
|
||||
if (!node) return this._vivify(obj, path, value);
|
||||
var key = node.path.slice(-1).shift();
|
||||
var parent = this.parent(obj, this.stringify(node.path));
|
||||
parent[key] = value;
|
||||
}
|
||||
return this.query(obj, this.stringify(path), 1).shift();
|
||||
}
|
||||
|
||||
JSONPath.prototype._vivify = function(obj, string, value) {
|
||||
|
||||
var self = this;
|
||||
|
||||
assert.ok(obj instanceof Object, "obj needs to be an object");
|
||||
assert.ok(string, "we need a path");
|
||||
|
||||
var path = this.parser.parse(string)
|
||||
.map(function(component) { return component.expression.value });
|
||||
|
||||
var setValue = function(path, value) {
|
||||
var key = path.pop();
|
||||
var node = self.value(obj, path);
|
||||
if (!node) {
|
||||
setValue(path.concat(), typeof key === 'string' ? {} : []);
|
||||
node = self.value(obj, path);
|
||||
}
|
||||
node[key] = value;
|
||||
}
|
||||
setValue(path, value);
|
||||
return this.query(obj, string)[0];
|
||||
}
|
||||
|
||||
JSONPath.prototype.query = function(obj, string, count) {
|
||||
|
||||
assert.ok(obj instanceof Object, "obj needs to be an object");
|
||||
assert.ok(_is_string(string), "we need a path");
|
||||
|
||||
var results = this.nodes(obj, string, count)
|
||||
.map(function(r) { return r.value });
|
||||
|
||||
return results;
|
||||
};
|
||||
|
||||
JSONPath.prototype.paths = function(obj, string, count) {
|
||||
|
||||
assert.ok(obj instanceof Object, "obj needs to be an object");
|
||||
assert.ok(string, "we need a path");
|
||||
|
||||
var results = this.nodes(obj, string, count)
|
||||
.map(function(r) { return r.path });
|
||||
|
||||
return results;
|
||||
};
|
||||
|
||||
JSONPath.prototype.nodes = function(obj, string, count) {
|
||||
|
||||
assert.ok(obj instanceof Object, "obj needs to be an object");
|
||||
assert.ok(string, "we need a path");
|
||||
|
||||
if (count === 0) return [];
|
||||
|
||||
var path = this.parser.parse(string);
|
||||
var handlers = this.handlers;
|
||||
|
||||
var partials = [ { path: ['$'], value: obj } ];
|
||||
var matches = [];
|
||||
|
||||
if (path.length && path[0].expression.type == 'root') path.shift();
|
||||
|
||||
if (!path.length) return partials;
|
||||
|
||||
path.forEach(function(component, index) {
|
||||
|
||||
if (matches.length >= count) return;
|
||||
var handler = handlers.resolve(component);
|
||||
var _partials = [];
|
||||
|
||||
partials.forEach(function(p) {
|
||||
|
||||
if (matches.length >= count) return;
|
||||
var results = handler(component, p, count);
|
||||
|
||||
if (index == path.length - 1) {
|
||||
// if we're through the components we're done
|
||||
matches = matches.concat(results || []);
|
||||
} else {
|
||||
// otherwise accumulate and carry on through
|
||||
_partials = _partials.concat(results || []);
|
||||
}
|
||||
});
|
||||
|
||||
partials = _partials;
|
||||
|
||||
});
|
||||
|
||||
return count ? matches.slice(0, count) : matches;
|
||||
};
|
||||
|
||||
JSONPath.prototype.stringify = function(path) {
|
||||
|
||||
assert.ok(path, "we need a path");
|
||||
|
||||
var string = '$';
|
||||
|
||||
var templates = {
|
||||
'descendant-member': '..{{value}}',
|
||||
'child-member': '.{{value}}',
|
||||
'descendant-subscript': '..[{{value}}]',
|
||||
'child-subscript': '[{{value}}]'
|
||||
};
|
||||
|
||||
path = this._normalize(path);
|
||||
|
||||
path.forEach(function(component) {
|
||||
|
||||
if (component.expression.type == 'root') return;
|
||||
|
||||
var key = [component.scope, component.operation].join('-');
|
||||
var template = templates[key];
|
||||
var value;
|
||||
|
||||
if (component.expression.type == 'string_literal') {
|
||||
value = JSON.stringify(component.expression.value)
|
||||
} else {
|
||||
value = component.expression.value;
|
||||
}
|
||||
|
||||
if (!template) throw new Error("couldn't find template " + key);
|
||||
|
||||
string += template.replace(/{{value}}/, value);
|
||||
});
|
||||
|
||||
return string;
|
||||
}
|
||||
|
||||
JSONPath.prototype._normalize = function(path) {
|
||||
|
||||
assert.ok(path, "we need a path");
|
||||
|
||||
if (typeof path == "string") {
|
||||
|
||||
return this.parser.parse(path);
|
||||
|
||||
} else if (Array.isArray(path) && typeof path[0] == "string") {
|
||||
|
||||
var _path = [ { expression: { type: "root", value: "$" } } ];
|
||||
|
||||
path.forEach(function(component, index) {
|
||||
|
||||
if (component == '$' && index === 0) return;
|
||||
|
||||
if (typeof component == "string" && component.match("^" + dict.identifier + "$")) {
|
||||
|
||||
_path.push({
|
||||
operation: 'member',
|
||||
scope: 'child',
|
||||
expression: { value: component, type: 'identifier' }
|
||||
});
|
||||
|
||||
} else {
|
||||
|
||||
var type = typeof component == "number" ?
|
||||
'numeric_literal' : 'string_literal';
|
||||
|
||||
_path.push({
|
||||
operation: 'subscript',
|
||||
scope: 'child',
|
||||
expression: { value: component, type: type }
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
return _path;
|
||||
|
||||
} else if (Array.isArray(path) && typeof path[0] == "object") {
|
||||
|
||||
return path
|
||||
}
|
||||
|
||||
throw new Error("couldn't understand path " + path);
|
||||
}
|
||||
|
||||
function _is_string(obj) {
|
||||
return Object.prototype.toString.call(obj) == '[object String]';
|
||||
}
|
||||
|
||||
JSONPath.Handlers = Handlers;
|
||||
JSONPath.Parser = Parser;
|
||||
|
||||
var instance = new JSONPath;
|
||||
instance.JSONPath = JSONPath;
|
||||
|
||||
module.exports = instance;
|
21
node_modules/jsonpath/lib/parser.js
generated
vendored
Normal file
21
node_modules/jsonpath/lib/parser.js
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
var grammar = require('./grammar');
|
||||
var gparser = require('../generated/parser');
|
||||
|
||||
var Parser = function() {
|
||||
|
||||
var parser = new gparser.Parser();
|
||||
|
||||
var _parseError = parser.parseError;
|
||||
parser.yy.parseError = function() {
|
||||
if (parser.yy.ast) {
|
||||
parser.yy.ast.initialize();
|
||||
}
|
||||
_parseError.apply(parser, arguments);
|
||||
}
|
||||
|
||||
return parser;
|
||||
|
||||
};
|
||||
|
||||
Parser.grammar = grammar;
|
||||
module.exports = Parser;
|
41
node_modules/jsonpath/lib/slice.js
generated
vendored
Normal file
41
node_modules/jsonpath/lib/slice.js
generated
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
module.exports = function(arr, start, end, step) {
|
||||
|
||||
if (typeof start == 'string') throw new Error("start cannot be a string");
|
||||
if (typeof end == 'string') throw new Error("end cannot be a string");
|
||||
if (typeof step == 'string') throw new Error("step cannot be a string");
|
||||
|
||||
var len = arr.length;
|
||||
|
||||
if (step === 0) throw new Error("step cannot be zero");
|
||||
step = step ? integer(step) : 1;
|
||||
|
||||
// normalize negative values
|
||||
start = start < 0 ? len + start : start;
|
||||
end = end < 0 ? len + end : end;
|
||||
|
||||
// default extents to extents
|
||||
start = integer(start === 0 ? 0 : !start ? (step > 0 ? 0 : len - 1) : start);
|
||||
end = integer(end === 0 ? 0 : !end ? (step > 0 ? len : -1) : end);
|
||||
|
||||
// clamp extents
|
||||
start = step > 0 ? Math.max(0, start) : Math.min(len, start);
|
||||
end = step > 0 ? Math.min(end, len) : Math.max(-1, end);
|
||||
|
||||
// return empty if extents are backwards
|
||||
if (step > 0 && end <= start) return [];
|
||||
if (step < 0 && start <= end) return [];
|
||||
|
||||
var result = [];
|
||||
|
||||
for (var i = start; i != end; i += step) {
|
||||
if ((step < 0 && i <= end) || (step > 0 && i >= end)) break;
|
||||
result.push(arr[i]);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
function integer(val) {
|
||||
return String(val).match(/^[0-9]+$/) ? parseInt(val) :
|
||||
Number.isFinite(val) ? parseInt(val, 10) : 0;
|
||||
}
|
15
node_modules/jsonpath/node_modules/.bin/esparse
generated
vendored
Normal file
15
node_modules/jsonpath/node_modules/.bin/esparse
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
#!/bin/sh
|
||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
||||
|
||||
case `uname` in
|
||||
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
|
||||
esac
|
||||
|
||||
if [ -x "$basedir/node" ]; then
|
||||
"$basedir/node" "$basedir/../esprima/bin/esparse.js" "$@"
|
||||
ret=$?
|
||||
else
|
||||
node "$basedir/../esprima/bin/esparse.js" "$@"
|
||||
ret=$?
|
||||
fi
|
||||
exit $ret
|
17
node_modules/jsonpath/node_modules/.bin/esparse.cmd
generated
vendored
Normal file
17
node_modules/jsonpath/node_modules/.bin/esparse.cmd
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
@ECHO off
|
||||
SETLOCAL
|
||||
CALL :find_dp0
|
||||
|
||||
IF EXIST "%dp0%\node.exe" (
|
||||
SET "_prog=%dp0%\node.exe"
|
||||
) ELSE (
|
||||
SET "_prog=node"
|
||||
SET PATHEXT=%PATHEXT:;.JS;=;%
|
||||
)
|
||||
|
||||
"%_prog%" "%dp0%\..\esprima\bin\esparse.js" %*
|
||||
ENDLOCAL
|
||||
EXIT /b %errorlevel%
|
||||
:find_dp0
|
||||
SET dp0=%~dp0
|
||||
EXIT /b
|
18
node_modules/jsonpath/node_modules/.bin/esparse.ps1
generated
vendored
Normal file
18
node_modules/jsonpath/node_modules/.bin/esparse.ps1
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env pwsh
|
||||
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
|
||||
|
||||
$exe=""
|
||||
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
|
||||
# Fix case when both the Windows and Linux builds of Node
|
||||
# are installed in the same directory
|
||||
$exe=".exe"
|
||||
}
|
||||
$ret=0
|
||||
if (Test-Path "$basedir/node$exe") {
|
||||
& "$basedir/node$exe" "$basedir/../esprima/bin/esparse.js" $args
|
||||
$ret=$LASTEXITCODE
|
||||
} else {
|
||||
& "node$exe" "$basedir/../esprima/bin/esparse.js" $args
|
||||
$ret=$LASTEXITCODE
|
||||
}
|
||||
exit $ret
|
15
node_modules/jsonpath/node_modules/.bin/esvalidate
generated
vendored
Normal file
15
node_modules/jsonpath/node_modules/.bin/esvalidate
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
#!/bin/sh
|
||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
||||
|
||||
case `uname` in
|
||||
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
|
||||
esac
|
||||
|
||||
if [ -x "$basedir/node" ]; then
|
||||
"$basedir/node" "$basedir/../esprima/bin/esvalidate.js" "$@"
|
||||
ret=$?
|
||||
else
|
||||
node "$basedir/../esprima/bin/esvalidate.js" "$@"
|
||||
ret=$?
|
||||
fi
|
||||
exit $ret
|
17
node_modules/jsonpath/node_modules/.bin/esvalidate.cmd
generated
vendored
Normal file
17
node_modules/jsonpath/node_modules/.bin/esvalidate.cmd
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
@ECHO off
|
||||
SETLOCAL
|
||||
CALL :find_dp0
|
||||
|
||||
IF EXIST "%dp0%\node.exe" (
|
||||
SET "_prog=%dp0%\node.exe"
|
||||
) ELSE (
|
||||
SET "_prog=node"
|
||||
SET PATHEXT=%PATHEXT:;.JS;=;%
|
||||
)
|
||||
|
||||
"%_prog%" "%dp0%\..\esprima\bin\esvalidate.js" %*
|
||||
ENDLOCAL
|
||||
EXIT /b %errorlevel%
|
||||
:find_dp0
|
||||
SET dp0=%~dp0
|
||||
EXIT /b
|
18
node_modules/jsonpath/node_modules/.bin/esvalidate.ps1
generated
vendored
Normal file
18
node_modules/jsonpath/node_modules/.bin/esvalidate.ps1
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env pwsh
|
||||
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
|
||||
|
||||
$exe=""
|
||||
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
|
||||
# Fix case when both the Windows and Linux builds of Node
|
||||
# are installed in the same directory
|
||||
$exe=".exe"
|
||||
}
|
||||
$ret=0
|
||||
if (Test-Path "$basedir/node$exe") {
|
||||
& "$basedir/node$exe" "$basedir/../esprima/bin/esvalidate.js" $args
|
||||
$ret=$LASTEXITCODE
|
||||
} else {
|
||||
& "node$exe" "$basedir/../esprima/bin/esvalidate.js" $args
|
||||
$ret=$LASTEXITCODE
|
||||
}
|
||||
exit $ret
|
24
node_modules/jsonpath/node_modules/esprima/README.md
generated
vendored
Normal file
24
node_modules/jsonpath/node_modules/esprima/README.md
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
**Esprima** ([esprima.org](http://esprima.org), BSD license) is a high performance,
|
||||
standard-compliant [ECMAScript](http://www.ecma-international.org/publications/standards/Ecma-262.htm)
|
||||
parser written in ECMAScript (also popularly known as
|
||||
[JavaScript](http://en.wikipedia.org/wiki/JavaScript>JavaScript)).
|
||||
Esprima is created and maintained by [Ariya Hidayat](http://twitter.com/ariyahidayat),
|
||||
with the help of [many contributors](https://github.com/ariya/esprima/contributors).
|
||||
|
||||
### Features
|
||||
|
||||
- Full support for ECMAScript 5.1 ([ECMA-262](http://www.ecma-international.org/publications/standards/Ecma-262.htm))
|
||||
- Sensible [syntax tree format](http://esprima.org/doc/index.html#ast) compatible with Mozilla
|
||||
[Parser AST](https://developer.mozilla.org/en/SpiderMonkey/Parser_API)
|
||||
- Optional tracking of syntax node location (index-based and line-column)
|
||||
- Heavily tested (> 650 [unit tests](http://esprima.org/test/) with [full code coverage](http://esprima.org/test/coverage.html))
|
||||
- [Partial support](http://esprima.org/doc/es6.html) for ECMAScript 6
|
||||
|
||||
Esprima serves as a **building block** for some JavaScript
|
||||
language tools, from [code instrumentation](http://esprima.org/demo/functiontrace.html)
|
||||
to [editor autocompletion](http://esprima.org/demo/autocomplete.html).
|
||||
|
||||
Esprima runs on many popular web browsers, as well as other ECMAScript platforms such as
|
||||
[Rhino](http://www.mozilla.org/rhino), [Nashorn](http://openjdk.java.net/projects/nashorn/), and [Node.js](https://npmjs.org/package/esprima).
|
||||
|
||||
For more information, check the web site [esprima.org](http://esprima.org).
|
3756
node_modules/jsonpath/node_modules/esprima/esprima.js
generated
vendored
Normal file
3756
node_modules/jsonpath/node_modules/esprima/esprima.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
107
node_modules/jsonpath/node_modules/esprima/package.json
generated
vendored
Normal file
107
node_modules/jsonpath/node_modules/esprima/package.json
generated
vendored
Normal file
@@ -0,0 +1,107 @@
|
||||
{
|
||||
"_from": "esprima@1.2.2",
|
||||
"_id": "esprima@1.2.2",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-dqD9Zvz+FU/SkmZ9wmQBl1CxZXs=",
|
||||
"_location": "/jsonpath/esprima",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "esprima@1.2.2",
|
||||
"name": "esprima",
|
||||
"escapedName": "esprima",
|
||||
"rawSpec": "1.2.2",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "1.2.2"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/jsonpath"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/esprima/-/esprima-1.2.2.tgz",
|
||||
"_shasum": "76a0fd66fcfe154fd292667dc264019750b1657b",
|
||||
"_spec": "esprima@1.2.2",
|
||||
"_where": "C:\\Users\\atharvam\\repos-main\\k8s-set-context\\node_modules\\jsonpath",
|
||||
"author": {
|
||||
"name": "Ariya Hidayat",
|
||||
"email": "ariya.hidayat@gmail.com"
|
||||
},
|
||||
"bin": {
|
||||
"esparse": "bin/esparse.js",
|
||||
"esvalidate": "bin/esvalidate.js"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "http://issues.esprima.org"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"deprecated": false,
|
||||
"description": "ECMAScript parsing infrastructure for multipurpose analysis",
|
||||
"devDependencies": {
|
||||
"complexity-report": "~0.6.1",
|
||||
"eslint": "~0.4.3",
|
||||
"istanbul": "~0.2.6",
|
||||
"jscs": "~1.2.4",
|
||||
"jslint": "~0.1.9",
|
||||
"json-diff": "~0.3.1",
|
||||
"optimist": "~0.6.0",
|
||||
"regenerate": "~0.5.4",
|
||||
"unicode-6.3.0": "~0.1.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.4.0"
|
||||
},
|
||||
"files": [
|
||||
"bin",
|
||||
"test/run.js",
|
||||
"test/runner.js",
|
||||
"test/test.js",
|
||||
"test/compat.js",
|
||||
"test/reflect.js",
|
||||
"esprima.js"
|
||||
],
|
||||
"homepage": "http://esprima.org",
|
||||
"keywords": [
|
||||
"ast",
|
||||
"ecmascript",
|
||||
"javascript",
|
||||
"parser",
|
||||
"syntax"
|
||||
],
|
||||
"licenses": [
|
||||
{
|
||||
"type": "BSD",
|
||||
"url": "http://github.com/ariya/esprima/raw/master/LICENSE.BSD"
|
||||
}
|
||||
],
|
||||
"main": "esprima.js",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "Ariya Hidayat",
|
||||
"email": "ariya.hidayat@gmail.com",
|
||||
"url": "http://ariya.ofilabs.com"
|
||||
}
|
||||
],
|
||||
"name": "esprima",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+ssh://git@github.com/ariya/esprima.git"
|
||||
},
|
||||
"scripts": {
|
||||
"analyze-complexity": "node tools/list-complexity.js",
|
||||
"analyze-coverage": "node node_modules/istanbul/lib/cli.js cover test/runner.js",
|
||||
"benchmark": "node test/benchmarks.js",
|
||||
"benchmark-quick": "node test/benchmarks.js quick",
|
||||
"check-complexity": "node node_modules/complexity-report/src/cli.js --maxcc 14 --silent -l -w esprima.js",
|
||||
"check-coverage": "node node_modules/istanbul/lib/cli.js check-coverage --statement 100 --branch 100 --function 100",
|
||||
"check-version": "node tools/check-version.js",
|
||||
"complexity": "npm run-script analyze-complexity && npm run-script check-complexity",
|
||||
"coverage": "npm run-script analyze-coverage && npm run-script check-coverage",
|
||||
"eslint": "node node_modules/eslint/bin/eslint.js esprima.js",
|
||||
"generate-regex": "node tools/generate-identifier-regex.js",
|
||||
"jscs": "node node_modules/.bin/jscs esprima.js",
|
||||
"jslint": "node node_modules/jslint/bin/jslint.js esprima.js",
|
||||
"lint": "npm run-script check-version && npm run-script eslint && npm run-script jscs && npm run-script jslint",
|
||||
"test": "npm run-script lint && node test/run.js && npm run-script coverage && npm run-script complexity"
|
||||
},
|
||||
"version": "1.2.2"
|
||||
}
|
241
node_modules/jsonpath/node_modules/esprima/test/compat.js
generated
vendored
Normal file
241
node_modules/jsonpath/node_modules/esprima/test/compat.js
generated
vendored
Normal file
@@ -0,0 +1,241 @@
|
||||
/*
|
||||
Copyright (C) 2012 Joost-Wim Boekesteijn <joost-wim@boekesteijn.nl>
|
||||
Copyright (C) 2011 Ariya Hidayat <ariya.hidayat@gmail.com>
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*jslint node: true */
|
||||
/*global document: true, window:true, esprima: true, testReflect: true */
|
||||
|
||||
var runTests;
|
||||
|
||||
function getContext(esprima, reportCase, reportFailure) {
|
||||
'use strict';
|
||||
|
||||
var Reflect, Pattern;
|
||||
|
||||
// Maps Mozilla Reflect object to our Esprima parser.
|
||||
Reflect = {
|
||||
parse: function (code) {
|
||||
var result;
|
||||
|
||||
reportCase(code);
|
||||
|
||||
try {
|
||||
result = esprima.parse(code);
|
||||
} catch (error) {
|
||||
result = error;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
};
|
||||
|
||||
// This is used by Reflect test suite to match a syntax tree.
|
||||
Pattern = function (obj) {
|
||||
var pattern;
|
||||
|
||||
// Poor man's deep object cloning.
|
||||
pattern = JSON.parse(JSON.stringify(obj));
|
||||
|
||||
// Special handling for regular expression literal since we need to
|
||||
// convert it to a string literal, otherwise it will be decoded
|
||||
// as object "{}" and the regular expression would be lost.
|
||||
if (obj.type && obj.type === 'Literal') {
|
||||
if (obj.value instanceof RegExp) {
|
||||
pattern = {
|
||||
type: obj.type,
|
||||
value: obj.value.toString()
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
// Special handling for branch statement because SpiderMonkey
|
||||
// prefers to put the 'alternate' property before 'consequent'.
|
||||
if (obj.type && obj.type === 'IfStatement') {
|
||||
pattern = {
|
||||
type: pattern.type,
|
||||
test: pattern.test,
|
||||
consequent: pattern.consequent,
|
||||
alternate: pattern.alternate
|
||||
};
|
||||
}
|
||||
|
||||
// Special handling for do while statement because SpiderMonkey
|
||||
// prefers to put the 'test' property before 'body'.
|
||||
if (obj.type && obj.type === 'DoWhileStatement') {
|
||||
pattern = {
|
||||
type: pattern.type,
|
||||
body: pattern.body,
|
||||
test: pattern.test
|
||||
};
|
||||
}
|
||||
|
||||
function adjustRegexLiteralAndRaw(key, value) {
|
||||
if (key === 'value' && value instanceof RegExp) {
|
||||
value = value.toString();
|
||||
} else if (key === 'raw' && typeof value === "string") {
|
||||
// Ignore Esprima-specific 'raw' property.
|
||||
return undefined;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
if (obj.type && (obj.type === 'Program')) {
|
||||
pattern.assert = function (tree) {
|
||||
var actual, expected;
|
||||
actual = JSON.stringify(tree, adjustRegexLiteralAndRaw, 4);
|
||||
expected = JSON.stringify(obj, null, 4);
|
||||
|
||||
if (expected !== actual) {
|
||||
reportFailure(expected, actual);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
return pattern;
|
||||
};
|
||||
|
||||
return {
|
||||
Reflect: Reflect,
|
||||
Pattern: Pattern
|
||||
};
|
||||
}
|
||||
|
||||
if (typeof window !== 'undefined') {
|
||||
// Run all tests in a browser environment.
|
||||
runTests = function () {
|
||||
'use strict';
|
||||
|
||||
var total = 0,
|
||||
failures = 0;
|
||||
|
||||
function setText(el, str) {
|
||||
if (typeof el.innerText === 'string') {
|
||||
el.innerText = str;
|
||||
} else {
|
||||
el.textContent = str;
|
||||
}
|
||||
}
|
||||
|
||||
function reportCase(code) {
|
||||
var report, e;
|
||||
report = document.getElementById('report');
|
||||
e = document.createElement('pre');
|
||||
e.setAttribute('class', 'code');
|
||||
setText(e, code);
|
||||
report.appendChild(e);
|
||||
total += 1;
|
||||
}
|
||||
|
||||
function reportFailure(expected, actual) {
|
||||
var report, e;
|
||||
|
||||
failures += 1;
|
||||
|
||||
report = document.getElementById('report');
|
||||
|
||||
e = document.createElement('p');
|
||||
setText(e, 'Expected');
|
||||
report.appendChild(e);
|
||||
|
||||
e = document.createElement('pre');
|
||||
e.setAttribute('class', 'expected');
|
||||
setText(e, expected);
|
||||
report.appendChild(e);
|
||||
|
||||
e = document.createElement('p');
|
||||
setText(e, 'Actual');
|
||||
report.appendChild(e);
|
||||
|
||||
e = document.createElement('pre');
|
||||
e.setAttribute('class', 'actual');
|
||||
setText(e, actual);
|
||||
report.appendChild(e);
|
||||
}
|
||||
|
||||
setText(document.getElementById('version'), esprima.version);
|
||||
|
||||
window.setTimeout(function () {
|
||||
var tick, context = getContext(esprima, reportCase, reportFailure);
|
||||
|
||||
tick = new Date();
|
||||
testReflect(context.Reflect, context.Pattern);
|
||||
tick = (new Date()) - tick;
|
||||
|
||||
if (failures > 0) {
|
||||
document.getElementById('status').className = 'alert-box alert';
|
||||
setText(document.getElementById('status'), total + ' tests. ' +
|
||||
'Failures: ' + failures + '. ' + tick + ' ms');
|
||||
} else {
|
||||
document.getElementById('status').className = 'alert-box success';
|
||||
setText(document.getElementById('status'), total + ' tests. ' +
|
||||
'No failure. ' + tick + ' ms');
|
||||
}
|
||||
}, 11);
|
||||
};
|
||||
} else {
|
||||
(function (global) {
|
||||
'use strict';
|
||||
var esprima = require('../esprima'),
|
||||
tick,
|
||||
total = 0,
|
||||
failures = [],
|
||||
header,
|
||||
current,
|
||||
context;
|
||||
|
||||
function reportCase(code) {
|
||||
total += 1;
|
||||
current = code;
|
||||
}
|
||||
|
||||
function reportFailure(expected, actual) {
|
||||
failures.push({
|
||||
source: current,
|
||||
expected: expected.toString(),
|
||||
actual: actual.toString()
|
||||
});
|
||||
}
|
||||
|
||||
context = getContext(esprima, reportCase, reportFailure);
|
||||
|
||||
tick = new Date();
|
||||
require('./reflect').testReflect(context.Reflect, context.Pattern);
|
||||
tick = (new Date()) - tick;
|
||||
|
||||
header = total + ' tests. ' + failures.length + ' failures. ' +
|
||||
tick + ' ms';
|
||||
if (failures.length) {
|
||||
console.error(header);
|
||||
failures.forEach(function (failure) {
|
||||
console.error(failure.source + ': Expected\n ' +
|
||||
failure.expected.split('\n').join('\n ') +
|
||||
'\nto match\n ' + failure.actual);
|
||||
});
|
||||
} else {
|
||||
console.log(header);
|
||||
}
|
||||
process.exit(failures.length === 0 ? 0 : 1);
|
||||
}(this));
|
||||
}
|
||||
/* vim: set sw=4 ts=4 et tw=80 : */
|
422
node_modules/jsonpath/node_modules/esprima/test/reflect.js
generated
vendored
Normal file
422
node_modules/jsonpath/node_modules/esprima/test/reflect.js
generated
vendored
Normal file
@@ -0,0 +1,422 @@
|
||||
// This is modified from Mozilla Reflect.parse test suite (the file is located
|
||||
// at js/src/tests/js1_8_5/extensions/reflect-parse.js in the source tree).
|
||||
//
|
||||
// Some notable changes:
|
||||
// * Removed unsupported features (destructuring, let, comprehensions...).
|
||||
// * Removed tests for E4X (ECMAScript for XML).
|
||||
// * Removed everything related to builder.
|
||||
// * Enclosed every 'Pattern' construct with a scope.
|
||||
// * Tweaked some expected tree to remove generator field.
|
||||
// * Removed the test for bug 632030 and bug 632024.
|
||||
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/*
|
||||
* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/licenses/publicdomain/
|
||||
*/
|
||||
|
||||
(function (exports) {
|
||||
|
||||
function testReflect(Reflect, Pattern) {
|
||||
|
||||
function program(elts) { return Pattern({ type: "Program", body: elts }) }
|
||||
function exprStmt(expr) { return Pattern({ type: "ExpressionStatement", expression: expr }) }
|
||||
function throwStmt(expr) { return Pattern({ type: "ThrowStatement", argument: expr }) }
|
||||
function returnStmt(expr) { return Pattern({ type: "ReturnStatement", argument: expr }) }
|
||||
function yieldExpr(expr) { return Pattern({ type: "YieldExpression", argument: expr }) }
|
||||
function lit(val) { return Pattern({ type: "Literal", value: val }) }
|
||||
var thisExpr = Pattern({ type: "ThisExpression" });
|
||||
function funDecl(id, params, body) { return Pattern({ type: "FunctionDeclaration",
|
||||
id: id,
|
||||
params: params,
|
||||
defaults: [],
|
||||
body: body,
|
||||
rest: null,
|
||||
generator: false,
|
||||
expression: false
|
||||
}) }
|
||||
function genFunDecl(id, params, body) { return Pattern({ type: "FunctionDeclaration",
|
||||
id: id,
|
||||
params: params,
|
||||
defaults: [],
|
||||
body: body,
|
||||
rest: null,
|
||||
generator: false,
|
||||
expression: false
|
||||
}) }
|
||||
function declarator(id, init) { return Pattern({ type: "VariableDeclarator", id: id, init: init }) }
|
||||
function varDecl(decls) { return Pattern({ type: "VariableDeclaration", declarations: decls, kind: "var" }) }
|
||||
function letDecl(decls) { return Pattern({ type: "VariableDeclaration", declarations: decls, kind: "let" }) }
|
||||
function constDecl(decls) { return Pattern({ type: "VariableDeclaration", declarations: decls, kind: "const" }) }
|
||||
function ident(name) { return Pattern({ type: "Identifier", name: name }) }
|
||||
function dotExpr(obj, id) { return Pattern({ type: "MemberExpression", computed: false, object: obj, property: id }) }
|
||||
function memExpr(obj, id) { return Pattern({ type: "MemberExpression", computed: true, object: obj, property: id }) }
|
||||
function forStmt(init, test, update, body) { return Pattern({ type: "ForStatement", init: init, test: test, update: update, body: body }) }
|
||||
function forInStmt(lhs, rhs, body) { return Pattern({ type: "ForInStatement", left: lhs, right: rhs, body: body, each: false }) }
|
||||
function forEachInStmt(lhs, rhs, body) { return Pattern({ type: "ForInStatement", left: lhs, right: rhs, body: body, each: true }) }
|
||||
function breakStmt(lab) { return Pattern({ type: "BreakStatement", label: lab }) }
|
||||
function continueStmt(lab) { return Pattern({ type: "ContinueStatement", label: lab }) }
|
||||
function blockStmt(body) { return Pattern({ type: "BlockStatement", body: body }) }
|
||||
var emptyStmt = Pattern({ type: "EmptyStatement" });
|
||||
function ifStmt(test, cons, alt) { return Pattern({ type: "IfStatement", test: test, alternate: alt, consequent: cons }) }
|
||||
function labStmt(lab, stmt) { return Pattern({ type: "LabeledStatement", label: lab, body: stmt }) }
|
||||
function withStmt(obj, stmt) { return Pattern({ type: "WithStatement", object: obj, body: stmt }) }
|
||||
function whileStmt(test, stmt) { return Pattern({ type: "WhileStatement", test: test, body: stmt }) }
|
||||
function doStmt(stmt, test) { return Pattern({ type: "DoWhileStatement", test: test, body: stmt }) }
|
||||
function switchStmt(disc, cases) { return Pattern({ type: "SwitchStatement", discriminant: disc, cases: cases }) }
|
||||
function caseClause(test, stmts) { return Pattern({ type: "SwitchCase", test: test, consequent: stmts }) }
|
||||
function defaultClause(stmts) { return Pattern({ type: "SwitchCase", test: null, consequent: stmts }) }
|
||||
function catchClause(id, guard, body) { if (guard) { return Pattern({ type: "GuardedCatchClause", param: id, guard: guard, body: body }) } else { return Pattern({ type: "CatchClause", param: id, body: body }) } }
|
||||
function tryStmt(body, guarded, catches, fin) { return Pattern({ type: "TryStatement", block: body, guardedHandlers: guarded, handlers: catches, finalizer: fin }) }
|
||||
function letStmt(head, body) { return Pattern({ type: "LetStatement", head: head, body: body }) }
|
||||
function funExpr(id, args, body, gen) { return Pattern({ type: "FunctionExpression",
|
||||
id: id,
|
||||
params: args,
|
||||
defaults: [],
|
||||
body: body,
|
||||
rest: null,
|
||||
generator: false,
|
||||
expression: false
|
||||
}) }
|
||||
function genFunExpr(id, args, body) { return Pattern({ type: "FunctionExpression",
|
||||
id: id,
|
||||
params: args,
|
||||
defaults: [],
|
||||
body: body,
|
||||
rest: null,
|
||||
generator: false,
|
||||
expression: false
|
||||
}) }
|
||||
|
||||
function unExpr(op, arg) { return Pattern({ type: "UnaryExpression", operator: op, argument: arg, prefix: true }) }
|
||||
function binExpr(op, left, right) { return Pattern({ type: "BinaryExpression", operator: op, left: left, right: right }) }
|
||||
function aExpr(op, left, right) { return Pattern({ type: "AssignmentExpression", operator: op, left: left, right: right }) }
|
||||
function updExpr(op, arg, prefix) { return Pattern({ type: "UpdateExpression", operator: op, argument: arg, prefix: prefix }) }
|
||||
function logExpr(op, left, right) { return Pattern({ type: "LogicalExpression", operator: op, left: left, right: right }) }
|
||||
|
||||
function condExpr(test, cons, alt) { return Pattern({ type: "ConditionalExpression", test: test, consequent: cons, alternate: alt }) }
|
||||
function seqExpr(exprs) { return Pattern({ type: "SequenceExpression", expressions: exprs }) }
|
||||
function newExpr(callee, args) { return Pattern({ type: "NewExpression", callee: callee, arguments: args }) }
|
||||
function callExpr(callee, args) { return Pattern({ type: "CallExpression", callee: callee, arguments: args }) }
|
||||
function arrExpr(elts) { return Pattern({ type: "ArrayExpression", elements: elts }) }
|
||||
function objExpr(elts) { return Pattern({ type: "ObjectExpression", properties: elts }) }
|
||||
function objProp(key, value, kind) { return Pattern({ type: "Property", key: key, value: value, kind: kind }) }
|
||||
|
||||
function arrPatt(elts) { return Pattern({ type: "ArrayPattern", elements: elts }) }
|
||||
function objPatt(elts) { return Pattern({ type: "ObjectPattern", properties: elts }) }
|
||||
|
||||
function localSrc(src) { return "(function(){ " + src + " })" }
|
||||
function localPatt(patt) { return program([exprStmt(funExpr(null, [], blockStmt([patt])))]) }
|
||||
function blockSrc(src) { return "(function(){ { " + src + " } })" }
|
||||
function blockPatt(patt) { return program([exprStmt(funExpr(null, [], blockStmt([blockStmt([patt])])))]) }
|
||||
|
||||
function assertBlockStmt(src, patt) {
|
||||
blockPatt(patt).assert(Reflect.parse(blockSrc(src)));
|
||||
}
|
||||
|
||||
function assertBlockExpr(src, patt) {
|
||||
assertBlockStmt(src, exprStmt(patt));
|
||||
}
|
||||
|
||||
function assertBlockDecl(src, patt, builder) {
|
||||
blockPatt(patt).assert(Reflect.parse(blockSrc(src), {builder: builder}));
|
||||
}
|
||||
|
||||
function assertLocalStmt(src, patt) {
|
||||
localPatt(patt).assert(Reflect.parse(localSrc(src)));
|
||||
}
|
||||
|
||||
function assertLocalExpr(src, patt) {
|
||||
assertLocalStmt(src, exprStmt(patt));
|
||||
}
|
||||
|
||||
function assertLocalDecl(src, patt) {
|
||||
localPatt(patt).assert(Reflect.parse(localSrc(src)));
|
||||
}
|
||||
|
||||
function assertGlobalStmt(src, patt, builder) {
|
||||
program([patt]).assert(Reflect.parse(src, {builder: builder}));
|
||||
}
|
||||
|
||||
function assertGlobalExpr(src, patt, builder) {
|
||||
program([exprStmt(patt)]).assert(Reflect.parse(src, {builder: builder}));
|
||||
//assertStmt(src, exprStmt(patt));
|
||||
}
|
||||
|
||||
function assertGlobalDecl(src, patt) {
|
||||
program([patt]).assert(Reflect.parse(src));
|
||||
}
|
||||
|
||||
function assertProg(src, patt) {
|
||||
program(patt).assert(Reflect.parse(src));
|
||||
}
|
||||
|
||||
function assertStmt(src, patt) {
|
||||
assertLocalStmt(src, patt);
|
||||
assertGlobalStmt(src, patt);
|
||||
assertBlockStmt(src, patt);
|
||||
}
|
||||
|
||||
function assertExpr(src, patt) {
|
||||
assertLocalExpr(src, patt);
|
||||
assertGlobalExpr(src, patt);
|
||||
assertBlockExpr(src, patt);
|
||||
}
|
||||
|
||||
function assertDecl(src, patt) {
|
||||
assertLocalDecl(src, patt);
|
||||
assertGlobalDecl(src, patt);
|
||||
assertBlockDecl(src, patt);
|
||||
}
|
||||
|
||||
function assertError(src, errorType) {
|
||||
try {
|
||||
Reflect.parse(src);
|
||||
} catch (e) {
|
||||
return;
|
||||
}
|
||||
throw new Error("expected " + errorType.name + " for " + uneval(src));
|
||||
}
|
||||
|
||||
|
||||
// general tests
|
||||
|
||||
// NB: These are useful but for now jit-test doesn't do I/O reliably.
|
||||
|
||||
//program(_).assert(Reflect.parse(snarf('data/flapjax.txt')));
|
||||
//program(_).assert(Reflect.parse(snarf('data/jquery-1.4.2.txt')));
|
||||
//program(_).assert(Reflect.parse(snarf('data/prototype.js')));
|
||||
//program(_).assert(Reflect.parse(snarf('data/dojo.js.uncompressed.js')));
|
||||
//program(_).assert(Reflect.parse(snarf('data/mootools-1.2.4-core-nc.js')));
|
||||
|
||||
|
||||
// declarations
|
||||
|
||||
assertDecl("var x = 1, y = 2, z = 3",
|
||||
varDecl([declarator(ident("x"), lit(1)),
|
||||
declarator(ident("y"), lit(2)),
|
||||
declarator(ident("z"), lit(3))]));
|
||||
assertDecl("var x, y, z",
|
||||
varDecl([declarator(ident("x"), null),
|
||||
declarator(ident("y"), null),
|
||||
declarator(ident("z"), null)]));
|
||||
assertDecl("function foo() { }",
|
||||
funDecl(ident("foo"), [], blockStmt([])));
|
||||
assertDecl("function foo() { return 42 }",
|
||||
funDecl(ident("foo"), [], blockStmt([returnStmt(lit(42))])));
|
||||
|
||||
|
||||
// Bug 591437: rebound args have their defs turned into uses
|
||||
assertDecl("function f(a) { function a() { } }",
|
||||
funDecl(ident("f"), [ident("a")], blockStmt([funDecl(ident("a"), [], blockStmt([]))])));
|
||||
assertDecl("function f(a,b,c) { function b() { } }",
|
||||
funDecl(ident("f"), [ident("a"),ident("b"),ident("c")], blockStmt([funDecl(ident("b"), [], blockStmt([]))])));
|
||||
|
||||
// expressions
|
||||
|
||||
assertExpr("true", lit(true));
|
||||
assertExpr("false", lit(false));
|
||||
assertExpr("42", lit(42));
|
||||
assertExpr("(/asdf/)", lit(/asdf/));
|
||||
assertExpr("this", thisExpr);
|
||||
assertExpr("foo", ident("foo"));
|
||||
assertExpr("foo.bar", dotExpr(ident("foo"), ident("bar")));
|
||||
assertExpr("foo[bar]", memExpr(ident("foo"), ident("bar")));
|
||||
assertExpr("(function(){})", funExpr(null, [], blockStmt([])));
|
||||
assertExpr("(function f() {})", funExpr(ident("f"), [], blockStmt([])));
|
||||
assertExpr("(function f(x,y,z) {})", funExpr(ident("f"), [ident("x"),ident("y"),ident("z")], blockStmt([])));
|
||||
assertExpr("(++x)", updExpr("++", ident("x"), true));
|
||||
assertExpr("(x++)", updExpr("++", ident("x"), false));
|
||||
assertExpr("(+x)", unExpr("+", ident("x")));
|
||||
assertExpr("(-x)", unExpr("-", ident("x")));
|
||||
assertExpr("(!x)", unExpr("!", ident("x")));
|
||||
assertExpr("(~x)", unExpr("~", ident("x")));
|
||||
assertExpr("(delete x)", unExpr("delete", ident("x")));
|
||||
assertExpr("(typeof x)", unExpr("typeof", ident("x")));
|
||||
assertExpr("(void x)", unExpr("void", ident("x")));
|
||||
assertExpr("(x == y)", binExpr("==", ident("x"), ident("y")));
|
||||
assertExpr("(x != y)", binExpr("!=", ident("x"), ident("y")));
|
||||
assertExpr("(x === y)", binExpr("===", ident("x"), ident("y")));
|
||||
assertExpr("(x !== y)", binExpr("!==", ident("x"), ident("y")));
|
||||
assertExpr("(x < y)", binExpr("<", ident("x"), ident("y")));
|
||||
assertExpr("(x <= y)", binExpr("<=", ident("x"), ident("y")));
|
||||
assertExpr("(x > y)", binExpr(">", ident("x"), ident("y")));
|
||||
assertExpr("(x >= y)", binExpr(">=", ident("x"), ident("y")));
|
||||
assertExpr("(x << y)", binExpr("<<", ident("x"), ident("y")));
|
||||
assertExpr("(x >> y)", binExpr(">>", ident("x"), ident("y")));
|
||||
assertExpr("(x >>> y)", binExpr(">>>", ident("x"), ident("y")));
|
||||
assertExpr("(x + y)", binExpr("+", ident("x"), ident("y")));
|
||||
assertExpr("(w + x + y + z)", binExpr("+", binExpr("+", binExpr("+", ident("w"), ident("x")), ident("y")), ident("z")));
|
||||
assertExpr("(x - y)", binExpr("-", ident("x"), ident("y")));
|
||||
assertExpr("(w - x - y - z)", binExpr("-", binExpr("-", binExpr("-", ident("w"), ident("x")), ident("y")), ident("z")));
|
||||
assertExpr("(x * y)", binExpr("*", ident("x"), ident("y")));
|
||||
assertExpr("(x / y)", binExpr("/", ident("x"), ident("y")));
|
||||
assertExpr("(x % y)", binExpr("%", ident("x"), ident("y")));
|
||||
assertExpr("(x | y)", binExpr("|", ident("x"), ident("y")));
|
||||
assertExpr("(x ^ y)", binExpr("^", ident("x"), ident("y")));
|
||||
assertExpr("(x & y)", binExpr("&", ident("x"), ident("y")));
|
||||
assertExpr("(x in y)", binExpr("in", ident("x"), ident("y")));
|
||||
assertExpr("(x instanceof y)", binExpr("instanceof", ident("x"), ident("y")));
|
||||
assertExpr("(x = y)", aExpr("=", ident("x"), ident("y")));
|
||||
assertExpr("(x += y)", aExpr("+=", ident("x"), ident("y")));
|
||||
assertExpr("(x -= y)", aExpr("-=", ident("x"), ident("y")));
|
||||
assertExpr("(x *= y)", aExpr("*=", ident("x"), ident("y")));
|
||||
assertExpr("(x /= y)", aExpr("/=", ident("x"), ident("y")));
|
||||
assertExpr("(x %= y)", aExpr("%=", ident("x"), ident("y")));
|
||||
assertExpr("(x <<= y)", aExpr("<<=", ident("x"), ident("y")));
|
||||
assertExpr("(x >>= y)", aExpr(">>=", ident("x"), ident("y")));
|
||||
assertExpr("(x >>>= y)", aExpr(">>>=", ident("x"), ident("y")));
|
||||
assertExpr("(x |= y)", aExpr("|=", ident("x"), ident("y")));
|
||||
assertExpr("(x ^= y)", aExpr("^=", ident("x"), ident("y")));
|
||||
assertExpr("(x &= y)", aExpr("&=", ident("x"), ident("y")));
|
||||
assertExpr("(x || y)", logExpr("||", ident("x"), ident("y")));
|
||||
assertExpr("(x && y)", logExpr("&&", ident("x"), ident("y")));
|
||||
assertExpr("(w || x || y || z)", logExpr("||", logExpr("||", logExpr("||", ident("w"), ident("x")), ident("y")), ident("z")))
|
||||
assertExpr("(x ? y : z)", condExpr(ident("x"), ident("y"), ident("z")));
|
||||
assertExpr("(x,y)", seqExpr([ident("x"),ident("y")]))
|
||||
assertExpr("(x,y,z)", seqExpr([ident("x"),ident("y"),ident("z")]))
|
||||
assertExpr("(a,b,c,d,e,f,g)", seqExpr([ident("a"),ident("b"),ident("c"),ident("d"),ident("e"),ident("f"),ident("g")]));
|
||||
assertExpr("(new Object)", newExpr(ident("Object"), []));
|
||||
assertExpr("(new Object())", newExpr(ident("Object"), []));
|
||||
assertExpr("(new Object(42))", newExpr(ident("Object"), [lit(42)]));
|
||||
assertExpr("(new Object(1,2,3))", newExpr(ident("Object"), [lit(1),lit(2),lit(3)]));
|
||||
assertExpr("(String())", callExpr(ident("String"), []));
|
||||
assertExpr("(String(42))", callExpr(ident("String"), [lit(42)]));
|
||||
assertExpr("(String(1,2,3))", callExpr(ident("String"), [lit(1),lit(2),lit(3)]));
|
||||
assertExpr("[]", arrExpr([]));
|
||||
assertExpr("[1]", arrExpr([lit(1)]));
|
||||
assertExpr("[1,2]", arrExpr([lit(1),lit(2)]));
|
||||
assertExpr("[1,2,3]", arrExpr([lit(1),lit(2),lit(3)]));
|
||||
assertExpr("[1,,2,3]", arrExpr([lit(1),,lit(2),lit(3)]));
|
||||
assertExpr("[1,,,2,3]", arrExpr([lit(1),,,lit(2),lit(3)]));
|
||||
assertExpr("[1,,,2,,3]", arrExpr([lit(1),,,lit(2),,lit(3)]));
|
||||
assertExpr("[1,,,2,,,3]", arrExpr([lit(1),,,lit(2),,,lit(3)]));
|
||||
assertExpr("[,1,2,3]", arrExpr([,lit(1),lit(2),lit(3)]));
|
||||
assertExpr("[,,1,2,3]", arrExpr([,,lit(1),lit(2),lit(3)]));
|
||||
assertExpr("[,,,1,2,3]", arrExpr([,,,lit(1),lit(2),lit(3)]));
|
||||
assertExpr("[,,,1,2,3,]", arrExpr([,,,lit(1),lit(2),lit(3)]));
|
||||
assertExpr("[,,,1,2,3,,]", arrExpr([,,,lit(1),lit(2),lit(3),undefined]));
|
||||
assertExpr("[,,,1,2,3,,,]", arrExpr([,,,lit(1),lit(2),lit(3),undefined,undefined]));
|
||||
assertExpr("[,,,,,]", arrExpr([undefined,undefined,undefined,undefined,undefined]));
|
||||
assertExpr("({})", objExpr([]));
|
||||
assertExpr("({x:1})", objExpr([objProp(ident("x"), lit(1), "init")]));
|
||||
assertExpr("({x:1, y:2})", objExpr([objProp(ident("x"), lit(1), "init"),
|
||||
objProp(ident("y"), lit(2), "init")]));
|
||||
assertExpr("({x:1, y:2, z:3})", objExpr([objProp(ident("x"), lit(1), "init"),
|
||||
objProp(ident("y"), lit(2), "init"),
|
||||
objProp(ident("z"), lit(3), "init") ]));
|
||||
assertExpr("({x:1, 'y':2, z:3})", objExpr([objProp(ident("x"), lit(1), "init"),
|
||||
objProp(lit("y"), lit(2), "init"),
|
||||
objProp(ident("z"), lit(3), "init") ]));
|
||||
assertExpr("({'x':1, 'y':2, z:3})", objExpr([objProp(lit("x"), lit(1), "init"),
|
||||
objProp(lit("y"), lit(2), "init"),
|
||||
objProp(ident("z"), lit(3), "init") ]));
|
||||
assertExpr("({'x':1, 'y':2, 3:3})", objExpr([objProp(lit("x"), lit(1), "init"),
|
||||
objProp(lit("y"), lit(2), "init"),
|
||||
objProp(lit(3), lit(3), "init") ]));
|
||||
|
||||
// Bug 571617: eliminate constant-folding
|
||||
assertExpr("2 + 3", binExpr("+", lit(2), lit(3)));
|
||||
|
||||
// Bug 632026: constant-folding
|
||||
assertExpr("typeof(0?0:a)", unExpr("typeof", condExpr(lit(0), lit(0), ident("a"))));
|
||||
|
||||
// Bug 632056: constant-folding
|
||||
program([exprStmt(ident("f")),
|
||||
ifStmt(lit(1),
|
||||
funDecl(ident("f"), [], blockStmt([])),
|
||||
null)]).assert(Reflect.parse("f; if (1) function f(){}"));
|
||||
|
||||
// statements
|
||||
|
||||
assertStmt("throw 42", throwStmt(lit(42)));
|
||||
assertStmt("for (;;) break", forStmt(null, null, null, breakStmt(null)));
|
||||
assertStmt("for (x; y; z) break", forStmt(ident("x"), ident("y"), ident("z"), breakStmt(null)));
|
||||
assertStmt("for (var x; y; z) break", forStmt(varDecl([declarator(ident("x"), null)]), ident("y"), ident("z"), breakStmt(null)));
|
||||
assertStmt("for (var x = 42; y; z) break", forStmt(varDecl([declarator(ident("x"), lit(42))]), ident("y"), ident("z"), breakStmt(null)));
|
||||
assertStmt("for (x; ; z) break", forStmt(ident("x"), null, ident("z"), breakStmt(null)));
|
||||
assertStmt("for (var x; ; z) break", forStmt(varDecl([declarator(ident("x"), null)]), null, ident("z"), breakStmt(null)));
|
||||
assertStmt("for (var x = 42; ; z) break", forStmt(varDecl([declarator(ident("x"), lit(42))]), null, ident("z"), breakStmt(null)));
|
||||
assertStmt("for (x; y; ) break", forStmt(ident("x"), ident("y"), null, breakStmt(null)));
|
||||
assertStmt("for (var x; y; ) break", forStmt(varDecl([declarator(ident("x"), null)]), ident("y"), null, breakStmt(null)));
|
||||
assertStmt("for (var x = 42; y; ) break", forStmt(varDecl([declarator(ident("x"),lit(42))]), ident("y"), null, breakStmt(null)));
|
||||
assertStmt("for (var x in y) break", forInStmt(varDecl([declarator(ident("x"),null)]), ident("y"), breakStmt(null)));
|
||||
assertStmt("for (x in y) break", forInStmt(ident("x"), ident("y"), breakStmt(null)));
|
||||
assertStmt("{ }", blockStmt([]));
|
||||
assertStmt("{ throw 1; throw 2; throw 3; }", blockStmt([ throwStmt(lit(1)), throwStmt(lit(2)), throwStmt(lit(3))]));
|
||||
assertStmt(";", emptyStmt);
|
||||
assertStmt("if (foo) throw 42;", ifStmt(ident("foo"), throwStmt(lit(42)), null));
|
||||
assertStmt("if (foo) throw 42; else true;", ifStmt(ident("foo"), throwStmt(lit(42)), exprStmt(lit(true))));
|
||||
assertStmt("if (foo) { throw 1; throw 2; throw 3; }",
|
||||
ifStmt(ident("foo"),
|
||||
blockStmt([throwStmt(lit(1)), throwStmt(lit(2)), throwStmt(lit(3))]),
|
||||
null));
|
||||
assertStmt("if (foo) { throw 1; throw 2; throw 3; } else true;",
|
||||
ifStmt(ident("foo"),
|
||||
blockStmt([throwStmt(lit(1)), throwStmt(lit(2)), throwStmt(lit(3))]),
|
||||
exprStmt(lit(true))));
|
||||
assertStmt("foo: for(;;) break foo;", labStmt(ident("foo"), forStmt(null, null, null, breakStmt(ident("foo")))));
|
||||
assertStmt("foo: for(;;) continue foo;", labStmt(ident("foo"), forStmt(null, null, null, continueStmt(ident("foo")))));
|
||||
assertStmt("with (obj) { }", withStmt(ident("obj"), blockStmt([])));
|
||||
assertStmt("with (obj) { obj; }", withStmt(ident("obj"), blockStmt([exprStmt(ident("obj"))])));
|
||||
assertStmt("while (foo) { }", whileStmt(ident("foo"), blockStmt([])));
|
||||
assertStmt("while (foo) { foo; }", whileStmt(ident("foo"), blockStmt([exprStmt(ident("foo"))])));
|
||||
assertStmt("do { } while (foo);", doStmt(blockStmt([]), ident("foo")));
|
||||
assertStmt("do { foo; } while (foo)", doStmt(blockStmt([exprStmt(ident("foo"))]), ident("foo")));
|
||||
assertStmt("switch (foo) { case 1: 1; break; case 2: 2; break; default: 3; }",
|
||||
switchStmt(ident("foo"),
|
||||
[ caseClause(lit(1), [ exprStmt(lit(1)), breakStmt(null) ]),
|
||||
caseClause(lit(2), [ exprStmt(lit(2)), breakStmt(null) ]),
|
||||
defaultClause([ exprStmt(lit(3)) ]) ]));
|
||||
assertStmt("switch (foo) { case 1: 1; break; case 2: 2; break; default: 3; case 42: 42; }",
|
||||
switchStmt(ident("foo"),
|
||||
[ caseClause(lit(1), [ exprStmt(lit(1)), breakStmt(null) ]),
|
||||
caseClause(lit(2), [ exprStmt(lit(2)), breakStmt(null) ]),
|
||||
defaultClause([ exprStmt(lit(3)) ]),
|
||||
caseClause(lit(42), [ exprStmt(lit(42)) ]) ]));
|
||||
assertStmt("try { } catch (e) { }",
|
||||
tryStmt(blockStmt([]),
|
||||
[],
|
||||
[ catchClause(ident("e"), null, blockStmt([])) ],
|
||||
null));
|
||||
assertStmt("try { } catch (e) { } finally { }",
|
||||
tryStmt(blockStmt([]),
|
||||
[],
|
||||
[ catchClause(ident("e"), null, blockStmt([])) ],
|
||||
blockStmt([])));
|
||||
assertStmt("try { } finally { }",
|
||||
tryStmt(blockStmt([]),
|
||||
[],
|
||||
[],
|
||||
blockStmt([])));
|
||||
|
||||
// redeclarations (TOK_NAME nodes with lexdef)
|
||||
|
||||
assertStmt("function f() { function g() { } function g() { } }",
|
||||
funDecl(ident("f"), [], blockStmt([funDecl(ident("g"), [], blockStmt([])),
|
||||
funDecl(ident("g"), [], blockStmt([]))])));
|
||||
|
||||
assertStmt("function f() { function g() { } function g() { return 42 } }",
|
||||
funDecl(ident("f"), [], blockStmt([funDecl(ident("g"), [], blockStmt([])),
|
||||
funDecl(ident("g"), [], blockStmt([returnStmt(lit(42))]))])));
|
||||
|
||||
assertStmt("function f() { var x = 42; var x = 43; }",
|
||||
funDecl(ident("f"), [], blockStmt([varDecl([declarator(ident("x"),lit(42))]),
|
||||
varDecl([declarator(ident("x"),lit(43))])])));
|
||||
|
||||
// getters and setters
|
||||
|
||||
assertExpr("({ get x() { return 42 } })",
|
||||
objExpr([ objProp(ident("x"),
|
||||
funExpr(null, [], blockStmt([returnStmt(lit(42))])),
|
||||
"get" ) ]));
|
||||
assertExpr("({ set x(v) { return 42 } })",
|
||||
objExpr([ objProp(ident("x"),
|
||||
funExpr(null, [ident("v")], blockStmt([returnStmt(lit(42))])),
|
||||
"set" ) ]));
|
||||
|
||||
}
|
||||
|
||||
exports.testReflect = testReflect;
|
||||
|
||||
}(typeof exports === 'undefined' ? this : exports));
|
67
node_modules/jsonpath/node_modules/esprima/test/run.js
generated
vendored
Normal file
67
node_modules/jsonpath/node_modules/esprima/test/run.js
generated
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
/*
|
||||
Copyright (C) 2012 Yusuke Suzuki <utatane.tea@gmail.com>
|
||||
Copyright (C) 2012 Ariya Hidayat <ariya.hidayat@gmail.com>
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*jslint node:true */
|
||||
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
var child = require('child_process'),
|
||||
nodejs = '"' + process.execPath + '"',
|
||||
ret = 0,
|
||||
suites,
|
||||
index;
|
||||
|
||||
suites = [
|
||||
'runner',
|
||||
'compat',
|
||||
'parselibs'
|
||||
];
|
||||
|
||||
function nextTest() {
|
||||
var suite = suites[index];
|
||||
|
||||
if (index < suites.length) {
|
||||
child.exec(nodejs + ' ./test/' + suite + '.js', function (err, stdout, stderr) {
|
||||
if (stdout) {
|
||||
process.stdout.write(suite + ': ' + stdout);
|
||||
}
|
||||
if (stderr) {
|
||||
process.stderr.write(suite + ': ' + stderr);
|
||||
}
|
||||
if (err) {
|
||||
ret = err.code;
|
||||
}
|
||||
index += 1;
|
||||
nextTest();
|
||||
});
|
||||
} else {
|
||||
process.exit(ret);
|
||||
}
|
||||
}
|
||||
|
||||
index = 0;
|
||||
nextTest();
|
||||
}());
|
495
node_modules/jsonpath/node_modules/esprima/test/runner.js
generated
vendored
Normal file
495
node_modules/jsonpath/node_modules/esprima/test/runner.js
generated
vendored
Normal file
@@ -0,0 +1,495 @@
|
||||
/*
|
||||
Copyright (C) 2012 Ariya Hidayat <ariya.hidayat@gmail.com>
|
||||
Copyright (C) 2012 Joost-Wim Boekesteijn <joost-wim@boekesteijn.nl>
|
||||
Copyright (C) 2012 Yusuke Suzuki <utatane.tea@gmail.com>
|
||||
Copyright (C) 2012 Arpad Borsos <arpad.borsos@googlemail.com>
|
||||
Copyright (C) 2011 Ariya Hidayat <ariya.hidayat@gmail.com>
|
||||
Copyright (C) 2011 Yusuke Suzuki <utatane.tea@gmail.com>
|
||||
Copyright (C) 2011 Arpad Borsos <arpad.borsos@googlemail.com>
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*jslint browser:true node:true */
|
||||
/*global esprima:true, testFixture:true */
|
||||
|
||||
var runTests;
|
||||
|
||||
// Special handling for regular expression literal since we need to
|
||||
// convert it to a string literal, otherwise it will be decoded
|
||||
// as object "{}" and the regular expression would be lost.
|
||||
function adjustRegexLiteral(key, value) {
|
||||
'use strict';
|
||||
if (key === 'value' && value instanceof RegExp) {
|
||||
value = value.toString();
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
function NotMatchingError(expected, actual) {
|
||||
'use strict';
|
||||
Error.call(this, 'Expected ');
|
||||
this.expected = expected;
|
||||
this.actual = actual;
|
||||
}
|
||||
NotMatchingError.prototype = new Error();
|
||||
|
||||
function errorToObject(e) {
|
||||
'use strict';
|
||||
var msg = e.toString();
|
||||
|
||||
// Opera 9.64 produces an non-standard string in toString().
|
||||
if (msg.substr(0, 6) !== 'Error:') {
|
||||
if (typeof e.message === 'string') {
|
||||
msg = 'Error: ' + e.message;
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
index: e.index,
|
||||
lineNumber: e.lineNumber,
|
||||
column: e.column,
|
||||
message: msg
|
||||
};
|
||||
}
|
||||
|
||||
function sortedObject(o) {
|
||||
if (o === null) {
|
||||
return o;
|
||||
}
|
||||
if (o instanceof Array) {
|
||||
return o.map(sortedObject);
|
||||
}
|
||||
if (typeof o !== 'object') {
|
||||
return o;
|
||||
}
|
||||
if (o instanceof RegExp) {
|
||||
return o;
|
||||
}
|
||||
var keys = Object.keys(o);
|
||||
var result = {
|
||||
range: undefined,
|
||||
loc: undefined
|
||||
};
|
||||
keys.forEach(function (key) {
|
||||
if (o.hasOwnProperty(key)){
|
||||
result[key] = sortedObject(o[key]);
|
||||
}
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
function hasAttachedComment(syntax) {
|
||||
var key;
|
||||
for (key in syntax) {
|
||||
if (key === 'leadingComments' || key === 'trailingComments') {
|
||||
return true;
|
||||
}
|
||||
if (typeof syntax[key] === 'object' && syntax[key] !== null) {
|
||||
if (hasAttachedComment(syntax[key])) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function testParse(esprima, code, syntax) {
|
||||
'use strict';
|
||||
var expected, tree, actual, options, StringObject, i, len, err;
|
||||
|
||||
// alias, so that JSLint does not complain.
|
||||
StringObject = String;
|
||||
|
||||
options = {
|
||||
comment: (typeof syntax.comments !== 'undefined'),
|
||||
range: true,
|
||||
loc: true,
|
||||
tokens: (typeof syntax.tokens !== 'undefined'),
|
||||
raw: true,
|
||||
tolerant: (typeof syntax.errors !== 'undefined'),
|
||||
source: null
|
||||
};
|
||||
|
||||
if (options.comment) {
|
||||
options.attachComment = hasAttachedComment(syntax);
|
||||
}
|
||||
|
||||
if (typeof syntax.tokens !== 'undefined') {
|
||||
if (syntax.tokens.length > 0) {
|
||||
options.range = (typeof syntax.tokens[0].range !== 'undefined');
|
||||
options.loc = (typeof syntax.tokens[0].loc !== 'undefined');
|
||||
}
|
||||
}
|
||||
|
||||
if (typeof syntax.comments !== 'undefined') {
|
||||
if (syntax.comments.length > 0) {
|
||||
options.range = (typeof syntax.comments[0].range !== 'undefined');
|
||||
options.loc = (typeof syntax.comments[0].loc !== 'undefined');
|
||||
}
|
||||
}
|
||||
|
||||
if (options.loc) {
|
||||
options.source = syntax.loc.source;
|
||||
}
|
||||
|
||||
syntax = sortedObject(syntax);
|
||||
expected = JSON.stringify(syntax, null, 4);
|
||||
try {
|
||||
// Some variations of the options.
|
||||
tree = esprima.parse(code, { tolerant: options.tolerant });
|
||||
tree = esprima.parse(code, { tolerant: options.tolerant, range: true });
|
||||
tree = esprima.parse(code, { tolerant: options.tolerant, loc: true });
|
||||
|
||||
tree = esprima.parse(code, options);
|
||||
tree = (options.comment || options.tokens || options.tolerant) ? tree : tree.body[0];
|
||||
|
||||
if (options.tolerant) {
|
||||
for (i = 0, len = tree.errors.length; i < len; i += 1) {
|
||||
tree.errors[i] = errorToObject(tree.errors[i]);
|
||||
}
|
||||
}
|
||||
tree = sortedObject(tree);
|
||||
actual = JSON.stringify(tree, adjustRegexLiteral, 4);
|
||||
|
||||
// Only to ensure that there is no error when using string object.
|
||||
esprima.parse(new StringObject(code), options);
|
||||
|
||||
} catch (e) {
|
||||
throw new NotMatchingError(expected, e.toString());
|
||||
}
|
||||
if (expected !== actual) {
|
||||
throw new NotMatchingError(expected, actual);
|
||||
}
|
||||
|
||||
function filter(key, value) {
|
||||
if (key === 'value' && value instanceof RegExp) {
|
||||
value = value.toString();
|
||||
}
|
||||
return (key === 'loc' || key === 'range') ? undefined : value;
|
||||
}
|
||||
|
||||
if (options.tolerant) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Check again without any location info.
|
||||
options.range = false;
|
||||
options.loc = false;
|
||||
syntax = sortedObject(syntax);
|
||||
expected = JSON.stringify(syntax, filter, 4);
|
||||
try {
|
||||
tree = esprima.parse(code, options);
|
||||
tree = (options.comment || options.tokens) ? tree : tree.body[0];
|
||||
|
||||
if (options.tolerant) {
|
||||
for (i = 0, len = tree.errors.length; i < len; i += 1) {
|
||||
tree.errors[i] = errorToObject(tree.errors[i]);
|
||||
}
|
||||
}
|
||||
tree = sortedObject(tree);
|
||||
actual = JSON.stringify(tree, filter, 4);
|
||||
} catch (e) {
|
||||
throw new NotMatchingError(expected, e.toString());
|
||||
}
|
||||
if (expected !== actual) {
|
||||
throw new NotMatchingError(expected, actual);
|
||||
}
|
||||
}
|
||||
|
||||
function testTokenize(esprima, code, tokens) {
|
||||
'use strict';
|
||||
var options, expected, actual, tree;
|
||||
|
||||
options = {
|
||||
comment: true,
|
||||
tolerant: true,
|
||||
loc: true,
|
||||
range: true
|
||||
};
|
||||
|
||||
expected = JSON.stringify(tokens, null, 4);
|
||||
|
||||
try {
|
||||
tree = esprima.tokenize(code, options);
|
||||
actual = JSON.stringify(tree, null, 4);
|
||||
} catch (e) {
|
||||
throw new NotMatchingError(expected, e.toString());
|
||||
}
|
||||
if (expected !== actual) {
|
||||
throw new NotMatchingError(expected, actual);
|
||||
}
|
||||
}
|
||||
|
||||
function testError(esprima, code, exception) {
|
||||
'use strict';
|
||||
var i, options, expected, actual, err, handleInvalidRegexFlag, tokenize;
|
||||
|
||||
// Different parsing options should give the same error.
|
||||
options = [
|
||||
{},
|
||||
{ comment: true },
|
||||
{ raw: true },
|
||||
{ raw: true, comment: true }
|
||||
];
|
||||
|
||||
// If handleInvalidRegexFlag is true, an invalid flag in a regular expression
|
||||
// will throw an exception. In some old version V8, this is not the case
|
||||
// and hence handleInvalidRegexFlag is false.
|
||||
handleInvalidRegexFlag = false;
|
||||
try {
|
||||
'test'.match(new RegExp('[a-z]', 'x'));
|
||||
} catch (e) {
|
||||
handleInvalidRegexFlag = true;
|
||||
}
|
||||
|
||||
exception.description = exception.message.replace(/Error: Line [0-9]+: /, '');
|
||||
|
||||
if (exception.tokenize) {
|
||||
tokenize = true;
|
||||
exception.tokenize = undefined;
|
||||
}
|
||||
expected = JSON.stringify(exception);
|
||||
|
||||
for (i = 0; i < options.length; i += 1) {
|
||||
|
||||
try {
|
||||
if (tokenize) {
|
||||
esprima.tokenize(code, options[i])
|
||||
} else {
|
||||
esprima.parse(code, options[i]);
|
||||
}
|
||||
} catch (e) {
|
||||
err = errorToObject(e);
|
||||
err.description = e.description;
|
||||
actual = JSON.stringify(err);
|
||||
}
|
||||
|
||||
if (expected !== actual) {
|
||||
|
||||
// Compensate for old V8 which does not handle invalid flag.
|
||||
if (exception.message.indexOf('Invalid regular expression') > 0) {
|
||||
if (typeof actual === 'undefined' && !handleInvalidRegexFlag) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
throw new NotMatchingError(expected, actual);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
function testAPI(esprima, code, result) {
|
||||
'use strict';
|
||||
var expected, res, actual;
|
||||
|
||||
expected = JSON.stringify(result.result, null, 4);
|
||||
try {
|
||||
if (typeof result.property !== 'undefined') {
|
||||
res = esprima[result.property];
|
||||
} else {
|
||||
res = esprima[result.call].apply(esprima, result.args);
|
||||
}
|
||||
actual = JSON.stringify(res, adjustRegexLiteral, 4);
|
||||
} catch (e) {
|
||||
throw new NotMatchingError(expected, e.toString());
|
||||
}
|
||||
if (expected !== actual) {
|
||||
throw new NotMatchingError(expected, actual);
|
||||
}
|
||||
}
|
||||
|
||||
function runTest(esprima, code, result) {
|
||||
'use strict';
|
||||
if (result.hasOwnProperty('lineNumber')) {
|
||||
testError(esprima, code, result);
|
||||
} else if (result.hasOwnProperty('result')) {
|
||||
testAPI(esprima, code, result);
|
||||
} else if (result instanceof Array) {
|
||||
testTokenize(esprima, code, result);
|
||||
} else {
|
||||
testParse(esprima, code, result);
|
||||
}
|
||||
}
|
||||
|
||||
if (typeof window !== 'undefined') {
|
||||
// Run all tests in a browser environment.
|
||||
runTests = function () {
|
||||
'use strict';
|
||||
var total = 0,
|
||||
failures = 0,
|
||||
category,
|
||||
fixture,
|
||||
source,
|
||||
tick,
|
||||
expected,
|
||||
index,
|
||||
len;
|
||||
|
||||
function setText(el, str) {
|
||||
if (typeof el.innerText === 'string') {
|
||||
el.innerText = str;
|
||||
} else {
|
||||
el.textContent = str;
|
||||
}
|
||||
}
|
||||
|
||||
function startCategory(category) {
|
||||
var report, e;
|
||||
report = document.getElementById('report');
|
||||
e = document.createElement('h4');
|
||||
setText(e, category);
|
||||
report.appendChild(e);
|
||||
}
|
||||
|
||||
function reportSuccess(code) {
|
||||
var report, e;
|
||||
report = document.getElementById('report');
|
||||
e = document.createElement('pre');
|
||||
e.setAttribute('class', 'code');
|
||||
setText(e, code);
|
||||
report.appendChild(e);
|
||||
}
|
||||
|
||||
function reportFailure(code, expected, actual) {
|
||||
var report, e;
|
||||
|
||||
report = document.getElementById('report');
|
||||
|
||||
e = document.createElement('p');
|
||||
setText(e, 'Code:');
|
||||
report.appendChild(e);
|
||||
|
||||
e = document.createElement('pre');
|
||||
e.setAttribute('class', 'code');
|
||||
setText(e, code);
|
||||
report.appendChild(e);
|
||||
|
||||
e = document.createElement('p');
|
||||
setText(e, 'Expected');
|
||||
report.appendChild(e);
|
||||
|
||||
e = document.createElement('pre');
|
||||
e.setAttribute('class', 'expected');
|
||||
setText(e, expected);
|
||||
report.appendChild(e);
|
||||
|
||||
e = document.createElement('p');
|
||||
setText(e, 'Actual');
|
||||
report.appendChild(e);
|
||||
|
||||
e = document.createElement('pre');
|
||||
e.setAttribute('class', 'actual');
|
||||
setText(e, actual);
|
||||
report.appendChild(e);
|
||||
}
|
||||
|
||||
setText(document.getElementById('version'), esprima.version);
|
||||
|
||||
tick = new Date();
|
||||
for (category in testFixture) {
|
||||
if (testFixture.hasOwnProperty(category)) {
|
||||
startCategory(category);
|
||||
fixture = testFixture[category];
|
||||
for (source in fixture) {
|
||||
if (fixture.hasOwnProperty(source)) {
|
||||
expected = fixture[source];
|
||||
total += 1;
|
||||
try {
|
||||
runTest(esprima, source, expected);
|
||||
reportSuccess(source, JSON.stringify(expected, null, 4));
|
||||
} catch (e) {
|
||||
failures += 1;
|
||||
reportFailure(source, e.expected, e.actual);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
tick = (new Date()) - tick;
|
||||
|
||||
if (failures > 0) {
|
||||
document.getElementById('status').className = 'alert-box alert';
|
||||
setText(document.getElementById('status'), total + ' tests. ' +
|
||||
'Failures: ' + failures + '. ' + tick + ' ms.');
|
||||
} else {
|
||||
document.getElementById('status').className = 'alert-box success';
|
||||
setText(document.getElementById('status'), total + ' tests. ' +
|
||||
'No failure. ' + tick + ' ms.');
|
||||
}
|
||||
};
|
||||
} else {
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
var esprima = require('../esprima'),
|
||||
vm = require('vm'),
|
||||
fs = require('fs'),
|
||||
diff = require('json-diff').diffString,
|
||||
total = 0,
|
||||
failures = [],
|
||||
tick = new Date(),
|
||||
expected,
|
||||
header;
|
||||
|
||||
vm.runInThisContext(fs.readFileSync(__dirname + '/test.js', 'utf-8'));
|
||||
|
||||
Object.keys(testFixture).forEach(function (category) {
|
||||
Object.keys(testFixture[category]).forEach(function (source) {
|
||||
total += 1;
|
||||
expected = testFixture[category][source];
|
||||
try {
|
||||
runTest(esprima, source, expected);
|
||||
} catch (e) {
|
||||
e.source = source;
|
||||
failures.push(e);
|
||||
}
|
||||
});
|
||||
});
|
||||
tick = (new Date()) - tick;
|
||||
|
||||
header = total + ' tests. ' + failures.length + ' failures. ' +
|
||||
tick + ' ms';
|
||||
if (failures.length) {
|
||||
console.error(header);
|
||||
failures.forEach(function (failure) {
|
||||
try {
|
||||
var expectedObject = JSON.parse(failure.expected);
|
||||
var actualObject = JSON.parse(failure.actual);
|
||||
|
||||
console.error(failure.source + ': Expected\n ' +
|
||||
failure.expected.split('\n').join('\n ') +
|
||||
'\nto match\n ' + failure.actual + '\nDiff:\n' +
|
||||
diff(expectedObject, actualObject));
|
||||
} catch (ex) {
|
||||
console.error(failure.source + ': Expected\n ' +
|
||||
failure.expected.split('\n').join('\n ') +
|
||||
'\nto match\n ' + failure.actual);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
console.log(header);
|
||||
}
|
||||
process.exit(failures.length === 0 ? 0 : 1);
|
||||
}());
|
||||
}
|
25241
node_modules/jsonpath/node_modules/esprima/test/test.js
generated
vendored
Normal file
25241
node_modules/jsonpath/node_modules/esprima/test/test.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
23
node_modules/jsonpath/node_modules/underscore/LICENSE
generated
vendored
Normal file
23
node_modules/jsonpath/node_modules/underscore/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
Copyright (c) 2009-2020 Jeremy Ashkenas, DocumentCloud and Investigative
|
||||
Reporters & Editors
|
||||
|
||||
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.
|
28
node_modules/jsonpath/node_modules/underscore/README.md
generated
vendored
Normal file
28
node_modules/jsonpath/node_modules/underscore/README.md
generated
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
__
|
||||
/\ \ __
|
||||
__ __ ___ \_\ \ __ _ __ ____ ___ ___ _ __ __ /\_\ ____
|
||||
/\ \/\ \ /' _ `\ /'_ \ /'__`\/\ __\/ ,__\ / ___\ / __`\/\ __\/'__`\ \/\ \ /',__\
|
||||
\ \ \_\ \/\ \/\ \/\ \ \ \/\ __/\ \ \//\__, `\/\ \__//\ \ \ \ \ \//\ __/ __ \ \ \/\__, `\
|
||||
\ \____/\ \_\ \_\ \___,_\ \____\\ \_\\/\____/\ \____\ \____/\ \_\\ \____\/\_\ _\ \ \/\____/
|
||||
\/___/ \/_/\/_/\/__,_ /\/____/ \/_/ \/___/ \/____/\/___/ \/_/ \/____/\/_//\ \_\ \/___/
|
||||
\ \____/
|
||||
\/___/
|
||||
|
||||
Underscore.js is a utility-belt library for JavaScript that provides
|
||||
support for the usual functional suspects (each, map, reduce, filter...)
|
||||
without extending any core JavaScript objects.
|
||||
|
||||
For Docs, License, Tests, and pre-packed downloads, see:
|
||||
https://underscorejs.org
|
||||
|
||||
For support and questions, please use
|
||||
[the gitter channel](https://gitter.im/jashkenas/underscore)
|
||||
or [stackoverflow](https://stackoverflow.com/search?q=underscore.js)
|
||||
|
||||
Underscore is an open-sourced component of DocumentCloud:
|
||||
https://github.com/documentcloud
|
||||
|
||||
Many thanks to our contributors:
|
||||
https://github.com/jashkenas/underscore/contributors
|
||||
|
||||
This project adheres to a [code of conduct](CODE_OF_CONDUCT.md). By participating, you are expected to uphold this code.
|
7
node_modules/jsonpath/node_modules/underscore/amd/_apply.js
generated
vendored
Normal file
7
node_modules/jsonpath/node_modules/underscore/amd/_apply.js
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
define(['./_setup', './_unmethodize'], function (_setup, _unmethodize) {
|
||||
|
||||
var apply = _unmethodize(_setup.apply);
|
||||
|
||||
return apply;
|
||||
|
||||
});
|
14
node_modules/jsonpath/node_modules/underscore/amd/_applyProperty.js
generated
vendored
Normal file
14
node_modules/jsonpath/node_modules/underscore/amd/_applyProperty.js
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
define(function () {
|
||||
|
||||
// Internal helper that wraps an `iteratee` to call it with the
|
||||
// property of a closed-over `object`. Useful when iterating over
|
||||
// an array of keys of `object`.
|
||||
function applyProperty(iteratee, object) {
|
||||
return function(key) {
|
||||
return iteratee(object[key], key, object);
|
||||
};
|
||||
}
|
||||
|
||||
return applyProperty;
|
||||
|
||||
});
|
11
node_modules/jsonpath/node_modules/underscore/amd/_arrayAccessors.js
generated
vendored
Normal file
11
node_modules/jsonpath/node_modules/underscore/amd/_arrayAccessors.js
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
define(['exports', './concat', './join', './slice'], function (exports, concat, join, slice) {
|
||||
|
||||
|
||||
|
||||
exports.concat = concat;
|
||||
exports.join = join;
|
||||
exports.slice = slice;
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
});
|
15
node_modules/jsonpath/node_modules/underscore/amd/_arrayMutators.js
generated
vendored
Normal file
15
node_modules/jsonpath/node_modules/underscore/amd/_arrayMutators.js
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
define(['exports', './pop', './push', './reverse', './shift', './sort', './splice', './unshift'], function (exports, pop, push, reverse, shift, sort, splice, unshift) {
|
||||
|
||||
|
||||
|
||||
exports.pop = pop;
|
||||
exports.push = push;
|
||||
exports.reverse = reverse;
|
||||
exports.shift = shift;
|
||||
exports.sort = sort;
|
||||
exports.splice = splice;
|
||||
exports.unshift = unshift;
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
});
|
21
node_modules/jsonpath/node_modules/underscore/amd/_baseCreate.js
generated
vendored
Normal file
21
node_modules/jsonpath/node_modules/underscore/amd/_baseCreate.js
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
define(['./isObject', './_setup'], function (isObject, _setup) {
|
||||
|
||||
// Create a naked function reference for surrogate-prototype-swapping.
|
||||
function ctor() {
|
||||
return function(){};
|
||||
}
|
||||
|
||||
// An internal function for creating a new object that inherits from another.
|
||||
function baseCreate(prototype) {
|
||||
if (!isObject(prototype)) return {};
|
||||
if (_setup.nativeCreate) return _setup.nativeCreate(prototype);
|
||||
var Ctor = ctor();
|
||||
Ctor.prototype = prototype;
|
||||
var result = new Ctor;
|
||||
Ctor.prototype = null;
|
||||
return result;
|
||||
}
|
||||
|
||||
return baseCreate;
|
||||
|
||||
});
|
15
node_modules/jsonpath/node_modules/underscore/amd/_baseIteratee.js
generated
vendored
Normal file
15
node_modules/jsonpath/node_modules/underscore/amd/_baseIteratee.js
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
define(['./isObject', './identity', './isFunction', './isArray', './matcher', './property', './_optimizeCb'], function (isObject, identity, isFunction, isArray, matcher, property, _optimizeCb) {
|
||||
|
||||
// An internal function to generate callbacks that can be applied to each
|
||||
// element in a collection, returning the desired result — either `_.identity`,
|
||||
// an arbitrary callback, a property matcher, or a property accessor.
|
||||
function baseIteratee(value, context, argCount) {
|
||||
if (value == null) return identity;
|
||||
if (isFunction(value)) return _optimizeCb(value, context, argCount);
|
||||
if (isObject(value) && !isArray(value)) return matcher(value);
|
||||
return property(value);
|
||||
}
|
||||
|
||||
return baseIteratee;
|
||||
|
||||
});
|
17
node_modules/jsonpath/node_modules/underscore/amd/_binarySearch.js
generated
vendored
Normal file
17
node_modules/jsonpath/node_modules/underscore/amd/_binarySearch.js
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
define(['./_getLength'], function (_getLength) {
|
||||
|
||||
// Iteratively cut `array` in half to figure out the index at which `obj` should
|
||||
// be inserted so as to maintain the order defined by `compare`.
|
||||
function binarySearch(array, obj, iteratee, compare) {
|
||||
var value = iteratee(obj);
|
||||
var low = 0, high = _getLength(array);
|
||||
while (low < high) {
|
||||
var mid = Math.floor((low + high) / 2);
|
||||
if (compare(iteratee(array[mid]), value)) low = mid + 1; else high = mid;
|
||||
}
|
||||
return low;
|
||||
}
|
||||
|
||||
return binarySearch;
|
||||
|
||||
});
|
14
node_modules/jsonpath/node_modules/underscore/amd/_bindCb.js
generated
vendored
Normal file
14
node_modules/jsonpath/node_modules/underscore/amd/_bindCb.js
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
define(function () {
|
||||
|
||||
// Internal function that returns a bound version of the passed-in callback, to
|
||||
// be repeatedly applied in other Underscore functions.
|
||||
function bindCb(func, context) {
|
||||
if (context === void 0) return func;
|
||||
return function() {
|
||||
return func.apply(context, arguments);
|
||||
};
|
||||
}
|
||||
|
||||
return bindCb;
|
||||
|
||||
});
|
17
node_modules/jsonpath/node_modules/underscore/amd/_bindCb4.js
generated
vendored
Normal file
17
node_modules/jsonpath/node_modules/underscore/amd/_bindCb4.js
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
define(function () {
|
||||
|
||||
// In Firefox, `Function.prototype.call` is faster than
|
||||
// `Function.prototype.apply`. In the optimized variant of
|
||||
// `bindCb` below, we exploit the fact that no Underscore
|
||||
// function passes more than four arguments to a callback.
|
||||
// **NOT general enough for use outside of Underscore.**
|
||||
function bindCb4(func, context) {
|
||||
if (context === void 0) return func;
|
||||
return function(a1, a2, a3, a4) {
|
||||
return func.call(context, a1, a2, a3, a4);
|
||||
};
|
||||
}
|
||||
|
||||
return bindCb4;
|
||||
|
||||
});
|
11
node_modules/jsonpath/node_modules/underscore/amd/_byValue.js
generated
vendored
Normal file
11
node_modules/jsonpath/node_modules/underscore/amd/_byValue.js
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
define(function () {
|
||||
|
||||
// Internal wrapper to enable match-by-value mode in `linearSearch`.
|
||||
function byValue(value) {
|
||||
if (!(this instanceof byValue)) return new byValue(value);
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
return byValue;
|
||||
|
||||
});
|
12
node_modules/jsonpath/node_modules/underscore/amd/_cb.js
generated
vendored
Normal file
12
node_modules/jsonpath/node_modules/underscore/amd/_cb.js
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
define(['./underscore', './_baseIteratee', './iteratee'], function (underscore, _baseIteratee, iteratee) {
|
||||
|
||||
// The function we call internally to generate a callback. It invokes
|
||||
// `_.iteratee` if overridden, otherwise `baseIteratee`.
|
||||
function cb(value, context, argCount) {
|
||||
if (underscore.iteratee !== iteratee) return underscore.iteratee(value, context);
|
||||
return _baseIteratee(value, context, argCount);
|
||||
}
|
||||
|
||||
return cb;
|
||||
|
||||
});
|
10
node_modules/jsonpath/node_modules/underscore/amd/_chainResult.js
generated
vendored
Normal file
10
node_modules/jsonpath/node_modules/underscore/amd/_chainResult.js
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
define(['./underscore'], function (underscore) {
|
||||
|
||||
// Helper function to continue chaining intermediate results.
|
||||
function chainResult(instance, obj) {
|
||||
return instance._chain ? underscore(obj).chain() : obj;
|
||||
}
|
||||
|
||||
return chainResult;
|
||||
|
||||
});
|
42
node_modules/jsonpath/node_modules/underscore/amd/_collectNonEnumProps.js
generated
vendored
Normal file
42
node_modules/jsonpath/node_modules/underscore/amd/_collectNonEnumProps.js
generated
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
define(['./_setup', './isFunction', './_has'], function (_setup, isFunction, _has) {
|
||||
|
||||
// Internal helper to create a simple lookup structure.
|
||||
// `collectNonEnumProps` used to depend on `_.contains`, but this led to
|
||||
// circular imports. `emulatedSet` is a one-off solution that only works for
|
||||
// arrays of strings.
|
||||
function emulatedSet(keys) {
|
||||
var hash = {};
|
||||
for (var l = keys.length, i = 0; i < l; ++i) hash[keys[i]] = true;
|
||||
return {
|
||||
contains: function(key) { return hash[key]; },
|
||||
push: function(key) {
|
||||
hash[key] = true;
|
||||
return keys.push(key);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// Internal helper. Checks `keys` for the presence of keys in IE < 9 that won't
|
||||
// be iterated by `for key in ...` and thus missed. Extends `keys` in place if
|
||||
// needed.
|
||||
function collectNonEnumProps(obj, keys) {
|
||||
keys = emulatedSet(keys);
|
||||
var nonEnumIdx = _setup.nonEnumerableProps.length;
|
||||
var constructor = obj.constructor;
|
||||
var proto = isFunction(constructor) && constructor.prototype || _setup.ObjProto;
|
||||
|
||||
// Constructor is a special case.
|
||||
var prop = 'constructor';
|
||||
if (_has(obj, prop) && !keys.contains(prop)) keys.push(prop);
|
||||
|
||||
while (nonEnumIdx--) {
|
||||
prop = _setup.nonEnumerableProps[nonEnumIdx];
|
||||
if (prop in obj && obj[prop] !== proto[prop] && !keys.contains(prop)) {
|
||||
keys.push(prop);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return collectNonEnumProps;
|
||||
|
||||
});
|
24
node_modules/jsonpath/node_modules/underscore/amd/_createAssigner.js
generated
vendored
Normal file
24
node_modules/jsonpath/node_modules/underscore/amd/_createAssigner.js
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
define(function () {
|
||||
|
||||
// An internal function for creating assigner functions.
|
||||
function createAssigner(keysFunc, defaults) {
|
||||
return function(obj) {
|
||||
var length = arguments.length;
|
||||
if (defaults) obj = Object(obj);
|
||||
if (length < 2 || obj == null) return obj;
|
||||
for (var index = 1; index < length; index++) {
|
||||
var source = arguments[index],
|
||||
keys = keysFunc(source),
|
||||
l = keys.length;
|
||||
for (var i = 0; i < l; i++) {
|
||||
var key = keys[i];
|
||||
if (!defaults || obj[key] === void 0) obj[key] = source[key];
|
||||
}
|
||||
}
|
||||
return obj;
|
||||
};
|
||||
}
|
||||
|
||||
return createAssigner;
|
||||
|
||||
});
|
21
node_modules/jsonpath/node_modules/underscore/amd/_createEscaper.js
generated
vendored
Normal file
21
node_modules/jsonpath/node_modules/underscore/amd/_createEscaper.js
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
define(['./keys'], function (keys) {
|
||||
|
||||
// Internal helper to generate functions for escaping and unescaping strings
|
||||
// to/from HTML interpolation.
|
||||
function createEscaper(map) {
|
||||
var escaper = function(match) {
|
||||
return map[match];
|
||||
};
|
||||
// Regexes for identifying a key that needs to be escaped.
|
||||
var source = '(?:' + keys(map).join('|') + ')';
|
||||
var testRegexp = RegExp(source);
|
||||
var replaceRegexp = RegExp(source, 'g');
|
||||
return function(string) {
|
||||
string = string == null ? '' : '' + string;
|
||||
return testRegexp.test(string) ? string.replace(replaceRegexp, escaper) : string;
|
||||
};
|
||||
}
|
||||
|
||||
return createEscaper;
|
||||
|
||||
});
|
30
node_modules/jsonpath/node_modules/underscore/amd/_createIndexFinder.js
generated
vendored
Normal file
30
node_modules/jsonpath/node_modules/underscore/amd/_createIndexFinder.js
generated
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
define(['./_setup', './_getLength', './isNaN'], function (_setup, _getLength, _isNaN) {
|
||||
|
||||
// Internal function to generate the `_.indexOf` and `_.lastIndexOf` functions.
|
||||
function createIndexFinder(dir, predicateFind, sortedIndex) {
|
||||
return function(array, item, idx) {
|
||||
var i = 0, length = _getLength(array);
|
||||
if (typeof idx == 'number') {
|
||||
if (dir > 0) {
|
||||
i = idx >= 0 ? idx : Math.max(idx + length, i);
|
||||
} else {
|
||||
length = idx >= 0 ? Math.min(idx + 1, length) : idx + length + 1;
|
||||
}
|
||||
} else if (sortedIndex && idx && length) {
|
||||
idx = sortedIndex(array, item);
|
||||
return array[idx] === item ? idx : -1;
|
||||
}
|
||||
if (item !== item) {
|
||||
idx = predicateFind(_setup.slice.call(array, i, length), _isNaN);
|
||||
return idx >= 0 ? idx + i : -1;
|
||||
}
|
||||
for (idx = dir > 0 ? i : length - 1; idx >= 0 && idx < length; idx += dir) {
|
||||
if (array[idx] === item) return idx;
|
||||
}
|
||||
return -1;
|
||||
};
|
||||
}
|
||||
|
||||
return createIndexFinder;
|
||||
|
||||
});
|
18
node_modules/jsonpath/node_modules/underscore/amd/_createPredicateIndexFinder.js
generated
vendored
Normal file
18
node_modules/jsonpath/node_modules/underscore/amd/_createPredicateIndexFinder.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
define(['./_cb', './_getLength'], function (_cb, _getLength) {
|
||||
|
||||
// Internal function to generate `_.findIndex` and `_.findLastIndex`.
|
||||
function createPredicateIndexFinder(dir) {
|
||||
return function(array, predicate, context) {
|
||||
predicate = _cb(predicate, context);
|
||||
var length = _getLength(array);
|
||||
var index = dir > 0 ? 0 : length - 1;
|
||||
for (; index >= 0 && index < length; index += dir) {
|
||||
if (predicate(array[index], index, array)) return index;
|
||||
}
|
||||
return -1;
|
||||
};
|
||||
}
|
||||
|
||||
return createPredicateIndexFinder;
|
||||
|
||||
});
|
30
node_modules/jsonpath/node_modules/underscore/amd/_createReduce.js
generated
vendored
Normal file
30
node_modules/jsonpath/node_modules/underscore/amd/_createReduce.js
generated
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
define(['./keys', './_optimizeCb', './_isArrayLike'], function (keys, _optimizeCb, _isArrayLike) {
|
||||
|
||||
// Internal helper to create a reducing function, iterating left or right.
|
||||
function createReduce(dir) {
|
||||
// Wrap code that reassigns argument variables in a separate function than
|
||||
// the one that accesses `arguments.length` to avoid a perf hit. (#1991)
|
||||
var reducer = function(obj, iteratee, memo, initial) {
|
||||
var _keys = !_isArrayLike(obj) && keys(obj),
|
||||
length = (_keys || obj).length,
|
||||
index = dir > 0 ? 0 : length - 1;
|
||||
if (!initial) {
|
||||
memo = obj[_keys ? _keys[index] : index];
|
||||
index += dir;
|
||||
}
|
||||
for (; index >= 0 && index < length; index += dir) {
|
||||
var currentKey = _keys ? _keys[index] : index;
|
||||
memo = iteratee(memo, obj[currentKey], currentKey, obj);
|
||||
}
|
||||
return memo;
|
||||
};
|
||||
|
||||
return function(obj, iteratee, memo, context) {
|
||||
var initial = arguments.length >= 3;
|
||||
return reducer(obj, _optimizeCb(iteratee, context, 4), memo, initial);
|
||||
};
|
||||
}
|
||||
|
||||
return createReduce;
|
||||
|
||||
});
|
13
node_modules/jsonpath/node_modules/underscore/amd/_createSizePropertyCheck.js
generated
vendored
Normal file
13
node_modules/jsonpath/node_modules/underscore/amd/_createSizePropertyCheck.js
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
define(['./_setup'], function (_setup) {
|
||||
|
||||
// Common internal logic for `isArrayLike` and `isBufferLike`.
|
||||
function createSizePropertyCheck(getSizeProperty) {
|
||||
return function(collection) {
|
||||
var sizeProperty = getSizeProperty(collection);
|
||||
return typeof sizeProperty == 'number' && sizeProperty >= 0 && sizeProperty <= _setup.MAX_ARRAY_INDEX;
|
||||
}
|
||||
}
|
||||
|
||||
return createSizePropertyCheck;
|
||||
|
||||
});
|
15
node_modules/jsonpath/node_modules/underscore/amd/_deepGet.js
generated
vendored
Normal file
15
node_modules/jsonpath/node_modules/underscore/amd/_deepGet.js
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
define(function () {
|
||||
|
||||
// Internal function to obtain a nested property in `obj` along `path`.
|
||||
function deepGet(obj, path) {
|
||||
var length = path.length;
|
||||
for (var i = 0; i < length; i++) {
|
||||
if (obj == null) return void 0;
|
||||
obj = obj[path[i]];
|
||||
}
|
||||
return length ? obj : void 0;
|
||||
}
|
||||
|
||||
return deepGet;
|
||||
|
||||
});
|
15
node_modules/jsonpath/node_modules/underscore/amd/_escapeMap.js
generated
vendored
Normal file
15
node_modules/jsonpath/node_modules/underscore/amd/_escapeMap.js
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
define(function () {
|
||||
|
||||
// Internal list of HTML entities for escaping.
|
||||
var escapeMap = {
|
||||
'&': '&',
|
||||
'<': '<',
|
||||
'>': '>',
|
||||
'"': '"',
|
||||
"'": ''',
|
||||
'`': '`'
|
||||
};
|
||||
|
||||
return escapeMap;
|
||||
|
||||
});
|
16
node_modules/jsonpath/node_modules/underscore/amd/_executeBound.js
generated
vendored
Normal file
16
node_modules/jsonpath/node_modules/underscore/amd/_executeBound.js
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
define(['./isObject', './_baseCreate'], function (isObject, _baseCreate) {
|
||||
|
||||
// Internal function to execute `sourceFunc` bound to `context` with optional
|
||||
// `args`. Determines whether to execute a function as a constructor or as a
|
||||
// normal function.
|
||||
function executeBound(sourceFunc, boundFunc, context, callingContext, args) {
|
||||
if (!(callingContext instanceof boundFunc)) return sourceFunc.apply(context, args);
|
||||
var self = _baseCreate(sourceFunc.prototype);
|
||||
var result = sourceFunc.apply(self, args);
|
||||
if (isObject(result)) return result;
|
||||
return self;
|
||||
}
|
||||
|
||||
return executeBound;
|
||||
|
||||
});
|
35
node_modules/jsonpath/node_modules/underscore/amd/_extremum.js
generated
vendored
Normal file
35
node_modules/jsonpath/node_modules/underscore/amd/_extremum.js
generated
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
define(['./identity', './_cb', './find'], function (identity, _cb, find) {
|
||||
|
||||
// The general algorithm behind `_.min` and `_.max`. `compare` should return
|
||||
// `true` if its first argument is more extreme than (i.e., should be preferred
|
||||
// over) its second argument, `false` otherwise. `iteratee` and `context`, like
|
||||
// in other collection functions, let you map the actual values in `collection`
|
||||
// to the values to `compare`. `decide` is an optional customization point
|
||||
// which is only present for historical reasons; please don't use it, as it will
|
||||
// likely be removed in the future.
|
||||
function extremum(collection, compare, iteratee, context, decide) {
|
||||
decide || (decide = identity);
|
||||
// `extremum` is essentially a combined map+reduce with **two** accumulators:
|
||||
// `result` and `iterResult`, respectively the unmapped and the mapped version
|
||||
// corresponding to the same element.
|
||||
var result, iterResult;
|
||||
iteratee = _cb(iteratee, context);
|
||||
var first = true;
|
||||
find(collection, function(value, key) {
|
||||
var iterValue = iteratee(value, key, collection);
|
||||
if (first || compare(iterValue, iterResult)) {
|
||||
result = value;
|
||||
iterResult = iterValue;
|
||||
first = false;
|
||||
}
|
||||
});
|
||||
// `extremum` normally returns an unmapped element from `collection`. However,
|
||||
// `_.min` and `_.max` forcibly return a number even if there is no element
|
||||
// that maps to a numeric value. Passing both accumulators through `decide`
|
||||
// before returning enables this behavior.
|
||||
return decide(result, iterResult);
|
||||
}
|
||||
|
||||
return extremum;
|
||||
|
||||
});
|
32
node_modules/jsonpath/node_modules/underscore/amd/_flatten.js
generated
vendored
Normal file
32
node_modules/jsonpath/node_modules/underscore/amd/_flatten.js
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
define(['./isArray', './_getLength', './_isArrayLike', './isArguments'], function (isArray, _getLength, _isArrayLike, isArguments) {
|
||||
|
||||
// Internal implementation of a recursive `flatten` function.
|
||||
function flatten(input, depth, strict, output) {
|
||||
output = output || [];
|
||||
if (!depth && depth !== 0) {
|
||||
depth = Infinity;
|
||||
} else if (depth <= 0) {
|
||||
return output.concat(input);
|
||||
}
|
||||
var idx = output.length;
|
||||
for (var i = 0, length = _getLength(input); i < length; i++) {
|
||||
var value = input[i];
|
||||
if (_isArrayLike(value) && (isArray(value) || isArguments(value))) {
|
||||
// Flatten current level of array or arguments object.
|
||||
if (depth > 1) {
|
||||
flatten(value, depth - 1, strict, output);
|
||||
idx = output.length;
|
||||
} else {
|
||||
var j = 0, len = value.length;
|
||||
while (j < len) output[idx++] = value[j++];
|
||||
}
|
||||
} else if (!strict) {
|
||||
output[idx++] = value;
|
||||
}
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
return flatten;
|
||||
|
||||
});
|
16
node_modules/jsonpath/node_modules/underscore/amd/_forceNumericMinMax.js
generated
vendored
Normal file
16
node_modules/jsonpath/node_modules/underscore/amd/_forceNumericMinMax.js
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
define(['exports', './isNaN'], function (exports, _isNaN) {
|
||||
|
||||
// Internal `extremum` return value adapter for `_.min` and `_.max`.
|
||||
// Ensures that a number is returned even if no element of the
|
||||
// collection maps to a numeric value.
|
||||
function decideNumeric(fallback) {
|
||||
return function(result, iterResult) {
|
||||
return _isNaN(+iterResult) ? fallback : result;
|
||||
}
|
||||
}
|
||||
|
||||
exports.decideNumeric = decideNumeric;
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
});
|
8
node_modules/jsonpath/node_modules/underscore/amd/_getByteLength.js
generated
vendored
Normal file
8
node_modules/jsonpath/node_modules/underscore/amd/_getByteLength.js
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
define(['./_shallowProperty'], function (_shallowProperty) {
|
||||
|
||||
// Internal helper to obtain the `byteLength` property of an object.
|
||||
var getByteLength = _shallowProperty('byteLength');
|
||||
|
||||
return getByteLength;
|
||||
|
||||
});
|
8
node_modules/jsonpath/node_modules/underscore/amd/_getLength.js
generated
vendored
Normal file
8
node_modules/jsonpath/node_modules/underscore/amd/_getLength.js
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
define(['./_shallowProperty'], function (_shallowProperty) {
|
||||
|
||||
// Internal helper to obtain the `length` property of an object.
|
||||
var getLength = _shallowProperty('length');
|
||||
|
||||
return getLength;
|
||||
|
||||
});
|
10
node_modules/jsonpath/node_modules/underscore/amd/_greater.js
generated
vendored
Normal file
10
node_modules/jsonpath/node_modules/underscore/amd/_greater.js
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
define(function () {
|
||||
|
||||
// A version of the `>` operator that can be passed around as a function.
|
||||
function greater(left, right) {
|
||||
return left > right;
|
||||
}
|
||||
|
||||
return greater;
|
||||
|
||||
});
|
18
node_modules/jsonpath/node_modules/underscore/amd/_group.js
generated
vendored
Normal file
18
node_modules/jsonpath/node_modules/underscore/amd/_group.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
define(['./_cb', './each'], function (_cb, each) {
|
||||
|
||||
// An internal function used for aggregate "group by" operations.
|
||||
function group(behavior, partition) {
|
||||
return function(obj, iteratee, context) {
|
||||
var result = partition ? [[], []] : {};
|
||||
iteratee = _cb(iteratee, context);
|
||||
each(obj, function(value, index) {
|
||||
var key = iteratee(value, index, obj);
|
||||
behavior(result, value, key);
|
||||
});
|
||||
return result;
|
||||
};
|
||||
}
|
||||
|
||||
return group;
|
||||
|
||||
});
|
10
node_modules/jsonpath/node_modules/underscore/amd/_has.js
generated
vendored
Normal file
10
node_modules/jsonpath/node_modules/underscore/amd/_has.js
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
define(['./_setup'], function (_setup) {
|
||||
|
||||
// Internal function to check whether `key` is an own property name of `obj`.
|
||||
function has(obj, key) {
|
||||
return obj != null && _setup.hasOwnProperty.call(obj, key);
|
||||
}
|
||||
|
||||
return has;
|
||||
|
||||
});
|
7
node_modules/jsonpath/node_modules/underscore/amd/_hasObjectTag.js
generated
vendored
Normal file
7
node_modules/jsonpath/node_modules/underscore/amd/_hasObjectTag.js
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
define(['./_tagTester'], function (_tagTester) {
|
||||
|
||||
var hasObjectTag = _tagTester('Object');
|
||||
|
||||
return hasObjectTag;
|
||||
|
||||
});
|
11
node_modules/jsonpath/node_modules/underscore/amd/_isArrayLike.js
generated
vendored
Normal file
11
node_modules/jsonpath/node_modules/underscore/amd/_isArrayLike.js
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
define(['./_getLength', './_createSizePropertyCheck'], function (_getLength, _createSizePropertyCheck) {
|
||||
|
||||
// Internal helper for collection methods to determine whether a collection
|
||||
// should be iterated as an array or as an object.
|
||||
// Related: https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength
|
||||
// Avoids a very nasty iOS 8 JIT bug on ARM-64. #2094
|
||||
var isArrayLike = _createSizePropertyCheck(_getLength);
|
||||
|
||||
return isArrayLike;
|
||||
|
||||
});
|
9
node_modules/jsonpath/node_modules/underscore/amd/_isBufferLike.js
generated
vendored
Normal file
9
node_modules/jsonpath/node_modules/underscore/amd/_isBufferLike.js
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
define(['./_createSizePropertyCheck', './_getByteLength'], function (_createSizePropertyCheck, _getByteLength) {
|
||||
|
||||
// Internal helper to determine whether we should spend extensive checks against
|
||||
// `ArrayBuffer` et al.
|
||||
var isBufferLike = _createSizePropertyCheck(_getByteLength);
|
||||
|
||||
return isBufferLike;
|
||||
|
||||
});
|
11
node_modules/jsonpath/node_modules/underscore/amd/_keyInObj.js
generated
vendored
Normal file
11
node_modules/jsonpath/node_modules/underscore/amd/_keyInObj.js
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
define(function () {
|
||||
|
||||
// Internal `_.pick` helper function to determine whether `key` is an enumerable
|
||||
// property name of `obj`.
|
||||
function keyInObj(value, key, obj) {
|
||||
return key in obj;
|
||||
}
|
||||
|
||||
return keyInObj;
|
||||
|
||||
});
|
10
node_modules/jsonpath/node_modules/underscore/amd/_less.js
generated
vendored
Normal file
10
node_modules/jsonpath/node_modules/underscore/amd/_less.js
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
define(function () {
|
||||
|
||||
// A version of the `<` operator that can be passed around as a function.
|
||||
function less(left, right) {
|
||||
return left < right;
|
||||
}
|
||||
|
||||
return less;
|
||||
|
||||
});
|
10
node_modules/jsonpath/node_modules/underscore/amd/_lessEqual.js
generated
vendored
Normal file
10
node_modules/jsonpath/node_modules/underscore/amd/_lessEqual.js
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
define(function () {
|
||||
|
||||
// A version of the `<=` operator that can be passed around as a function.
|
||||
function lessEqual(left, right) {
|
||||
return left <= right;
|
||||
}
|
||||
|
||||
return lessEqual;
|
||||
|
||||
});
|
31
node_modules/jsonpath/node_modules/underscore/amd/_linearSearch.js
generated
vendored
Normal file
31
node_modules/jsonpath/node_modules/underscore/amd/_linearSearch.js
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
define(['./_getLength', './isFunction'], function (_getLength, isFunction) {
|
||||
|
||||
// Internal function for linearly iterating over arrays.
|
||||
function linearSearch(array, predicate, dir, start) {
|
||||
var target, length = _getLength(array);
|
||||
dir || (dir = 1);
|
||||
start = (
|
||||
start == null ? (dir > 0 ? 0 : length - 1) :
|
||||
start < 0 ? (dir > 0 ? Math.max(0, start + length) : start + length) :
|
||||
dir > 0 ? start : Math.min(start, length - 1)
|
||||
);
|
||||
// As a special case, in order to elide the `predicate` invocation on every
|
||||
// loop iteration, we allow the caller to pass a value that should be found by
|
||||
// strict equality comparison. This is somewhat like a rudimentary iteratee
|
||||
// shorthand. It is used in `_.indexof` and `_.lastIndexOf`.
|
||||
if (!isFunction(predicate)) {
|
||||
target = predicate && predicate.value;
|
||||
predicate = false;
|
||||
}
|
||||
for (; start >= 0 && start < length; start += dir) {
|
||||
if (
|
||||
predicate ? predicate(array[start], start, array) :
|
||||
array[start] === target
|
||||
) return start;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
return linearSearch;
|
||||
|
||||
});
|
5
node_modules/jsonpath/node_modules/underscore/amd/_mapReduce.js
generated
vendored
Normal file
5
node_modules/jsonpath/node_modules/underscore/amd/_mapReduce.js
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
define(function () {
|
||||
|
||||
|
||||
|
||||
});
|
44
node_modules/jsonpath/node_modules/underscore/amd/_methodFingerprint.js
generated
vendored
Normal file
44
node_modules/jsonpath/node_modules/underscore/amd/_methodFingerprint.js
generated
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
define(['exports', './isFunction', './_getLength', './allKeys'], function (exports, isFunction, _getLength, allKeys) {
|
||||
|
||||
// Since the regular `Object.prototype.toString` type tests don't work for
|
||||
// some types in IE 11, we use a fingerprinting heuristic instead, based
|
||||
// on the methods. It's not great, but it's the best we got.
|
||||
// The fingerprint method lists are defined below.
|
||||
function ie11fingerprint(methods) {
|
||||
var length = _getLength(methods);
|
||||
return function(obj) {
|
||||
if (obj == null) return false;
|
||||
// `Map`, `WeakMap` and `Set` have no enumerable keys.
|
||||
var keys = allKeys(obj);
|
||||
if (_getLength(keys)) return false;
|
||||
for (var i = 0; i < length; i++) {
|
||||
if (!isFunction(obj[methods[i]])) return false;
|
||||
}
|
||||
// If we are testing against `WeakMap`, we need to ensure that
|
||||
// `obj` doesn't have a `forEach` method in order to distinguish
|
||||
// it from a regular `Map`.
|
||||
return methods !== weakMapMethods || !isFunction(obj[forEachName]);
|
||||
};
|
||||
}
|
||||
|
||||
// In the interest of compact minification, we write
|
||||
// each string in the fingerprints only once.
|
||||
var forEachName = 'forEach',
|
||||
hasName = 'has',
|
||||
commonInit = ['clear', 'delete'],
|
||||
mapTail = ['get', hasName, 'set'];
|
||||
|
||||
// `Map`, `WeakMap` and `Set` each have slightly different
|
||||
// combinations of the above sublists.
|
||||
var mapMethods = commonInit.concat(forEachName, mapTail),
|
||||
weakMapMethods = commonInit.concat(mapTail),
|
||||
setMethods = ['add'].concat(commonInit, forEachName, hasName);
|
||||
|
||||
exports.ie11fingerprint = ie11fingerprint;
|
||||
exports.mapMethods = mapMethods;
|
||||
exports.setMethods = setMethods;
|
||||
exports.weakMapMethods = weakMapMethods;
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
});
|
27
node_modules/jsonpath/node_modules/underscore/amd/_optimizeCb.js
generated
vendored
Normal file
27
node_modules/jsonpath/node_modules/underscore/amd/_optimizeCb.js
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
define(function () {
|
||||
|
||||
// Internal function that returns an efficient (for current engines) version
|
||||
// of the passed-in callback, to be repeatedly applied in other Underscore
|
||||
// functions.
|
||||
function optimizeCb(func, context, argCount) {
|
||||
if (context === void 0) return func;
|
||||
switch (argCount == null ? 3 : argCount) {
|
||||
case 1: return function(value) {
|
||||
return func.call(context, value);
|
||||
};
|
||||
// The 2-argument case is omitted because we’re not using it.
|
||||
case 3: return function(value, index, collection) {
|
||||
return func.call(context, value, index, collection);
|
||||
};
|
||||
case 4: return function(accumulator, value, index, collection) {
|
||||
return func.call(context, accumulator, value, index, collection);
|
||||
};
|
||||
}
|
||||
return function() {
|
||||
return func.apply(context, arguments);
|
||||
};
|
||||
}
|
||||
|
||||
return optimizeCb;
|
||||
|
||||
});
|
7
node_modules/jsonpath/node_modules/underscore/amd/_push.js
generated
vendored
Normal file
7
node_modules/jsonpath/node_modules/underscore/amd/_push.js
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
define(['./_setup', './_unmethodize'], function (_setup, _unmethodize) {
|
||||
|
||||
var push = _unmethodize(_setup.ArrayProto.push);
|
||||
|
||||
return push;
|
||||
|
||||
});
|
13
node_modules/jsonpath/node_modules/underscore/amd/_pusher.js
generated
vendored
Normal file
13
node_modules/jsonpath/node_modules/underscore/amd/_pusher.js
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
define(function () {
|
||||
|
||||
// Internal helper to generate a callback that will append
|
||||
// its first argument to the closed-over `array`.
|
||||
function pusher(array) {
|
||||
return function(arg) {
|
||||
array.push(arg);
|
||||
};
|
||||
}
|
||||
|
||||
return pusher;
|
||||
|
||||
});
|
18
node_modules/jsonpath/node_modules/underscore/amd/_sequence.js
generated
vendored
Normal file
18
node_modules/jsonpath/node_modules/underscore/amd/_sequence.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
define(function () {
|
||||
|
||||
function sequence(iteratee, start, stop, step) {
|
||||
if (stop == null) {
|
||||
stop = start || 0;
|
||||
start = 0;
|
||||
}
|
||||
if (!step) {
|
||||
step = stop < start ? -1 : 1;
|
||||
}
|
||||
var rest = (stop - start) % step;
|
||||
stop += (rest && step - rest);
|
||||
for ( ; start != stop ; start += step) if (iteratee(start)) return start;
|
||||
}
|
||||
|
||||
return sequence;
|
||||
|
||||
});
|
70
node_modules/jsonpath/node_modules/underscore/amd/_setup.js
generated
vendored
Normal file
70
node_modules/jsonpath/node_modules/underscore/amd/_setup.js
generated
vendored
Normal file
@@ -0,0 +1,70 @@
|
||||
define(['exports'], function (exports) {
|
||||
|
||||
// Current version.
|
||||
var VERSION = '1.12.1';
|
||||
|
||||
// Establish the root object, `window` (`self`) in the browser, `global`
|
||||
// on the server, or `this` in some virtual machines. We use `self`
|
||||
// instead of `window` for `WebWorker` support.
|
||||
var root = typeof self == 'object' && self.self === self && self ||
|
||||
typeof global == 'object' && global.global === global && global ||
|
||||
Function('return this')() ||
|
||||
{};
|
||||
|
||||
// Save bytes in the minified (but not gzipped) version:
|
||||
var ArrayProto = Array.prototype, ObjProto = Object.prototype;
|
||||
var SymbolProto = typeof Symbol !== 'undefined' ? Symbol.prototype : null;
|
||||
|
||||
// Create quick reference variables for speed access to core prototypes.
|
||||
var push = ArrayProto.push,
|
||||
slice = ArrayProto.slice,
|
||||
toString = ObjProto.toString,
|
||||
hasOwnProperty = ObjProto.hasOwnProperty;
|
||||
|
||||
// Modern feature detection.
|
||||
var supportsArrayBuffer = typeof ArrayBuffer !== 'undefined',
|
||||
supportsDataView = typeof DataView !== 'undefined';
|
||||
|
||||
// All **ECMAScript 5+** native function implementations that we hope to use
|
||||
// are declared here.
|
||||
var nativeIsArray = Array.isArray,
|
||||
nativeKeys = Object.keys,
|
||||
nativeCreate = Object.create,
|
||||
nativeIsView = supportsArrayBuffer && ArrayBuffer.isView;
|
||||
|
||||
// Create references to these builtin functions because we override them.
|
||||
var _isNaN = isNaN,
|
||||
_isFinite = isFinite;
|
||||
|
||||
// Keys in IE < 9 that won't be iterated by `for key in ...` and thus missed.
|
||||
var hasEnumBug = !{toString: null}.propertyIsEnumerable('toString');
|
||||
var nonEnumerableProps = ['valueOf', 'isPrototypeOf', 'toString',
|
||||
'propertyIsEnumerable', 'hasOwnProperty', 'toLocaleString'];
|
||||
|
||||
// The largest integer that can be represented exactly.
|
||||
var MAX_ARRAY_INDEX = Math.pow(2, 53) - 1;
|
||||
|
||||
exports.ArrayProto = ArrayProto;
|
||||
exports.MAX_ARRAY_INDEX = MAX_ARRAY_INDEX;
|
||||
exports.ObjProto = ObjProto;
|
||||
exports.SymbolProto = SymbolProto;
|
||||
exports.VERSION = VERSION;
|
||||
exports._isFinite = _isFinite;
|
||||
exports._isNaN = _isNaN;
|
||||
exports.hasEnumBug = hasEnumBug;
|
||||
exports.hasOwnProperty = hasOwnProperty;
|
||||
exports.nativeCreate = nativeCreate;
|
||||
exports.nativeIsArray = nativeIsArray;
|
||||
exports.nativeIsView = nativeIsView;
|
||||
exports.nativeKeys = nativeKeys;
|
||||
exports.nonEnumerableProps = nonEnumerableProps;
|
||||
exports.push = push;
|
||||
exports.root = root;
|
||||
exports.slice = slice;
|
||||
exports.supportsArrayBuffer = supportsArrayBuffer;
|
||||
exports.supportsDataView = supportsDataView;
|
||||
exports.toString = toString;
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
});
|
12
node_modules/jsonpath/node_modules/underscore/amd/_shallowProperty.js
generated
vendored
Normal file
12
node_modules/jsonpath/node_modules/underscore/amd/_shallowProperty.js
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
define(function () {
|
||||
|
||||
// Internal helper to generate a function to obtain property `key` from `obj`.
|
||||
function shallowProperty(key) {
|
||||
return function(obj) {
|
||||
return obj == null ? void 0 : obj[key];
|
||||
};
|
||||
}
|
||||
|
||||
return shallowProperty;
|
||||
|
||||
});
|
7
node_modules/jsonpath/node_modules/underscore/amd/_slice.js
generated
vendored
Normal file
7
node_modules/jsonpath/node_modules/underscore/amd/_slice.js
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
define(['./_setup', './_unmethodize'], function (_setup, _unmethodize) {
|
||||
|
||||
var slice = _unmethodize(_setup.ArrayProto.slice);
|
||||
|
||||
return slice;
|
||||
|
||||
});
|
9
node_modules/jsonpath/node_modules/underscore/amd/_strictEqual.js
generated
vendored
Normal file
9
node_modules/jsonpath/node_modules/underscore/amd/_strictEqual.js
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
define(function () {
|
||||
|
||||
function strictEqual(left, right) {
|
||||
return left === right;
|
||||
}
|
||||
|
||||
return strictEqual;
|
||||
|
||||
});
|
16
node_modules/jsonpath/node_modules/underscore/amd/_stringTagBug.js
generated
vendored
Normal file
16
node_modules/jsonpath/node_modules/underscore/amd/_stringTagBug.js
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
define(['exports', './_setup', './_hasObjectTag'], function (exports, _setup, _hasObjectTag) {
|
||||
|
||||
// In IE 10 - Edge 13, `DataView` has string tag `'[object Object]'`.
|
||||
// In IE 11, the most common among them, this problem also applies to
|
||||
// `Map`, `WeakMap` and `Set`.
|
||||
var hasStringTagBug = (
|
||||
_setup.supportsDataView && _hasObjectTag(new DataView(new ArrayBuffer(8)))
|
||||
),
|
||||
isIE11 = (typeof Map !== 'undefined' && _hasObjectTag(new Map));
|
||||
|
||||
exports.hasStringTagBug = hasStringTagBug;
|
||||
exports.isIE11 = isIE11;
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
});
|
13
node_modules/jsonpath/node_modules/underscore/amd/_tagTester.js
generated
vendored
Normal file
13
node_modules/jsonpath/node_modules/underscore/amd/_tagTester.js
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
define(['./_setup'], function (_setup) {
|
||||
|
||||
// Internal function for creating a `toString`-based type tester.
|
||||
function tagTester(name) {
|
||||
var tag = '[object ' + name + ']';
|
||||
return function(obj) {
|
||||
return _setup.toString.call(obj) === tag;
|
||||
};
|
||||
}
|
||||
|
||||
return tagTester;
|
||||
|
||||
});
|
15
node_modules/jsonpath/node_modules/underscore/amd/_toBufferView.js
generated
vendored
Normal file
15
node_modules/jsonpath/node_modules/underscore/amd/_toBufferView.js
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
define(['./_getByteLength'], function (_getByteLength) {
|
||||
|
||||
// Internal function to wrap or shallow-copy an ArrayBuffer,
|
||||
// typed array or DataView to a new view, reusing the buffer.
|
||||
function toBufferView(bufferSource) {
|
||||
return new Uint8Array(
|
||||
bufferSource.buffer || bufferSource,
|
||||
bufferSource.byteOffset || 0,
|
||||
_getByteLength(bufferSource)
|
||||
);
|
||||
}
|
||||
|
||||
return toBufferView;
|
||||
|
||||
});
|
11
node_modules/jsonpath/node_modules/underscore/amd/_toPath.js
generated
vendored
Normal file
11
node_modules/jsonpath/node_modules/underscore/amd/_toPath.js
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
define(['./underscore', './toPath'], function (underscore, toPath$1) {
|
||||
|
||||
// Internal wrapper for `_.toPath` to enable minification.
|
||||
// Similar to `cb` for `_.iteratee`.
|
||||
function toPath(path) {
|
||||
return underscore.toPath(path);
|
||||
}
|
||||
|
||||
return toPath;
|
||||
|
||||
});
|
8
node_modules/jsonpath/node_modules/underscore/amd/_unescapeMap.js
generated
vendored
Normal file
8
node_modules/jsonpath/node_modules/underscore/amd/_unescapeMap.js
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
define(['./_escapeMap', './invert'], function (_escapeMap, invert) {
|
||||
|
||||
// Internal list of HTML entities for unescaping.
|
||||
var unescapeMap = invert(_escapeMap);
|
||||
|
||||
return unescapeMap;
|
||||
|
||||
});
|
9
node_modules/jsonpath/node_modules/underscore/amd/_unmethodize.js
generated
vendored
Normal file
9
node_modules/jsonpath/node_modules/underscore/amd/_unmethodize.js
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
define(['./_bindCb', './_setup'], function (_bindCb, _setup) {
|
||||
|
||||
function unmethodize(method) {
|
||||
return _bindCb(_setup.call, method);
|
||||
}
|
||||
|
||||
return unmethodize;
|
||||
|
||||
});
|
15
node_modules/jsonpath/node_modules/underscore/amd/_wrapArrayAccessor.js
generated
vendored
Normal file
15
node_modules/jsonpath/node_modules/underscore/amd/_wrapArrayAccessor.js
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
define(['./_setup', './restArguments'], function (_setup, restArguments) {
|
||||
|
||||
// Internal function to wrap `Array.prototype` methods that return a
|
||||
// new value so they can be directly invoked as standalone functions.
|
||||
// Works for `concat`, `slice` and `join`.
|
||||
function wrapArrayAccessor(name) {
|
||||
var method = _setup.ArrayProto[name];
|
||||
return restArguments(function(array, args) {
|
||||
return array == null ? array : method.apply(array, args);
|
||||
});
|
||||
}
|
||||
|
||||
return wrapArrayAccessor;
|
||||
|
||||
});
|
28
node_modules/jsonpath/node_modules/underscore/amd/_wrapArrayMutator.js
generated
vendored
Normal file
28
node_modules/jsonpath/node_modules/underscore/amd/_wrapArrayMutator.js
generated
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
define(['exports', './_setup', './_getLength', './identity', './restArguments'], function (exports, _setup, _getLength, identity, restArguments) {
|
||||
|
||||
// Internal function to work around a bug in IE < 9. See
|
||||
// https://github.com/jashkenas/underscore/issues/397.
|
||||
function removeGhostHead(array) {
|
||||
if (!_getLength(array)) delete array[0];
|
||||
return array;
|
||||
}
|
||||
|
||||
// Internal function to wrap `Array.prototype` methods that modify
|
||||
// the context in place so they can be directly invoked as standalone
|
||||
// functions. Works for `pop`, `push`, `reverse`, `shift`, `sort`,
|
||||
// `splice` and `unshift`.
|
||||
function wrapArrayMutator(name, fixup) {
|
||||
var method = _setup.ArrayProto[name];
|
||||
fixup || (fixup = identity);
|
||||
return restArguments(function(array, args) {
|
||||
if (array != null) method.apply(array, args);
|
||||
return fixup(array);
|
||||
});
|
||||
}
|
||||
|
||||
exports.default = wrapArrayMutator;
|
||||
exports.removeGhostHead = removeGhostHead;
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
});
|
14
node_modules/jsonpath/node_modules/underscore/amd/after.js
generated
vendored
Normal file
14
node_modules/jsonpath/node_modules/underscore/amd/after.js
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
define(function () {
|
||||
|
||||
// Returns a function that will only be executed on and after the Nth call.
|
||||
function after(times, func) {
|
||||
return function() {
|
||||
if (--times < 1) {
|
||||
return func.apply(this, arguments);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
return after;
|
||||
|
||||
});
|
15
node_modules/jsonpath/node_modules/underscore/amd/allKeys.js
generated
vendored
Normal file
15
node_modules/jsonpath/node_modules/underscore/amd/allKeys.js
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
define(['./isObject', './_setup', './_collectNonEnumProps'], function (isObject, _setup, _collectNonEnumProps) {
|
||||
|
||||
// Retrieve all the enumerable property names of an object.
|
||||
function allKeys(obj) {
|
||||
if (!isObject(obj)) return [];
|
||||
var keys = [];
|
||||
for (var key in obj) keys.push(key);
|
||||
// Ahem, IE < 9.
|
||||
if (_setup.hasEnumBug) _collectNonEnumProps(obj, keys);
|
||||
return keys;
|
||||
}
|
||||
|
||||
return allKeys;
|
||||
|
||||
});
|
18
node_modules/jsonpath/node_modules/underscore/amd/before.js
generated
vendored
Normal file
18
node_modules/jsonpath/node_modules/underscore/amd/before.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
define(function () {
|
||||
|
||||
// Returns a function that will only be executed up to (but not including) the
|
||||
// Nth call.
|
||||
function before(times, func) {
|
||||
var memo;
|
||||
return function() {
|
||||
if (--times > 0) {
|
||||
memo = func.apply(this, arguments);
|
||||
}
|
||||
if (times <= 1) func = null;
|
||||
return memo;
|
||||
};
|
||||
}
|
||||
|
||||
return before;
|
||||
|
||||
});
|
15
node_modules/jsonpath/node_modules/underscore/amd/bind.js
generated
vendored
Normal file
15
node_modules/jsonpath/node_modules/underscore/amd/bind.js
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
define(['./isFunction', './_executeBound', './restArguments'], function (isFunction, _executeBound, restArguments) {
|
||||
|
||||
// Create a function bound to a given object (assigning `this`, and arguments,
|
||||
// optionally).
|
||||
var bind = restArguments(function(func, context, args) {
|
||||
if (!isFunction(func)) throw new TypeError('Bind must be called on a function');
|
||||
var bound = restArguments(function(callArgs) {
|
||||
return _executeBound(func, bound, context, this, args.concat(callArgs));
|
||||
});
|
||||
return bound;
|
||||
});
|
||||
|
||||
return bind;
|
||||
|
||||
});
|
19
node_modules/jsonpath/node_modules/underscore/amd/bindAll.js
generated
vendored
Normal file
19
node_modules/jsonpath/node_modules/underscore/amd/bindAll.js
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
define(['./_flatten', './restArguments', './bind'], function (_flatten, restArguments, bind) {
|
||||
|
||||
// Bind a number of an object's methods to that object. Remaining arguments
|
||||
// are the method names to be bound. Useful for ensuring that all callbacks
|
||||
// defined on an object belong to it.
|
||||
var bindAll = restArguments(function(obj, keys) {
|
||||
keys = _flatten(keys, false, false);
|
||||
var index = keys.length;
|
||||
if (index < 1) throw new Error('bindAll must be passed function names');
|
||||
while (index--) {
|
||||
var key = keys[index];
|
||||
obj[key] = bind(obj[key], obj);
|
||||
}
|
||||
return obj;
|
||||
});
|
||||
|
||||
return bindAll;
|
||||
|
||||
});
|
12
node_modules/jsonpath/node_modules/underscore/amd/chain.js
generated
vendored
Normal file
12
node_modules/jsonpath/node_modules/underscore/amd/chain.js
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
define(['./underscore'], function (underscore) {
|
||||
|
||||
// Start chaining a wrapped Underscore object.
|
||||
function chain(obj) {
|
||||
var instance = underscore(obj);
|
||||
instance._chain = true;
|
||||
return instance;
|
||||
}
|
||||
|
||||
return chain;
|
||||
|
||||
});
|
17
node_modules/jsonpath/node_modules/underscore/amd/chunk.js
generated
vendored
Normal file
17
node_modules/jsonpath/node_modules/underscore/amd/chunk.js
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
define(['./_setup'], function (_setup) {
|
||||
|
||||
// Chunk a single array into multiple arrays, each containing `count` or fewer
|
||||
// items.
|
||||
function chunk(array, count) {
|
||||
if (count == null || count < 1) return [];
|
||||
var result = [];
|
||||
var i = 0, length = array.length;
|
||||
while (i < length) {
|
||||
result.push(_setup.slice.call(array, i, i += count));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
return chunk;
|
||||
|
||||
});
|
11
node_modules/jsonpath/node_modules/underscore/amd/clone.js
generated
vendored
Normal file
11
node_modules/jsonpath/node_modules/underscore/amd/clone.js
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
define(['./isObject', './isArray', './extend'], function (isObject, isArray, extend) {
|
||||
|
||||
// Create a (shallow-cloned) duplicate of an object.
|
||||
function clone(obj) {
|
||||
if (!isObject(obj)) return obj;
|
||||
return isArray(obj) ? obj.slice() : extend({}, obj);
|
||||
}
|
||||
|
||||
return clone;
|
||||
|
||||
});
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user