feat: ✨ Created a mini nodeJS server with NewMan for testing without PostMan GUI.
This will mimic a run in a CD/CI environment or docker container.
This commit is contained in:
14
node_modules/liquid-json/.editorconfig
generated
vendored
Normal file
14
node_modules/liquid-json/.editorconfig
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
# editorconfig.org
|
||||
root = true
|
||||
|
||||
[*]
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
end_of_line = lf
|
||||
charset = utf-8
|
||||
max_length = 120
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
|
||||
[*.{json, yml, html, hbs}]
|
||||
indent_size = 2
|
262
node_modules/liquid-json/.eslintrc
generated
vendored
Normal file
262
node_modules/liquid-json/.eslintrc
generated
vendored
Normal file
@@ -0,0 +1,262 @@
|
||||
{
|
||||
"plugins": [
|
||||
"security",
|
||||
"jsdoc",
|
||||
"mocha"
|
||||
],
|
||||
"env": {
|
||||
"browser": true,
|
||||
"node": true,
|
||||
"es6": true
|
||||
},
|
||||
"rules": {
|
||||
// Possible Errors
|
||||
"comma-dangle": ["error", "never"],
|
||||
"no-cond-assign": "error",
|
||||
"no-console": ["error", { allow: ["info", "warn", "error"] }],
|
||||
"no-constant-condition": "error",
|
||||
"no-control-regex": "error",
|
||||
"no-debugger": "error",
|
||||
"no-dupe-args": "error",
|
||||
"no-dupe-keys": "error",
|
||||
"no-duplicate-case": "error",
|
||||
"no-empty": "error",
|
||||
"no-empty-character-class": "error",
|
||||
"no-ex-assign": "error",
|
||||
"no-extra-boolean-cast": "error",
|
||||
"no-extra-parens": "off",
|
||||
"no-extra-semi": "error",
|
||||
"no-func-assign": "error",
|
||||
"no-inner-declarations": "off",
|
||||
"no-invalid-regexp": "error",
|
||||
"no-irregular-whitespace": "error",
|
||||
"no-negated-in-lhs": "error",
|
||||
"no-obj-calls": "error",
|
||||
"no-regex-spaces": "error",
|
||||
"no-sparse-arrays": "error",
|
||||
"no-unexpected-multiline": "error",
|
||||
"no-unreachable": "error",
|
||||
"no-unsafe-finally": "error",
|
||||
"use-isnan": "error",
|
||||
"valid-jsdoc": "warn",
|
||||
"valid-typeof": "error",
|
||||
|
||||
// Best Practices
|
||||
"accessor-pairs": "error",
|
||||
"array-callback-return": "error",
|
||||
"block-scoped-var": "error",
|
||||
"complexity": "off",
|
||||
"consistent-return": "warn",
|
||||
"curly": "error",
|
||||
"default-case": "error",
|
||||
"dot-location": ["error", "property"],
|
||||
"dot-notation": "error",
|
||||
"eqeqeq": "error",
|
||||
"guard-for-in": "warn",
|
||||
"no-alert": "error",
|
||||
"no-caller": "error",
|
||||
"no-case-declarations": "error",
|
||||
"no-div-regex": "error",
|
||||
"no-else-return": "error",
|
||||
"no-empty-function": "error",
|
||||
"no-empty-pattern": "error",
|
||||
"no-eq-null": "error",
|
||||
"no-eval": "error",
|
||||
"no-extend-native": "error",
|
||||
"no-extra-bind": "error",
|
||||
"no-extra-label": "error",
|
||||
"no-fallthrough": "error",
|
||||
"no-floating-decimal": "error",
|
||||
"no-implicit-coercion": "error",
|
||||
"no-implicit-globals": "error",
|
||||
"no-implied-eval": "error",
|
||||
"no-invalid-this": "error",
|
||||
"no-iterator": "error",
|
||||
"no-labels": "error",
|
||||
"no-lone-blocks": "error",
|
||||
"no-loop-func": "error",
|
||||
"no-magic-numbers": "off",
|
||||
"no-multi-spaces": "error",
|
||||
"no-multi-str": "error",
|
||||
"no-native-reassign": "error",
|
||||
"no-new": "error",
|
||||
"no-new-func": "error",
|
||||
"no-new-wrappers": "error",
|
||||
"no-octal": "error",
|
||||
"no-octal-escape": "error",
|
||||
// "_no-param-reassign": "error",
|
||||
"no-proto": "error",
|
||||
"no-redeclare": "error",
|
||||
"no-return-assign": "error",
|
||||
"no-script-url": "error",
|
||||
"no-self-assign": "error",
|
||||
"no-self-compare": "error",
|
||||
"no-sequences": "error",
|
||||
"no-throw-literal": "error",
|
||||
"no-unmodified-loop-condition": "error",
|
||||
"no-unused-expressions": "off",
|
||||
"no-unused-labels": "error",
|
||||
"no-useless-call": "error",
|
||||
"no-useless-concat": "error",
|
||||
"no-useless-escape": "error",
|
||||
"no-void": "error",
|
||||
"no-warning-comments": "off",
|
||||
"no-with": "error",
|
||||
"radix": "off",
|
||||
// "vars-on-top": "error",
|
||||
"wrap-iife": "error",
|
||||
"yoda": "error",
|
||||
|
||||
// Strict Mode
|
||||
"strict": "off",
|
||||
|
||||
// Variables
|
||||
"init-declarations": "off",
|
||||
"no-catch-shadow": "error",
|
||||
"no-delete-var": "error",
|
||||
"no-label-var": "error",
|
||||
"no-restricted-globals": "error",
|
||||
//"no-shadow": "error",
|
||||
"no-shadow-restricted-names": "error",
|
||||
"no-undef": "off",
|
||||
"no-undef-init": "error",
|
||||
"no-undefined": "off",
|
||||
"no-unused-vars": "error",
|
||||
"no-use-before-define": "error",
|
||||
|
||||
// Stylistic Issues
|
||||
"array-bracket-spacing": "error",
|
||||
"block-spacing": "error",
|
||||
"brace-style": [2, "stroustrup", { "allowSingleLine": true }],
|
||||
"camelcase": "off",
|
||||
"comma-spacing": [2, { "before": false, "after": true }],
|
||||
"comma-style": ["error", "last"],
|
||||
"computed-property-spacing": "error",
|
||||
// "consistent-this": "warn",
|
||||
"eol-last": "error",
|
||||
"func-names": "off",
|
||||
"func-style": "off",
|
||||
"id-blacklist": "error",
|
||||
"id-length": "off",
|
||||
"id-match": "error",
|
||||
"indent": ["error", 4, {
|
||||
"VariableDeclarator": { "var": 1, "let": 1, "const": 1 },
|
||||
"SwitchCase": 1,
|
||||
}],
|
||||
"jsx-quotes": ["error", "prefer-single"],
|
||||
"key-spacing": "error",
|
||||
"keyword-spacing": "error",
|
||||
"linebreak-style": ["error", "unix"],
|
||||
"lines-around-comment": ["error", {
|
||||
"beforeBlockComment": true,
|
||||
"afterBlockComment": false,
|
||||
"beforeLineComment": false,
|
||||
"afterLineComment": false,
|
||||
"allowBlockStart": true,
|
||||
"allowBlockEnd": false,
|
||||
"allowObjectStart": true,
|
||||
"allowObjectEnd": false,
|
||||
"allowArrayStart": true,
|
||||
"allowArrayEnd": false
|
||||
}],
|
||||
"max-depth": "error",
|
||||
"max-len": ["error", {
|
||||
"code": 120
|
||||
}],
|
||||
"max-nested-callbacks": "error",
|
||||
"max-params": "off",
|
||||
"max-statements": "off",
|
||||
"max-statements-per-line": "off",
|
||||
"new-cap": "off",
|
||||
"new-parens": "error",
|
||||
"newline-after-var": ["off", "always"],
|
||||
"newline-before-return": "off",
|
||||
"newline-per-chained-call": "off",
|
||||
"no-array-constructor": "error",
|
||||
// "no-bitwise": "error",
|
||||
// "no-continue": "error",
|
||||
"no-inline-comments": "off",
|
||||
"no-lonely-if": "error",
|
||||
"no-mixed-spaces-and-tabs": "error",
|
||||
"no-multiple-empty-lines": "error",
|
||||
"no-negated-condition": "off",
|
||||
"no-nested-ternary": "off",
|
||||
"no-new-object": "error",
|
||||
"no-plusplus": "off",
|
||||
"no-restricted-syntax": "error",
|
||||
"no-spaced-func": "error",
|
||||
"no-ternary": "off",
|
||||
"no-trailing-spaces": "error",
|
||||
"no-underscore-dangle": "off",
|
||||
"no-unneeded-ternary": "error",
|
||||
"no-whitespace-before-property": "error",
|
||||
"object-curly-spacing": ["error", "always"],
|
||||
"one-var": ["error", "always"],
|
||||
"one-var-declaration-per-line": "error",
|
||||
"operator-assignment": "error",
|
||||
"operator-linebreak": ["error", "after"],
|
||||
"padded-blocks": "off",
|
||||
"quote-props": "off",
|
||||
"quotes": ["error", "single"],
|
||||
"require-jsdoc": "warn",
|
||||
"semi": "error",
|
||||
"semi-spacing": "error",
|
||||
"sort-vars": "off",
|
||||
"space-before-blocks": "error",
|
||||
"space-in-parens": "error",
|
||||
"space-infix-ops": "error",
|
||||
"space-unary-ops": "error",
|
||||
"spaced-comment": ["error", "always", {
|
||||
"block": {
|
||||
"exceptions": ["!"]
|
||||
}
|
||||
}],
|
||||
"wrap-regex": "error",
|
||||
|
||||
// ECMAScript 6
|
||||
"arrow-body-style": ["error", "always"],
|
||||
"arrow-parens": ["error", "always"],
|
||||
"arrow-spacing": "error",
|
||||
"constructor-super": "error",
|
||||
"generator-star-spacing": "error",
|
||||
"no-class-assign": "error",
|
||||
"no-confusing-arrow": "error",
|
||||
"no-const-assign": "error",
|
||||
"no-dupe-class-members": "error",
|
||||
"no-duplicate-imports": "error",
|
||||
"no-new-symbol": "error",
|
||||
"no-restricted-imports": "error",
|
||||
"no-this-before-super": "error",
|
||||
"no-useless-computed-key": "error",
|
||||
"no-useless-constructor": "off",
|
||||
"no-var": "off",
|
||||
"object-shorthand": "off",
|
||||
// "_prefer-arrow-callback": "error",
|
||||
"prefer-const": "off",
|
||||
"prefer-reflect": "off",
|
||||
// "prefer-rest-params": "error",
|
||||
"prefer-spread": "error",
|
||||
"prefer-template": "off",
|
||||
"require-yield": "error",
|
||||
"sort-imports": "off",
|
||||
"template-curly-spacing": "error",
|
||||
"yield-star-spacing": "error",
|
||||
|
||||
// Mocha
|
||||
"mocha/no-exclusive-tests": 2,
|
||||
"mocha/no-skipped-tests": 1,
|
||||
"mocha/no-pending-tests": 2,
|
||||
"mocha/handle-done-callback": 2,
|
||||
"mocha/no-synchronous-tests": 0,
|
||||
"mocha/no-global-tests": 2,
|
||||
"mocha/no-return-and-callback": 2,
|
||||
"mocha/valid-test-description": 0,
|
||||
"mocha/valid-suite-description": 0,
|
||||
"mocha/no-sibling-hooks": 2,
|
||||
"mocha/no-mocha-arrows": 2,
|
||||
"mocha/no-hooks": 0,
|
||||
"mocha/no-hooks-for-single-case": 1,
|
||||
"mocha/no-top-level-hooks": 1,
|
||||
"mocha/no-identical-title": 2
|
||||
}
|
||||
}
|
39
node_modules/liquid-json/.npmignore
generated
vendored
Normal file
39
node_modules/liquid-json/.npmignore
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
# PLATFORM
|
||||
# ========
|
||||
# All exclusions that are specific to the NPM, GIT, IDE and Operating Systems.
|
||||
|
||||
# - Do not allow installed node modules to be committed. Doing `npm install -d` will bring them in root or other places.
|
||||
node_modules
|
||||
|
||||
# - Do not commit any log file from anywhere
|
||||
*.log
|
||||
*.log.*
|
||||
|
||||
# - Prevent addition of OS specific file explorer files
|
||||
Thumbs.db
|
||||
.DS_Store
|
||||
|
||||
# Prevent IDE stuff
|
||||
.idea
|
||||
|
||||
|
||||
# PROJECT
|
||||
# =======
|
||||
# Configuration pertaining to project specific repository structure.
|
||||
|
||||
# - Prevent Sublime text IDE files from being commited to repository
|
||||
*.sublime-*
|
||||
|
||||
# - Allow sublime text project file to be commited in the development directory.
|
||||
!/develop/*.sublime-project
|
||||
|
||||
# - Prevent CI output files from being Added
|
||||
/out/
|
||||
/newman/
|
||||
|
||||
# - Prevent diff backups from SourceTree from showing as commit.
|
||||
*.BACKUP.*
|
||||
*.BASE.*
|
||||
*.LOCAL.*
|
||||
*.REMOTE.*
|
||||
*.orig
|
8
node_modules/liquid-json/.travis.yml
generated
vendored
Normal file
8
node_modules/liquid-json/.travis.yml
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- '4'
|
||||
- '5'
|
||||
- '6'
|
||||
notifications:
|
||||
slack:
|
||||
secure: Fdl/sQMTl86jYN1r1CRRRQRgyFoslvrhkkfnM2JSdx4gODPgyg4nCPSKtU5j9wpSbbkq9A+YBeFv+Suh+xYNviegqa0AZbztydfFzVDS7xw43B/uR9Y4LwaP5Kis1WGuIOHawwFISNO3hTUei6aybKiKKlxvfqrARJaO01+Xxrg=
|
203
node_modules/liquid-json/LICENSE.md
generated
vendored
Normal file
203
node_modules/liquid-json/LICENSE.md
generated
vendored
Normal file
@@ -0,0 +1,203 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "{}"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright 2016 Postdot Technologies, Inc
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
23
node_modules/liquid-json/README.md
generated
vendored
Normal file
23
node_modules/liquid-json/README.md
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
# liquid-json
|
||||
|
||||
Implementation of `JSON` which ignores BOM and shows more detailed error messages on parse failures.
|
||||
|
||||
## usage
|
||||
|
||||
```terminal
|
||||
$ npm install liquid-json --save;
|
||||
```
|
||||
|
||||
```javascript
|
||||
var LJSON = require('liquid-json');
|
||||
LJSON.parse('{ "hello": "world" }');
|
||||
LJSON.stringify({ hello: 'world' });
|
||||
```
|
||||
|
||||
`LJSON.parse` accepts `reviver` function as second parameter and `LJSON.stringify` accepts standard JSON parameters.
|
||||
All errors raised from this module has error name as `JSONError`.
|
||||
|
||||
## attributions
|
||||
|
||||
- https://github.com/rlidwka/jju
|
||||
- https://github.com/ariya/esprima
|
38
node_modules/liquid-json/appveyor.yml
generated
vendored
Normal file
38
node_modules/liquid-json/appveyor.yml
generated
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
#---------------------------------#
|
||||
# environment configuration #
|
||||
#---------------------------------#
|
||||
|
||||
# scripts that are called at very beginning, before repo cloning
|
||||
init:
|
||||
- git config --global core.autocrlf input
|
||||
|
||||
# environment variables
|
||||
environment:
|
||||
matrix:
|
||||
- nodejs_version: "4"
|
||||
- nodejs_version: "5"
|
||||
- nodejs_version: "6"
|
||||
|
||||
# scripts that run after cloning repository
|
||||
install:
|
||||
- ps: Install-Product node $env:nodejs_version
|
||||
- npm install
|
||||
|
||||
build: off # Disable MSBuilds, not related to the regular build process
|
||||
|
||||
# to run your custom scripts instead of automatic tests
|
||||
test_script:
|
||||
- node --version && npm --version
|
||||
- cmd: "npm test"
|
||||
|
||||
# to disable deployment
|
||||
deploy: off
|
||||
|
||||
#---------------------------------#
|
||||
# notifications #
|
||||
#---------------------------------#
|
||||
|
||||
notifications:
|
||||
- provider: Slack
|
||||
incoming_webhook:
|
||||
secure: PRDZ1nhG/cQrwMgCLXsWvTDJtYxv78GJrSlVYpMzpUploVWDzBlpMqmFr9WxZQkY/lxsqCSpGX4zgTYzlte1WMWnghqTIFE8u7svlXHa/tk=
|
1
node_modules/liquid-json/index.js
generated
vendored
Normal file
1
node_modules/liquid-json/index.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = require('./lib');
|
65
node_modules/liquid-json/lib/bomb.js
generated
vendored
Normal file
65
node_modules/liquid-json/lib/bomb.js
generated
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
var bomb = {
|
||||
/**
|
||||
* @private
|
||||
* @type {Object}
|
||||
*/
|
||||
code: { // @todo: could be shifted to outside the bomb object
|
||||
FEFF: 0xFEFF,
|
||||
BBBF: 0xBBBF,
|
||||
FE: 0xFE,
|
||||
FF: 0xFF,
|
||||
EF: 0xEF,
|
||||
BB: 0xBB,
|
||||
BF: 0xBF
|
||||
},
|
||||
|
||||
/**
|
||||
* Checks whether string has BOM
|
||||
* @param {String} str An input string that is tested for the presence of BOM
|
||||
*
|
||||
* @returns {Number} If greater than 0, implies that a BOM of returned length was found. Else, zero is returned.
|
||||
*/
|
||||
indexOfBOM: function (str) {
|
||||
if (typeof str !== 'string') {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// @todo: compress logic below
|
||||
// remove UTF-16 and UTF-32 BOM (https://en.wikipedia.org/wiki/Byte_order_mark#UTF-8)
|
||||
if ((str.charCodeAt(0) === bomb.code.FEFF) || (str.charCodeAt(0) === bomb.code.BBBF)) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
// big endian UTF-16 BOM
|
||||
if ((str.charCodeAt(0) === bomb.code.FE) && (str.charCodeAt(1) === bomb.code.FF)) {
|
||||
return 2;
|
||||
}
|
||||
|
||||
// little endian UTF-16 BOM
|
||||
if ((str.charCodeAt(0) === bomb.code.FF) && (str.charCodeAt(1) === bomb.code.FE)) {
|
||||
return 2;
|
||||
}
|
||||
|
||||
// UTF-8 BOM
|
||||
if ((str.charCodeAt(0) === bomb.code.EF) && (str.charCodeAt(1) === bomb.code.BB) &&
|
||||
(str.charCodeAt(2) === bomb.code.BF)) {
|
||||
return 3;
|
||||
}
|
||||
|
||||
return 0;
|
||||
},
|
||||
|
||||
/**
|
||||
* Trim BOM from a string
|
||||
*
|
||||
* @param {String} str An input string that is tested for the presence of BOM
|
||||
* @returns {String} The input string stripped of any BOM, if found. If the input is not a string, it is returned as
|
||||
* is.
|
||||
*/
|
||||
trim: function (str) {
|
||||
var pos = bomb.indexOfBOM(str);
|
||||
return pos ? str.slice(pos) : str;
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = bomb;
|
78
node_modules/liquid-json/lib/index.js
generated
vendored
Normal file
78
node_modules/liquid-json/lib/index.js
generated
vendored
Normal file
@@ -0,0 +1,78 @@
|
||||
/**!
|
||||
* Originally written by:
|
||||
* https://github.com/sindresorhus/parse-json
|
||||
*/
|
||||
var fallback = require('../vendor/parse'),
|
||||
bomb = require('./bomb'),
|
||||
FALLBACK_MODE = 'json',
|
||||
ERROR_NAME = 'JSONError',
|
||||
|
||||
parse; // fn
|
||||
|
||||
/**
|
||||
* Accept a string as JSON and return an object.
|
||||
* @private
|
||||
*
|
||||
* @param {String} str The input stringified JSON object to be parsed.
|
||||
* @param {Function=} [reviver] A customizer function to be used within the fallback (BOM friendly) JSON parser.
|
||||
* @param {Boolean=} [strict] Set to true to treat the occurrence of BOM as a fatal error.
|
||||
*
|
||||
* @returns {Object} The parsed JSON object constructed from str
|
||||
* @throws {SyntaxError} If `str` is not a valid JSON
|
||||
* @throws {SyntaxError} In `strict` mode if `str` contains BOM
|
||||
*/
|
||||
parse = function (str, reviver, strict) {
|
||||
var bomMarkerIndex = bomb.indexOfBOM(str);
|
||||
|
||||
if (bomMarkerIndex) {
|
||||
if (strict) {
|
||||
throw SyntaxError('Unexpected byte order mark found in first ' + bomMarkerIndex + ' character(s)');
|
||||
}
|
||||
// clean up BOM if not strict
|
||||
str = str.slice(bomMarkerIndex);
|
||||
}
|
||||
|
||||
try { // first try and use normal JSON.parse as this is faster
|
||||
return JSON.parse(str, reviver);
|
||||
}
|
||||
catch (err) { // if JSON.parse fails, we try using a more verbose parser
|
||||
fallback.parse(str, {
|
||||
mode: FALLBACK_MODE,
|
||||
reviver: reviver
|
||||
});
|
||||
|
||||
// if there was an error in this catch block, `fallback.parse` should raise same error. hence this `throw`
|
||||
// will never get executed. if it does not, we still throw original error.
|
||||
throw err;
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
parse: function (str, reviver, relaxed) {
|
||||
if ((typeof reviver === 'boolean') && (relaxed === null)) {
|
||||
relaxed = reviver;
|
||||
reviver = null;
|
||||
}
|
||||
|
||||
try {
|
||||
return parse(str, reviver, relaxed);
|
||||
}
|
||||
// we do this simply to set the error name and as such making it more identifiable
|
||||
catch (err) {
|
||||
err.name = ERROR_NAME;
|
||||
throw err;
|
||||
}
|
||||
},
|
||||
|
||||
stringify: function () {
|
||||
try {
|
||||
// eslint-disable-next-line prefer-spread
|
||||
return JSON.stringify.apply(JSON, arguments);
|
||||
}
|
||||
// we do this simply to set the error name and as such making it more identifiable
|
||||
catch (err) {
|
||||
err.name = ERROR_NAME;
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
};
|
41
node_modules/liquid-json/npm/test-lint.js
generated
vendored
Normal file
41
node_modules/liquid-json/npm/test-lint.js
generated
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
#!/usr/bin/env node
|
||||
require('shelljs/global');
|
||||
require('colors');
|
||||
|
||||
var async = require('async'),
|
||||
ESLintCLIEngine = require('eslint').CLIEngine,
|
||||
|
||||
LINT_SOURCE_DIRS = [
|
||||
'./lib',
|
||||
'./bin',
|
||||
'./test',
|
||||
'./examples/*.js',
|
||||
'./npm/*.js',
|
||||
'./index.js'
|
||||
];
|
||||
|
||||
module.exports = function (exit) {
|
||||
// banner line
|
||||
console.info('\nLinting files using eslint...'.yellow.bold);
|
||||
|
||||
async.waterfall([
|
||||
// execute the CLI engine
|
||||
function (next) {
|
||||
next(null, (new ESLintCLIEngine()).executeOnFiles(LINT_SOURCE_DIRS));
|
||||
},
|
||||
|
||||
// output results
|
||||
function (report, next) {
|
||||
var errorReport = ESLintCLIEngine.getErrorResults(report.results);
|
||||
// log the result to CLI
|
||||
console.info(ESLintCLIEngine.getFormatter()(report.results));
|
||||
// log the success of the parser if it has no errors
|
||||
(errorReport && !errorReport.length) && console.info('eslint ok!'.green);
|
||||
// ensure that the exit code is non zero in case there was an error
|
||||
next(Number(errorReport && errorReport.length) || 0);
|
||||
}
|
||||
], exit);
|
||||
};
|
||||
|
||||
// ensure we run this script exports if this is a direct stdin.tty run
|
||||
!module.parent && module.exports(exit);
|
31
node_modules/liquid-json/npm/test-unit.js
generated
vendored
Normal file
31
node_modules/liquid-json/npm/test-unit.js
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
#!/usr/bin/env node
|
||||
require('shelljs/global');
|
||||
require('colors');
|
||||
|
||||
var fs = require('fs'),
|
||||
path = require('path'),
|
||||
Mocha = require('mocha'),
|
||||
|
||||
SPEC_SOURCE_DIR = './test/unit';
|
||||
|
||||
module.exports = function (exit) {
|
||||
// banner line
|
||||
console.info('Running unit tests using mocha...'.yellow.bold);
|
||||
|
||||
var mocha = new Mocha();
|
||||
|
||||
fs.readdir(SPEC_SOURCE_DIR, function (err, files) {
|
||||
files.filter(function (file) {
|
||||
return (file.substr(-8) === '.test.js');
|
||||
}).forEach(function (file) {
|
||||
mocha.addFile(path.join(SPEC_SOURCE_DIR, file));
|
||||
});
|
||||
|
||||
// start the mocha run
|
||||
mocha.run(exit);
|
||||
mocha = null; // cleanup
|
||||
});
|
||||
};
|
||||
|
||||
// ensure we run this script exports if this is a direct stdin.tty run
|
||||
!module.parent && module.exports(exit);
|
16
node_modules/liquid-json/npm/test.js
generated
vendored
Normal file
16
node_modules/liquid-json/npm/test.js
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
#!/usr/bin/env node
|
||||
require('shelljs/global');
|
||||
require('colors');
|
||||
|
||||
var prettyms = require('pretty-ms'),
|
||||
startedAt = Date.now();
|
||||
|
||||
require('async').series([
|
||||
require('./test-lint'),
|
||||
require('./test-unit')
|
||||
], function (code) {
|
||||
// eslint-disable-next-line max-len
|
||||
console.info(`\nliquid-json: duration ${prettyms(Date.now() - startedAt)}\nliquid-json: ${code ? 'not ok' : 'ok'}!`[code ?
|
||||
'red' : 'green']);
|
||||
exit(code && (typeof code === 'number' ? code : 1) || 0);
|
||||
});
|
44
node_modules/liquid-json/package.json
generated
vendored
Normal file
44
node_modules/liquid-json/package.json
generated
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
{
|
||||
"name": "liquid-json",
|
||||
"version": "0.3.1",
|
||||
"description": "Implementation of JSON that ignores BOM and thows friendly error",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "node npm/test.js",
|
||||
"test-unit": "node npm/test-unit.js",
|
||||
"test-lint": "node npm/test-lint.js"
|
||||
},
|
||||
"author": "Postman Labs <help@getpostman.com> (=)",
|
||||
"license": "Apache-2.0",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/postmanlabs/liquid-json.git"
|
||||
},
|
||||
"keywords": [
|
||||
"json",
|
||||
"parse",
|
||||
"error",
|
||||
"friendly",
|
||||
"bom",
|
||||
"postman"
|
||||
],
|
||||
"bugs": {
|
||||
"url": "https://github.com/postmanlabs/liquid-json/issues"
|
||||
},
|
||||
"homepage": "https://github.com/postmanlabs/liquid-json#readme",
|
||||
"devDependencies": {
|
||||
"async": "2.0.1",
|
||||
"colors": "1.1.2",
|
||||
"eslint": "3.4.0",
|
||||
"eslint-plugin-jsdoc": "2.3.1",
|
||||
"eslint-plugin-mocha": "4.5.1",
|
||||
"eslint-plugin-security": "1.2.0",
|
||||
"expect.js": "0.3.1",
|
||||
"mocha": "3.0.2",
|
||||
"pretty-ms": "2.1.0",
|
||||
"shelljs": "0.7.4"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
}
|
||||
}
|
58
node_modules/liquid-json/test/unit/lib-bomb.test.js
generated
vendored
Normal file
58
node_modules/liquid-json/test/unit/lib-bomb.test.js
generated
vendored
Normal file
@@ -0,0 +1,58 @@
|
||||
var path = require('path'),
|
||||
|
||||
expect = require('expect.js'),
|
||||
bomb = require(path.join(__dirname, '..', '..', 'lib', 'bomb')),
|
||||
|
||||
TEST_STRING = 'string',
|
||||
|
||||
testInput = {
|
||||
number: 12,
|
||||
utf8: 'string',
|
||||
utf16: String.fromCharCode(0xFEFF) + 'string',
|
||||
utf32: '뮿string',
|
||||
utf16BigEndian: 'þÿstring',
|
||||
utf16LittleEndian: 'ÿþstring'
|
||||
};
|
||||
|
||||
describe('lib/bomb', function () {
|
||||
describe('trim', function () {
|
||||
// edge cases
|
||||
describe('edge case', function () {
|
||||
it('returns an unchanged value for undefined / no input', function () {
|
||||
expect(bomb.trim()).to.be(undefined);
|
||||
});
|
||||
|
||||
it('returns and unchanged value for non string input', function () {
|
||||
expect(bomb.trim(testInput.number)).to.be(testInput.number);
|
||||
});
|
||||
});
|
||||
|
||||
// regular string input
|
||||
it('returns an unchanged value for regular string input', function () {
|
||||
expect(bomb.trim(TEST_STRING)).to.be(TEST_STRING);
|
||||
});
|
||||
|
||||
// BOM compliant string input tests
|
||||
describe('BOM removal', function () {
|
||||
it.skip('correctly removes UTF-16 BOM', function () { // @todo: unskip after a utf16 BOM has been found
|
||||
expect(bomb.trim(testInput.utf16)).to.be(TEST_STRING);
|
||||
});
|
||||
|
||||
it('correctly removes UTF-32 BOM', function () {
|
||||
expect(bomb.trim(testInput.utf32)).to.be(TEST_STRING);
|
||||
});
|
||||
|
||||
it('correctly removes big endian UTF-16 BOM', function () {
|
||||
expect(bomb.trim(testInput.utf16BigEndian)).to.be(TEST_STRING);
|
||||
});
|
||||
|
||||
it('correctly removes little endian UTF-16 BOM', function () {
|
||||
expect(bomb.trim(testInput.utf16LittleEndian)).to.be(TEST_STRING);
|
||||
});
|
||||
|
||||
it('correctly removes UTF-8 BOM', function () {
|
||||
expect(bomb.trim(testInput.utf8)).to.be(TEST_STRING);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
751
node_modules/liquid-json/vendor/parse.js
generated
vendored
Normal file
751
node_modules/liquid-json/vendor/parse.js
generated
vendored
Normal file
@@ -0,0 +1,751 @@
|
||||
/*
|
||||
* Author: Alex Kocharin <alex@kocharin.ru>
|
||||
* GIT: https://github.com/rlidwka/jju
|
||||
* License: WTFPL, grab your copy here: http://www.wtfpl.net/txt/copying/
|
||||
*/
|
||||
|
||||
// RTFM: http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-262.pdf
|
||||
|
||||
var Uni = require('./unicode')
|
||||
|
||||
function isHexDigit(x) {
|
||||
return (x >= '0' && x <= '9')
|
||||
|| (x >= 'A' && x <= 'F')
|
||||
|| (x >= 'a' && x <= 'f')
|
||||
}
|
||||
|
||||
function isOctDigit(x) {
|
||||
return x >= '0' && x <= '7'
|
||||
}
|
||||
|
||||
function isDecDigit(x) {
|
||||
return x >= '0' && x <= '9'
|
||||
}
|
||||
|
||||
var unescapeMap = {
|
||||
'\'': '\'',
|
||||
'"' : '"',
|
||||
'\\': '\\',
|
||||
'b' : '\b',
|
||||
'f' : '\f',
|
||||
'n' : '\n',
|
||||
'r' : '\r',
|
||||
't' : '\t',
|
||||
'v' : '\v',
|
||||
'/' : '/',
|
||||
}
|
||||
|
||||
function formatError(input, msg, position, lineno, column, json5) {
|
||||
var result = msg + ' at ' + (lineno + 1) + ':' + (column + 1)
|
||||
, tmppos = position - column - 1
|
||||
, srcline = ''
|
||||
, underline = ''
|
||||
|
||||
var isLineTerminator = json5 ? Uni.isLineTerminator : Uni.isLineTerminatorJSON
|
||||
|
||||
// output no more than 70 characters before the wrong ones
|
||||
if (tmppos < position - 70) {
|
||||
tmppos = position - 70
|
||||
}
|
||||
|
||||
while (1) {
|
||||
var chr = input[++tmppos]
|
||||
|
||||
if (isLineTerminator(chr) || tmppos === input.length) {
|
||||
if (position >= tmppos) {
|
||||
// ending line error, so show it after the last char
|
||||
underline += '^'
|
||||
}
|
||||
break
|
||||
}
|
||||
srcline += chr
|
||||
|
||||
if (position === tmppos) {
|
||||
underline += '^'
|
||||
} else if (position > tmppos) {
|
||||
underline += input[tmppos] === '\t' ? '\t' : ' '
|
||||
}
|
||||
|
||||
// output no more than 78 characters on the string
|
||||
if (srcline.length > 78) break
|
||||
}
|
||||
|
||||
return result + '\n' + srcline + '\n' + underline
|
||||
}
|
||||
|
||||
function parse(input, options) {
|
||||
// parse as a standard JSON mode
|
||||
var json5 = !(options.mode === 'json' || options.legacy)
|
||||
var isLineTerminator = json5 ? Uni.isLineTerminator : Uni.isLineTerminatorJSON
|
||||
var isWhiteSpace = json5 ? Uni.isWhiteSpace : Uni.isWhiteSpaceJSON
|
||||
|
||||
var length = input.length
|
||||
, lineno = 0
|
||||
, linestart = 0
|
||||
, position = 0
|
||||
, stack = []
|
||||
|
||||
var tokenStart = function() {}
|
||||
var tokenEnd = function(v) {return v}
|
||||
|
||||
/* tokenize({
|
||||
raw: '...',
|
||||
type: 'whitespace'|'comment'|'key'|'literal'|'separator'|'newline',
|
||||
value: 'number'|'string'|'whatever',
|
||||
path: [...],
|
||||
})
|
||||
*/
|
||||
if (options._tokenize) {
|
||||
;(function() {
|
||||
var start = null
|
||||
tokenStart = function() {
|
||||
if (start !== null) throw Error('internal error, token overlap')
|
||||
start = position
|
||||
}
|
||||
|
||||
tokenEnd = function(v, type) {
|
||||
if (start != position) {
|
||||
var hash = {
|
||||
raw: input.substr(start, position-start),
|
||||
type: type,
|
||||
stack: stack.slice(0),
|
||||
}
|
||||
if (v !== undefined) hash.value = v
|
||||
options._tokenize.call(null, hash)
|
||||
}
|
||||
start = null
|
||||
return v
|
||||
}
|
||||
})()
|
||||
}
|
||||
|
||||
function fail(msg) {
|
||||
var column = position - linestart
|
||||
|
||||
if (!msg) {
|
||||
if (position < length) {
|
||||
var token = '\'' +
|
||||
JSON
|
||||
.stringify(input[position])
|
||||
.replace(/^"|"$/g, '')
|
||||
.replace(/'/g, "\\'")
|
||||
.replace(/\\"/g, '"')
|
||||
+ '\''
|
||||
|
||||
if (!msg) msg = 'Unexpected token ' + token
|
||||
} else {
|
||||
if (!msg) msg = 'Unexpected end of input'
|
||||
}
|
||||
}
|
||||
|
||||
var error = SyntaxError(formatError(input, msg, position, lineno, column, json5))
|
||||
error.row = lineno + 1
|
||||
error.column = column + 1
|
||||
throw error
|
||||
}
|
||||
|
||||
function newline(chr) {
|
||||
// account for <cr><lf>
|
||||
if (chr === '\r' && input[position] === '\n') position++
|
||||
linestart = position
|
||||
lineno++
|
||||
}
|
||||
|
||||
function parseGeneric() {
|
||||
var result
|
||||
|
||||
while (position < length) {
|
||||
tokenStart()
|
||||
var chr = input[position++]
|
||||
|
||||
if (chr === '"' || (chr === '\'' && json5)) {
|
||||
return tokenEnd(parseString(chr), 'literal')
|
||||
|
||||
} else if (chr === '{') {
|
||||
tokenEnd(undefined, 'separator')
|
||||
return parseObject()
|
||||
|
||||
} else if (chr === '[') {
|
||||
tokenEnd(undefined, 'separator')
|
||||
return parseArray()
|
||||
|
||||
} else if (chr === '-'
|
||||
|| chr === '.'
|
||||
|| isDecDigit(chr)
|
||||
// + number Infinity NaN
|
||||
|| (json5 && (chr === '+' || chr === 'I' || chr === 'N'))
|
||||
) {
|
||||
return tokenEnd(parseNumber(), 'literal')
|
||||
|
||||
} else if (chr === 'n') {
|
||||
parseKeyword('null')
|
||||
return tokenEnd(null, 'literal')
|
||||
|
||||
} else if (chr === 't') {
|
||||
parseKeyword('true')
|
||||
return tokenEnd(true, 'literal')
|
||||
|
||||
} else if (chr === 'f') {
|
||||
parseKeyword('false')
|
||||
return tokenEnd(false, 'literal')
|
||||
|
||||
} else {
|
||||
position--
|
||||
return tokenEnd(undefined)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function parseKey() {
|
||||
var result
|
||||
|
||||
while (position < length) {
|
||||
tokenStart()
|
||||
var chr = input[position++]
|
||||
|
||||
if (chr === '"' || (chr === '\'' && json5)) {
|
||||
return tokenEnd(parseString(chr), 'key')
|
||||
|
||||
} else if (chr === '{') {
|
||||
tokenEnd(undefined, 'separator')
|
||||
return parseObject()
|
||||
|
||||
} else if (chr === '[') {
|
||||
tokenEnd(undefined, 'separator')
|
||||
return parseArray()
|
||||
|
||||
} else if (chr === '.'
|
||||
|| isDecDigit(chr)
|
||||
) {
|
||||
return tokenEnd(parseNumber(true), 'key')
|
||||
|
||||
} else if (json5
|
||||
&& Uni.isIdentifierStart(chr) || (chr === '\\' && input[position] === 'u')) {
|
||||
// unicode char or a unicode sequence
|
||||
var rollback = position - 1
|
||||
var result = parseIdentifier()
|
||||
|
||||
if (result === undefined) {
|
||||
position = rollback
|
||||
return tokenEnd(undefined)
|
||||
} else {
|
||||
return tokenEnd(result, 'key')
|
||||
}
|
||||
|
||||
} else {
|
||||
position--
|
||||
return tokenEnd(undefined)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function skipWhiteSpace() {
|
||||
tokenStart()
|
||||
while (position < length) {
|
||||
var chr = input[position++]
|
||||
|
||||
if (isLineTerminator(chr)) {
|
||||
position--
|
||||
tokenEnd(undefined, 'whitespace')
|
||||
tokenStart()
|
||||
position++
|
||||
newline(chr)
|
||||
tokenEnd(undefined, 'newline')
|
||||
tokenStart()
|
||||
|
||||
} else if (isWhiteSpace(chr)) {
|
||||
// nothing
|
||||
|
||||
} else if (chr === '/'
|
||||
&& json5
|
||||
&& (input[position] === '/' || input[position] === '*')
|
||||
) {
|
||||
position--
|
||||
tokenEnd(undefined, 'whitespace')
|
||||
tokenStart()
|
||||
position++
|
||||
skipComment(input[position++] === '*')
|
||||
tokenEnd(undefined, 'comment')
|
||||
tokenStart()
|
||||
|
||||
} else {
|
||||
position--
|
||||
break
|
||||
}
|
||||
}
|
||||
return tokenEnd(undefined, 'whitespace')
|
||||
}
|
||||
|
||||
function skipComment(multi) {
|
||||
while (position < length) {
|
||||
var chr = input[position++]
|
||||
|
||||
if (isLineTerminator(chr)) {
|
||||
// LineTerminator is an end of singleline comment
|
||||
if (!multi) {
|
||||
// let parent function deal with newline
|
||||
position--
|
||||
return
|
||||
}
|
||||
|
||||
newline(chr)
|
||||
|
||||
} else if (chr === '*' && multi) {
|
||||
// end of multiline comment
|
||||
if (input[position] === '/') {
|
||||
position++
|
||||
return
|
||||
}
|
||||
|
||||
} else {
|
||||
// nothing
|
||||
}
|
||||
}
|
||||
|
||||
if (multi) {
|
||||
fail('Unclosed multiline comment')
|
||||
}
|
||||
}
|
||||
|
||||
function parseKeyword(keyword) {
|
||||
// keyword[0] is not checked because it should've checked earlier
|
||||
var _pos = position
|
||||
var len = keyword.length
|
||||
for (var i=1; i<len; i++) {
|
||||
if (position >= length || keyword[i] != input[position]) {
|
||||
position = _pos-1
|
||||
fail()
|
||||
}
|
||||
position++
|
||||
}
|
||||
}
|
||||
|
||||
function parseObject() {
|
||||
var result = options.null_prototype ? Object.create(null) : {}
|
||||
, empty_object = {}
|
||||
, is_non_empty = false
|
||||
|
||||
while (position < length) {
|
||||
skipWhiteSpace()
|
||||
var item1 = parseKey()
|
||||
skipWhiteSpace()
|
||||
tokenStart()
|
||||
var chr = input[position++]
|
||||
tokenEnd(undefined, 'separator')
|
||||
|
||||
if (chr === '}' && item1 === undefined) {
|
||||
if (!json5 && is_non_empty) {
|
||||
position--
|
||||
fail('Trailing comma in object')
|
||||
}
|
||||
return result
|
||||
|
||||
} else if (chr === ':' && item1 !== undefined) {
|
||||
skipWhiteSpace()
|
||||
stack.push(item1)
|
||||
var item2 = parseGeneric()
|
||||
stack.pop()
|
||||
|
||||
if (item2 === undefined) fail('No value found for key ' + item1)
|
||||
if (typeof(item1) !== 'string') {
|
||||
if (!json5 || typeof(item1) !== 'number') {
|
||||
fail('Wrong key type: ' + item1)
|
||||
}
|
||||
}
|
||||
|
||||
if ((item1 in empty_object || empty_object[item1] != null) && options.reserved_keys !== 'replace') {
|
||||
if (options.reserved_keys === 'throw') {
|
||||
fail('Reserved key: ' + item1)
|
||||
} else {
|
||||
// silently ignore it
|
||||
}
|
||||
} else {
|
||||
if (typeof(options.reviver) === 'function') {
|
||||
item2 = options.reviver.call(null, item1, item2)
|
||||
}
|
||||
|
||||
if (item2 !== undefined) {
|
||||
is_non_empty = true
|
||||
Object.defineProperty(result, item1, {
|
||||
value: item2,
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
writable: true,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
skipWhiteSpace()
|
||||
|
||||
tokenStart()
|
||||
var chr = input[position++]
|
||||
tokenEnd(undefined, 'separator')
|
||||
|
||||
if (chr === ',') {
|
||||
continue
|
||||
|
||||
} else if (chr === '}') {
|
||||
return result
|
||||
|
||||
} else {
|
||||
fail()
|
||||
}
|
||||
|
||||
} else {
|
||||
position--
|
||||
fail()
|
||||
}
|
||||
}
|
||||
|
||||
fail()
|
||||
}
|
||||
|
||||
function parseArray() {
|
||||
var result = []
|
||||
|
||||
while (position < length) {
|
||||
skipWhiteSpace()
|
||||
stack.push(result.length)
|
||||
var item = parseGeneric()
|
||||
stack.pop()
|
||||
skipWhiteSpace()
|
||||
tokenStart()
|
||||
var chr = input[position++]
|
||||
tokenEnd(undefined, 'separator')
|
||||
|
||||
if (item !== undefined) {
|
||||
if (typeof(options.reviver) === 'function') {
|
||||
item = options.reviver.call(null, String(result.length), item)
|
||||
}
|
||||
if (item === undefined) {
|
||||
result.length++
|
||||
item = true // hack for check below, not included into result
|
||||
} else {
|
||||
result.push(item)
|
||||
}
|
||||
}
|
||||
|
||||
if (chr === ',') {
|
||||
if (item === undefined) {
|
||||
fail('Elisions are not supported')
|
||||
}
|
||||
|
||||
} else if (chr === ']') {
|
||||
if (!json5 && item === undefined && result.length) {
|
||||
position--
|
||||
fail('Trailing comma in array')
|
||||
}
|
||||
return result
|
||||
|
||||
} else {
|
||||
position--
|
||||
fail()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function parseNumber() {
|
||||
// rewind because we don't know first char
|
||||
position--
|
||||
|
||||
var start = position
|
||||
, chr = input[position++]
|
||||
, t
|
||||
|
||||
var to_num = function(is_octal) {
|
||||
var str = input.substr(start, position - start)
|
||||
|
||||
if (is_octal) {
|
||||
var result = parseInt(str.replace(/^0o?/, ''), 8)
|
||||
} else {
|
||||
var result = Number(str)
|
||||
}
|
||||
|
||||
if (Number.isNaN(result)) {
|
||||
position--
|
||||
fail('Bad numeric literal - "' + input.substr(start, position - start + 1) + '"')
|
||||
} else if (!json5 && !str.match(/^-?(0|[1-9][0-9]*)(\.[0-9]+)?(e[+-]?[0-9]+)?$/i)) {
|
||||
// additional restrictions imposed by json
|
||||
position--
|
||||
fail('Non-json numeric literal - "' + input.substr(start, position - start + 1) + '"')
|
||||
} else {
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
||||
// ex: -5982475.249875e+29384
|
||||
// ^ skipping this
|
||||
if (chr === '-' || (chr === '+' && json5)) chr = input[position++]
|
||||
|
||||
if (chr === 'N' && json5) {
|
||||
parseKeyword('NaN')
|
||||
return NaN
|
||||
}
|
||||
|
||||
if (chr === 'I' && json5) {
|
||||
parseKeyword('Infinity')
|
||||
|
||||
// returning +inf or -inf
|
||||
return to_num()
|
||||
}
|
||||
|
||||
if (chr >= '1' && chr <= '9') {
|
||||
// ex: -5982475.249875e+29384
|
||||
// ^^^ skipping these
|
||||
while (position < length && isDecDigit(input[position])) position++
|
||||
chr = input[position++]
|
||||
}
|
||||
|
||||
// special case for leading zero: 0.123456
|
||||
if (chr === '0') {
|
||||
chr = input[position++]
|
||||
|
||||
// new syntax, "0o777" old syntax, "0777"
|
||||
var is_octal = chr === 'o' || chr === 'O' || isOctDigit(chr)
|
||||
var is_hex = chr === 'x' || chr === 'X'
|
||||
|
||||
if (json5 && (is_octal || is_hex)) {
|
||||
while (position < length
|
||||
&& (is_hex ? isHexDigit : isOctDigit)( input[position] )
|
||||
) position++
|
||||
|
||||
var sign = 1
|
||||
if (input[start] === '-') {
|
||||
sign = -1
|
||||
start++
|
||||
} else if (input[start] === '+') {
|
||||
start++
|
||||
}
|
||||
|
||||
return sign * to_num(is_octal)
|
||||
}
|
||||
}
|
||||
|
||||
if (chr === '.') {
|
||||
// ex: -5982475.249875e+29384
|
||||
// ^^^ skipping these
|
||||
while (position < length && isDecDigit(input[position])) position++
|
||||
chr = input[position++]
|
||||
}
|
||||
|
||||
if (chr === 'e' || chr === 'E') {
|
||||
chr = input[position++]
|
||||
if (chr === '-' || chr === '+') position++
|
||||
// ex: -5982475.249875e+29384
|
||||
// ^^^ skipping these
|
||||
while (position < length && isDecDigit(input[position])) position++
|
||||
chr = input[position++]
|
||||
}
|
||||
|
||||
// we have char in the buffer, so count for it
|
||||
position--
|
||||
return to_num()
|
||||
}
|
||||
|
||||
function parseIdentifier() {
|
||||
// rewind because we don't know first char
|
||||
position--
|
||||
|
||||
var result = ''
|
||||
|
||||
while (position < length) {
|
||||
var chr = input[position++]
|
||||
|
||||
if (chr === '\\'
|
||||
&& input[position] === 'u'
|
||||
&& isHexDigit(input[position+1])
|
||||
&& isHexDigit(input[position+2])
|
||||
&& isHexDigit(input[position+3])
|
||||
&& isHexDigit(input[position+4])
|
||||
) {
|
||||
// UnicodeEscapeSequence
|
||||
chr = String.fromCharCode(parseInt(input.substr(position+1, 4), 16))
|
||||
position += 5
|
||||
}
|
||||
|
||||
if (result.length) {
|
||||
// identifier started
|
||||
if (Uni.isIdentifierPart(chr)) {
|
||||
result += chr
|
||||
} else {
|
||||
position--
|
||||
return result
|
||||
}
|
||||
|
||||
} else {
|
||||
if (Uni.isIdentifierStart(chr)) {
|
||||
result += chr
|
||||
} else {
|
||||
return undefined
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fail()
|
||||
}
|
||||
|
||||
function parseString(endChar) {
|
||||
// 7.8.4 of ES262 spec
|
||||
var result = ''
|
||||
|
||||
while (position < length) {
|
||||
var chr = input[position++]
|
||||
|
||||
if (chr === endChar) {
|
||||
return result
|
||||
|
||||
} else if (chr === '\\') {
|
||||
if (position >= length) fail()
|
||||
chr = input[position++]
|
||||
|
||||
if (unescapeMap[chr] && (json5 || (chr != 'v' && chr != "'"))) {
|
||||
result += unescapeMap[chr]
|
||||
|
||||
} else if (json5 && isLineTerminator(chr)) {
|
||||
// line continuation
|
||||
newline(chr)
|
||||
|
||||
} else if (chr === 'u' || (chr === 'x' && json5)) {
|
||||
// unicode/character escape sequence
|
||||
var off = chr === 'u' ? 4 : 2
|
||||
|
||||
// validation for \uXXXX
|
||||
for (var i=0; i<off; i++) {
|
||||
if (position >= length) fail()
|
||||
if (!isHexDigit(input[position])) fail('Bad escape sequence')
|
||||
position++
|
||||
}
|
||||
|
||||
result += String.fromCharCode(parseInt(input.substr(position-off, off), 16))
|
||||
} else if (json5 && isOctDigit(chr)) {
|
||||
if (chr < '4' && isOctDigit(input[position]) && isOctDigit(input[position+1])) {
|
||||
// three-digit octal
|
||||
var digits = 3
|
||||
} else if (isOctDigit(input[position])) {
|
||||
// two-digit octal
|
||||
var digits = 2
|
||||
} else {
|
||||
var digits = 1
|
||||
}
|
||||
position += digits - 1
|
||||
result += String.fromCharCode(parseInt(input.substr(position-digits, digits), 8))
|
||||
/*if (!isOctDigit(input[position])) {
|
||||
// \0 is allowed still
|
||||
result += '\0'
|
||||
} else {
|
||||
fail('Octal literals are not supported')
|
||||
}*/
|
||||
|
||||
} else if (json5) {
|
||||
// \X -> x
|
||||
result += chr
|
||||
|
||||
} else {
|
||||
position--
|
||||
fail()
|
||||
}
|
||||
|
||||
} else if (isLineTerminator(chr)) {
|
||||
fail()
|
||||
|
||||
} else {
|
||||
if (!json5 && chr.charCodeAt(0) < 32) {
|
||||
position--
|
||||
fail('Unexpected control character')
|
||||
}
|
||||
|
||||
// SourceCharacter but not one of " or \ or LineTerminator
|
||||
result += chr
|
||||
}
|
||||
}
|
||||
|
||||
fail()
|
||||
}
|
||||
|
||||
skipWhiteSpace()
|
||||
var return_value = parseGeneric()
|
||||
if (return_value !== undefined || position < length) {
|
||||
skipWhiteSpace()
|
||||
|
||||
if (position >= length) {
|
||||
if (typeof(options.reviver) === 'function') {
|
||||
return_value = options.reviver.call(null, '', return_value)
|
||||
}
|
||||
return return_value
|
||||
} else {
|
||||
fail()
|
||||
}
|
||||
|
||||
} else {
|
||||
if (position) {
|
||||
fail('No data, only a whitespace')
|
||||
} else {
|
||||
fail('No data, empty input')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* parse(text, options)
|
||||
* or
|
||||
* parse(text, reviver)
|
||||
*
|
||||
* where:
|
||||
* text - string
|
||||
* options - object
|
||||
* reviver - function
|
||||
*/
|
||||
module.exports.parse = function parseJSON(input, options) {
|
||||
// support legacy functions
|
||||
if (typeof(options) === 'function') {
|
||||
options = {
|
||||
reviver: options
|
||||
}
|
||||
}
|
||||
|
||||
if (input === undefined) {
|
||||
// parse(stringify(x)) should be equal x
|
||||
// with JSON functions it is not 'cause of undefined
|
||||
// so we're fixing it
|
||||
return undefined
|
||||
}
|
||||
|
||||
// JSON.parse compat
|
||||
if (typeof(input) !== 'string') input = String(input)
|
||||
if (options == null) options = {}
|
||||
if (options.reserved_keys == null) options.reserved_keys = 'ignore'
|
||||
|
||||
if (options.reserved_keys === 'throw' || options.reserved_keys === 'ignore') {
|
||||
if (options.null_prototype == null) {
|
||||
options.null_prototype = true
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
return parse(input, options)
|
||||
} catch(err) {
|
||||
// jju is a recursive parser, so JSON.parse("{{{{{{{") could blow up the stack
|
||||
//
|
||||
// this catch is used to skip all those internal calls
|
||||
if (err instanceof SyntaxError && err.row != null && err.column != null) {
|
||||
var old_err = err
|
||||
err = SyntaxError(old_err.message)
|
||||
err.column = old_err.column
|
||||
err.row = old_err.row
|
||||
}
|
||||
throw err
|
||||
}
|
||||
}
|
||||
|
||||
module.exports.tokenize = function tokenizeJSON(input, options) {
|
||||
if (options == null) options = {}
|
||||
|
||||
options._tokenize = function(smth) {
|
||||
if (options._addstack) smth.stack.unshift.apply(smth.stack, options._addstack)
|
||||
tokens.push(smth)
|
||||
}
|
||||
|
||||
var tokens = []
|
||||
tokens.data = module.exports.parse(input, options)
|
||||
return tokens
|
||||
}
|
71
node_modules/liquid-json/vendor/unicode.js
generated
vendored
Normal file
71
node_modules/liquid-json/vendor/unicode.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user