mirror of
https://github.com/valitydev/openapi-generator.git
synced 2024-11-06 18:45:23 +00:00
remove node_modeuls under petstore security test for js
This commit is contained in:
parent
73f88f0bff
commit
1e596654cd
2
.gitignore
vendored
2
.gitignore
vendored
@ -41,7 +41,7 @@ samples/server-generator/scalatra/target
|
||||
samples/server-generator/scalatra/output/.history
|
||||
|
||||
# nodejs
|
||||
**/node_modules/
|
||||
**/node_modules
|
||||
samples/server-generator/node/output/node_modules
|
||||
samples/server/petstore/nodejs/node_modules
|
||||
samples/server/petstore/nodejs-server/node_modules
|
||||
|
1
samples/client/petstore-security-test/javascript/node_modules/.bin/_mocha
generated
vendored
1
samples/client/petstore-security-test/javascript/node_modules/.bin/_mocha
generated
vendored
@ -1 +0,0 @@
|
||||
../mocha/bin/_mocha
|
1
samples/client/petstore-security-test/javascript/node_modules/.bin/jade
generated
vendored
1
samples/client/petstore-security-test/javascript/node_modules/.bin/jade
generated
vendored
@ -1 +0,0 @@
|
||||
../jade/bin/jade
|
1
samples/client/petstore-security-test/javascript/node_modules/.bin/jshint
generated
vendored
1
samples/client/petstore-security-test/javascript/node_modules/.bin/jshint
generated
vendored
@ -1 +0,0 @@
|
||||
../jshint/bin/jshint
|
1
samples/client/petstore-security-test/javascript/node_modules/.bin/mime
generated
vendored
1
samples/client/petstore-security-test/javascript/node_modules/.bin/mime
generated
vendored
@ -1 +0,0 @@
|
||||
../mime/cli.js
|
1
samples/client/petstore-security-test/javascript/node_modules/.bin/mkdirp
generated
vendored
1
samples/client/petstore-security-test/javascript/node_modules/.bin/mkdirp
generated
vendored
@ -1 +0,0 @@
|
||||
../mkdirp/bin/cmd.js
|
1
samples/client/petstore-security-test/javascript/node_modules/.bin/mocha
generated
vendored
1
samples/client/petstore-security-test/javascript/node_modules/.bin/mocha
generated
vendored
@ -1 +0,0 @@
|
||||
../mocha/bin/mocha
|
1
samples/client/petstore-security-test/javascript/node_modules/.bin/shjs
generated
vendored
1
samples/client/petstore-security-test/javascript/node_modules/.bin/shjs
generated
vendored
@ -1 +0,0 @@
|
||||
../shelljs/bin/shjs
|
@ -1 +0,0 @@
|
||||
../strip-json-comments/cli.js
|
1
samples/client/petstore-security-test/javascript/node_modules/.bin/supports-color
generated
vendored
1
samples/client/petstore-security-test/javascript/node_modules/.bin/supports-color
generated
vendored
@ -1 +0,0 @@
|
||||
../supports-color/cli.js
|
5
samples/client/petstore-security-test/javascript/node_modules/async/.travis.yml
generated
vendored
5
samples/client/petstore-security-test/javascript/node_modules/async/.travis.yml
generated
vendored
@ -1,5 +0,0 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- "0.10"
|
||||
- "0.12"
|
||||
- "iojs"
|
19
samples/client/petstore-security-test/javascript/node_modules/async/LICENSE
generated
vendored
19
samples/client/petstore-security-test/javascript/node_modules/async/LICENSE
generated
vendored
@ -1,19 +0,0 @@
|
||||
Copyright (c) 2010-2014 Caolan McMahon
|
||||
|
||||
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.
|
1647
samples/client/petstore-security-test/javascript/node_modules/async/README.md
generated
vendored
1647
samples/client/petstore-security-test/javascript/node_modules/async/README.md
generated
vendored
File diff suppressed because it is too large
Load Diff
38
samples/client/petstore-security-test/javascript/node_modules/async/bower.json
generated
vendored
38
samples/client/petstore-security-test/javascript/node_modules/async/bower.json
generated
vendored
@ -1,38 +0,0 @@
|
||||
{
|
||||
"name": "async",
|
||||
"description": "Higher-order functions and common patterns for asynchronous code",
|
||||
"version": "0.9.2",
|
||||
"main": "lib/async.js",
|
||||
"keywords": [
|
||||
"async",
|
||||
"callback",
|
||||
"utility",
|
||||
"module"
|
||||
],
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/caolan/async.git"
|
||||
},
|
||||
"devDependencies": {
|
||||
"nodeunit": ">0.0.0",
|
||||
"uglify-js": "1.2.x",
|
||||
"nodelint": ">0.0.0",
|
||||
"lodash": ">=2.4.1"
|
||||
},
|
||||
"moduleType": [
|
||||
"amd",
|
||||
"globals",
|
||||
"node"
|
||||
],
|
||||
"ignore": [
|
||||
"**/.*",
|
||||
"node_modules",
|
||||
"bower_components",
|
||||
"test",
|
||||
"tests"
|
||||
],
|
||||
"authors": [
|
||||
"Caolan McMahon"
|
||||
]
|
||||
}
|
16
samples/client/petstore-security-test/javascript/node_modules/async/component.json
generated
vendored
16
samples/client/petstore-security-test/javascript/node_modules/async/component.json
generated
vendored
@ -1,16 +0,0 @@
|
||||
{
|
||||
"name": "async",
|
||||
"description": "Higher-order functions and common patterns for asynchronous code",
|
||||
"version": "0.9.2",
|
||||
"keywords": [
|
||||
"async",
|
||||
"callback",
|
||||
"utility",
|
||||
"module"
|
||||
],
|
||||
"license": "MIT",
|
||||
"repository": "caolan/async",
|
||||
"scripts": [
|
||||
"lib/async.js"
|
||||
]
|
||||
}
|
1123
samples/client/petstore-security-test/javascript/node_modules/async/lib/async.js
generated
vendored
1123
samples/client/petstore-security-test/javascript/node_modules/async/lib/async.js
generated
vendored
File diff suppressed because it is too large
Load Diff
109
samples/client/petstore-security-test/javascript/node_modules/async/package.json
generated
vendored
109
samples/client/petstore-security-test/javascript/node_modules/async/package.json
generated
vendored
@ -1,109 +0,0 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"async@~0.9.0",
|
||||
"/Users/williamcheng/Code/may2016/swagger-codegen/samples/client/petstore-security-test/javascript/node_modules/form-data"
|
||||
]
|
||||
],
|
||||
"_from": "async@>=0.9.0 <0.10.0",
|
||||
"_id": "async@0.9.2",
|
||||
"_inCache": true,
|
||||
"_installable": true,
|
||||
"_location": "/async",
|
||||
"_nodeVersion": "2.0.1",
|
||||
"_npmUser": {
|
||||
"email": "beau@beaugunderson.com",
|
||||
"name": "beaugunderson"
|
||||
},
|
||||
"_npmVersion": "2.9.0",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"name": "async",
|
||||
"raw": "async@~0.9.0",
|
||||
"rawSpec": "~0.9.0",
|
||||
"scope": null,
|
||||
"spec": ">=0.9.0 <0.10.0",
|
||||
"type": "range"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/form-data"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/async/-/async-0.9.2.tgz",
|
||||
"_shasum": "aea74d5e61c1f899613bf64bda66d4c78f2fd17d",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "async@~0.9.0",
|
||||
"_where": "/Users/williamcheng/Code/may2016/swagger-codegen/samples/client/petstore-security-test/javascript/node_modules/form-data",
|
||||
"author": {
|
||||
"name": "Caolan McMahon"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/caolan/async/issues"
|
||||
},
|
||||
"dependencies": {},
|
||||
"description": "Higher-order functions and common patterns for asynchronous code",
|
||||
"devDependencies": {
|
||||
"lodash": ">=2.4.1",
|
||||
"nodelint": ">0.0.0",
|
||||
"nodeunit": ">0.0.0",
|
||||
"uglify-js": "1.2.x"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "aea74d5e61c1f899613bf64bda66d4c78f2fd17d",
|
||||
"tarball": "https://registry.npmjs.org/async/-/async-0.9.2.tgz"
|
||||
},
|
||||
"gitHead": "de3a16091d5125384eff4a54deb3998b13c3814c",
|
||||
"homepage": "https://github.com/caolan/async#readme",
|
||||
"jam": {
|
||||
"categories": [
|
||||
"Utilities"
|
||||
],
|
||||
"include": [
|
||||
"LICENSE",
|
||||
"README.md",
|
||||
"lib/async.js"
|
||||
],
|
||||
"main": "lib/async.js"
|
||||
},
|
||||
"keywords": [
|
||||
"async",
|
||||
"callback",
|
||||
"module",
|
||||
"utility"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "lib/async.js",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "caolan",
|
||||
"email": "caolan.mcmahon@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "beaugunderson",
|
||||
"email": "beau@beaugunderson.com"
|
||||
}
|
||||
],
|
||||
"name": "async",
|
||||
"optionalDependencies": {},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/caolan/async.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "nodeunit test/test-async.js"
|
||||
},
|
||||
"spm": {
|
||||
"main": "lib/async.js"
|
||||
},
|
||||
"version": "0.9.2",
|
||||
"volo": {
|
||||
"ignore": [
|
||||
"**/.*",
|
||||
"bower_components",
|
||||
"node_modules",
|
||||
"test",
|
||||
"tests"
|
||||
],
|
||||
"main": "lib/async.js"
|
||||
}
|
||||
}
|
@ -1,53 +0,0 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
// This should probably be its own module but complaints about bower/etc.
|
||||
// support keep coming up and I'd rather just enable the workflow here for now
|
||||
// and figure out where this should live later. -- @beaugunderson
|
||||
|
||||
var fs = require('fs');
|
||||
var _ = require('lodash');
|
||||
|
||||
var packageJson = require('../package.json');
|
||||
|
||||
var IGNORES = ['**/.*', 'node_modules', 'bower_components', 'test', 'tests'];
|
||||
var INCLUDES = ['lib/async.js', 'README.md', 'LICENSE'];
|
||||
var REPOSITORY_NAME = 'caolan/async';
|
||||
|
||||
packageJson.jam = {
|
||||
main: packageJson.main,
|
||||
include: INCLUDES,
|
||||
categories: ['Utilities']
|
||||
};
|
||||
|
||||
packageJson.spm = {
|
||||
main: packageJson.main
|
||||
};
|
||||
|
||||
packageJson.volo = {
|
||||
main: packageJson.main,
|
||||
ignore: IGNORES
|
||||
};
|
||||
|
||||
var bowerSpecific = {
|
||||
moduleType: ['amd', 'globals', 'node'],
|
||||
ignore: IGNORES,
|
||||
authors: [packageJson.author]
|
||||
};
|
||||
|
||||
var bowerInclude = ['name', 'description', 'version', 'main', 'keywords',
|
||||
'license', 'homepage', 'repository', 'devDependencies'];
|
||||
|
||||
var componentSpecific = {
|
||||
repository: REPOSITORY_NAME,
|
||||
scripts: [packageJson.main]
|
||||
};
|
||||
|
||||
var componentInclude = ['name', 'description', 'version', 'keywords',
|
||||
'license'];
|
||||
|
||||
var bowerJson = _.merge({}, _.pick(packageJson, bowerInclude), bowerSpecific);
|
||||
var componentJson = _.merge({}, _.pick(packageJson, componentInclude), componentSpecific);
|
||||
|
||||
fs.writeFileSync('./bower.json', JSON.stringify(bowerJson, null, 2));
|
||||
fs.writeFileSync('./component.json', JSON.stringify(componentJson, null, 2));
|
||||
fs.writeFileSync('./package.json', JSON.stringify(packageJson, null, 2));
|
@ -1,5 +0,0 @@
|
||||
test
|
||||
.gitignore
|
||||
.travis.yml
|
||||
Makefile
|
||||
example.js
|
21
samples/client/petstore-security-test/javascript/node_modules/balanced-match/LICENSE.md
generated
vendored
21
samples/client/petstore-security-test/javascript/node_modules/balanced-match/LICENSE.md
generated
vendored
@ -1,21 +0,0 @@
|
||||
(MIT)
|
||||
|
||||
Copyright (c) 2013 Julian Gruber <julian@juliangruber.com>
|
||||
|
||||
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.
|
91
samples/client/petstore-security-test/javascript/node_modules/balanced-match/README.md
generated
vendored
91
samples/client/petstore-security-test/javascript/node_modules/balanced-match/README.md
generated
vendored
@ -1,91 +0,0 @@
|
||||
# balanced-match
|
||||
|
||||
Match balanced string pairs, like `{` and `}` or `<b>` and `</b>`. Supports regular expressions as well!
|
||||
|
||||
[![build status](https://secure.travis-ci.org/juliangruber/balanced-match.svg)](http://travis-ci.org/juliangruber/balanced-match)
|
||||
[![downloads](https://img.shields.io/npm/dm/balanced-match.svg)](https://www.npmjs.org/package/balanced-match)
|
||||
|
||||
[![testling badge](https://ci.testling.com/juliangruber/balanced-match.png)](https://ci.testling.com/juliangruber/balanced-match)
|
||||
|
||||
## Example
|
||||
|
||||
Get the first matching pair of braces:
|
||||
|
||||
```js
|
||||
var balanced = require('balanced-match');
|
||||
|
||||
console.log(balanced('{', '}', 'pre{in{nested}}post'));
|
||||
console.log(balanced('{', '}', 'pre{first}between{second}post'));
|
||||
console.log(balanced(/\s+\{\s+/, /\s+\}\s+/, 'pre { in{nest} } post'));
|
||||
```
|
||||
|
||||
The matches are:
|
||||
|
||||
```bash
|
||||
$ node example.js
|
||||
{ start: 3, end: 14, pre: 'pre', body: 'in{nested}', post: 'post' }
|
||||
{ start: 3,
|
||||
end: 9,
|
||||
pre: 'pre',
|
||||
body: 'first',
|
||||
post: 'between{second}post' }
|
||||
{ start: 3, end: 17, pre: 'pre', body: 'in{nest}', post: 'post' }
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### var m = balanced(a, b, str)
|
||||
|
||||
For the first non-nested matching pair of `a` and `b` in `str`, return an
|
||||
object with those keys:
|
||||
|
||||
* **start** the index of the first match of `a`
|
||||
* **end** the index of the matching `b`
|
||||
* **pre** the preamble, `a` and `b` not included
|
||||
* **body** the match, `a` and `b` not included
|
||||
* **post** the postscript, `a` and `b` not included
|
||||
|
||||
If there's no match, `undefined` will be returned.
|
||||
|
||||
If the `str` contains more `a` than `b` / there are unmatched pairs, the first match that was closed will be used. For example, `{{a}` will match `['{', 'a', '']`.
|
||||
|
||||
### var r = balanced.range(a, b, str)
|
||||
|
||||
For the first non-nested matching pair of `a` and `b` in `str`, return an
|
||||
array with indexes: `[ <a index>, <b index> ]`.
|
||||
|
||||
If there's no match, `undefined` will be returned.
|
||||
|
||||
If the `str` contains more `a` than `b` / there are unmatched pairs, the first match that was closed will be used. For example, `{{a}` will match `[ 1, 3 ]`.
|
||||
|
||||
## Installation
|
||||
|
||||
With [npm](https://npmjs.org) do:
|
||||
|
||||
```bash
|
||||
npm install balanced-match
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
(MIT)
|
||||
|
||||
Copyright (c) 2013 Julian Gruber <julian@juliangruber.com>
|
||||
|
||||
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.
|
58
samples/client/petstore-security-test/javascript/node_modules/balanced-match/index.js
generated
vendored
58
samples/client/petstore-security-test/javascript/node_modules/balanced-match/index.js
generated
vendored
@ -1,58 +0,0 @@
|
||||
module.exports = balanced;
|
||||
function balanced(a, b, str) {
|
||||
if (a instanceof RegExp) a = maybeMatch(a, str);
|
||||
if (b instanceof RegExp) b = maybeMatch(b, str);
|
||||
|
||||
var r = range(a, b, str);
|
||||
|
||||
return r && {
|
||||
start: r[0],
|
||||
end: r[1],
|
||||
pre: str.slice(0, r[0]),
|
||||
body: str.slice(r[0] + a.length, r[1]),
|
||||
post: str.slice(r[1] + b.length)
|
||||
};
|
||||
}
|
||||
|
||||
function maybeMatch(reg, str) {
|
||||
var m = str.match(reg);
|
||||
return m ? m[0] : null;
|
||||
}
|
||||
|
||||
balanced.range = range;
|
||||
function range(a, b, str) {
|
||||
var begs, beg, left, right, result;
|
||||
var ai = str.indexOf(a);
|
||||
var bi = str.indexOf(b, ai + 1);
|
||||
var i = ai;
|
||||
|
||||
if (ai >= 0 && bi > 0) {
|
||||
begs = [];
|
||||
left = str.length;
|
||||
|
||||
while (i < str.length && i >= 0 && ! result) {
|
||||
if (i == ai) {
|
||||
begs.push(i);
|
||||
ai = str.indexOf(a, i + 1);
|
||||
} else if (begs.length == 1) {
|
||||
result = [ begs.pop(), bi ];
|
||||
} else {
|
||||
beg = begs.pop();
|
||||
if (beg < left) {
|
||||
left = beg;
|
||||
right = bi;
|
||||
}
|
||||
|
||||
bi = str.indexOf(b, i + 1);
|
||||
}
|
||||
|
||||
i = ai < bi && ai >= 0 ? ai : bi;
|
||||
}
|
||||
|
||||
if (begs.length) {
|
||||
result = [ left, right ];
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
101
samples/client/petstore-security-test/javascript/node_modules/balanced-match/package.json
generated
vendored
101
samples/client/petstore-security-test/javascript/node_modules/balanced-match/package.json
generated
vendored
@ -1,101 +0,0 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"balanced-match@^0.4.1",
|
||||
"/Users/williamcheng/Code/may2016/swagger-codegen/samples/client/petstore-security-test/javascript/node_modules/brace-expansion"
|
||||
]
|
||||
],
|
||||
"_from": "balanced-match@>=0.4.1 <0.5.0",
|
||||
"_id": "balanced-match@0.4.1",
|
||||
"_inCache": true,
|
||||
"_installable": true,
|
||||
"_location": "/balanced-match",
|
||||
"_nodeVersion": "6.0.0",
|
||||
"_npmOperationalInternal": {
|
||||
"host": "packages-12-west.internal.npmjs.com",
|
||||
"tmp": "tmp/balanced-match-0.4.1.tgz_1462129663650_0.39764496590942144"
|
||||
},
|
||||
"_npmUser": {
|
||||
"email": "julian@juliangruber.com",
|
||||
"name": "juliangruber"
|
||||
},
|
||||
"_npmVersion": "3.8.6",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"name": "balanced-match",
|
||||
"raw": "balanced-match@^0.4.1",
|
||||
"rawSpec": "^0.4.1",
|
||||
"scope": null,
|
||||
"spec": ">=0.4.1 <0.5.0",
|
||||
"type": "range"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/brace-expansion"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-0.4.1.tgz",
|
||||
"_shasum": "19053e2e0748eadb379da6c09d455cf5e1039335",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "balanced-match@^0.4.1",
|
||||
"_where": "/Users/williamcheng/Code/may2016/swagger-codegen/samples/client/petstore-security-test/javascript/node_modules/brace-expansion",
|
||||
"author": {
|
||||
"email": "mail@juliangruber.com",
|
||||
"name": "Julian Gruber",
|
||||
"url": "http://juliangruber.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/juliangruber/balanced-match/issues"
|
||||
},
|
||||
"dependencies": {},
|
||||
"description": "Match balanced character pairs, like \"{\" and \"}\"",
|
||||
"devDependencies": {
|
||||
"tape": "~4.5.0"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "19053e2e0748eadb379da6c09d455cf5e1039335",
|
||||
"tarball": "https://registry.npmjs.org/balanced-match/-/balanced-match-0.4.1.tgz"
|
||||
},
|
||||
"gitHead": "7004b289baaaab6a832f4901735e29d37cc2a863",
|
||||
"homepage": "https://github.com/juliangruber/balanced-match",
|
||||
"keywords": [
|
||||
"balanced",
|
||||
"match",
|
||||
"parse",
|
||||
"regexp",
|
||||
"test"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "juliangruber",
|
||||
"email": "julian@juliangruber.com"
|
||||
}
|
||||
],
|
||||
"name": "balanced-match",
|
||||
"optionalDependencies": {},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/juliangruber/balanced-match.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "make test"
|
||||
},
|
||||
"testling": {
|
||||
"browsers": [
|
||||
"android-browser/4.2..latest",
|
||||
"chrome/25..latest",
|
||||
"chrome/canary",
|
||||
"firefox/20..latest",
|
||||
"firefox/nightly",
|
||||
"ie/8..latest",
|
||||
"ipad/6.0..latest",
|
||||
"iphone/6.0..latest",
|
||||
"opera/12..latest",
|
||||
"opera/next",
|
||||
"safari/5.1..latest"
|
||||
],
|
||||
"files": "test/*.js"
|
||||
},
|
||||
"version": "0.4.1"
|
||||
}
|
122
samples/client/petstore-security-test/javascript/node_modules/brace-expansion/README.md
generated
vendored
122
samples/client/petstore-security-test/javascript/node_modules/brace-expansion/README.md
generated
vendored
@ -1,122 +0,0 @@
|
||||
# brace-expansion
|
||||
|
||||
[Brace expansion](https://www.gnu.org/software/bash/manual/html_node/Brace-Expansion.html),
|
||||
as known from sh/bash, in JavaScript.
|
||||
|
||||
[![build status](https://secure.travis-ci.org/juliangruber/brace-expansion.svg)](http://travis-ci.org/juliangruber/brace-expansion)
|
||||
[![downloads](https://img.shields.io/npm/dm/brace-expansion.svg)](https://www.npmjs.org/package/brace-expansion)
|
||||
|
||||
[![testling badge](https://ci.testling.com/juliangruber/brace-expansion.png)](https://ci.testling.com/juliangruber/brace-expansion)
|
||||
|
||||
## Example
|
||||
|
||||
```js
|
||||
var expand = require('brace-expansion');
|
||||
|
||||
expand('file-{a,b,c}.jpg')
|
||||
// => ['file-a.jpg', 'file-b.jpg', 'file-c.jpg']
|
||||
|
||||
expand('-v{,,}')
|
||||
// => ['-v', '-v', '-v']
|
||||
|
||||
expand('file{0..2}.jpg')
|
||||
// => ['file0.jpg', 'file1.jpg', 'file2.jpg']
|
||||
|
||||
expand('file-{a..c}.jpg')
|
||||
// => ['file-a.jpg', 'file-b.jpg', 'file-c.jpg']
|
||||
|
||||
expand('file{2..0}.jpg')
|
||||
// => ['file2.jpg', 'file1.jpg', 'file0.jpg']
|
||||
|
||||
expand('file{0..4..2}.jpg')
|
||||
// => ['file0.jpg', 'file2.jpg', 'file4.jpg']
|
||||
|
||||
expand('file-{a..e..2}.jpg')
|
||||
// => ['file-a.jpg', 'file-c.jpg', 'file-e.jpg']
|
||||
|
||||
expand('file{00..10..5}.jpg')
|
||||
// => ['file00.jpg', 'file05.jpg', 'file10.jpg']
|
||||
|
||||
expand('{{A..C},{a..c}}')
|
||||
// => ['A', 'B', 'C', 'a', 'b', 'c']
|
||||
|
||||
expand('ppp{,config,oe{,conf}}')
|
||||
// => ['ppp', 'pppconfig', 'pppoe', 'pppoeconf']
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
```js
|
||||
var expand = require('brace-expansion');
|
||||
```
|
||||
|
||||
### var expanded = expand(str)
|
||||
|
||||
Return an array of all possible and valid expansions of `str`. If none are
|
||||
found, `[str]` is returned.
|
||||
|
||||
Valid expansions are:
|
||||
|
||||
```js
|
||||
/^(.*,)+(.+)?$/
|
||||
// {a,b,...}
|
||||
```
|
||||
|
||||
A comma seperated list of options, like `{a,b}` or `{a,{b,c}}` or `{,a,}`.
|
||||
|
||||
```js
|
||||
/^-?\d+\.\.-?\d+(\.\.-?\d+)?$/
|
||||
// {x..y[..incr]}
|
||||
```
|
||||
|
||||
A numeric sequence from `x` to `y` inclusive, with optional increment.
|
||||
If `x` or `y` start with a leading `0`, all the numbers will be padded
|
||||
to have equal length. Negative numbers and backwards iteration work too.
|
||||
|
||||
```js
|
||||
/^-?\d+\.\.-?\d+(\.\.-?\d+)?$/
|
||||
// {x..y[..incr]}
|
||||
```
|
||||
|
||||
An alphabetic sequence from `x` to `y` inclusive, with optional increment.
|
||||
`x` and `y` must be exactly one character, and if given, `incr` must be a
|
||||
number.
|
||||
|
||||
For compatibility reasons, the string `${` is not eligible for brace expansion.
|
||||
|
||||
## Installation
|
||||
|
||||
With [npm](https://npmjs.org) do:
|
||||
|
||||
```bash
|
||||
npm install brace-expansion
|
||||
```
|
||||
|
||||
## Contributors
|
||||
|
||||
- [Julian Gruber](https://github.com/juliangruber)
|
||||
- [Isaac Z. Schlueter](https://github.com/isaacs)
|
||||
|
||||
## License
|
||||
|
||||
(MIT)
|
||||
|
||||
Copyright (c) 2013 Julian Gruber <julian@juliangruber.com>
|
||||
|
||||
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.
|
191
samples/client/petstore-security-test/javascript/node_modules/brace-expansion/index.js
generated
vendored
191
samples/client/petstore-security-test/javascript/node_modules/brace-expansion/index.js
generated
vendored
@ -1,191 +0,0 @@
|
||||
var concatMap = require('concat-map');
|
||||
var balanced = require('balanced-match');
|
||||
|
||||
module.exports = expandTop;
|
||||
|
||||
var escSlash = '\0SLASH'+Math.random()+'\0';
|
||||
var escOpen = '\0OPEN'+Math.random()+'\0';
|
||||
var escClose = '\0CLOSE'+Math.random()+'\0';
|
||||
var escComma = '\0COMMA'+Math.random()+'\0';
|
||||
var escPeriod = '\0PERIOD'+Math.random()+'\0';
|
||||
|
||||
function numeric(str) {
|
||||
return parseInt(str, 10) == str
|
||||
? parseInt(str, 10)
|
||||
: str.charCodeAt(0);
|
||||
}
|
||||
|
||||
function escapeBraces(str) {
|
||||
return str.split('\\\\').join(escSlash)
|
||||
.split('\\{').join(escOpen)
|
||||
.split('\\}').join(escClose)
|
||||
.split('\\,').join(escComma)
|
||||
.split('\\.').join(escPeriod);
|
||||
}
|
||||
|
||||
function unescapeBraces(str) {
|
||||
return str.split(escSlash).join('\\')
|
||||
.split(escOpen).join('{')
|
||||
.split(escClose).join('}')
|
||||
.split(escComma).join(',')
|
||||
.split(escPeriod).join('.');
|
||||
}
|
||||
|
||||
|
||||
// Basically just str.split(","), but handling cases
|
||||
// where we have nested braced sections, which should be
|
||||
// treated as individual members, like {a,{b,c},d}
|
||||
function parseCommaParts(str) {
|
||||
if (!str)
|
||||
return [''];
|
||||
|
||||
var parts = [];
|
||||
var m = balanced('{', '}', str);
|
||||
|
||||
if (!m)
|
||||
return str.split(',');
|
||||
|
||||
var pre = m.pre;
|
||||
var body = m.body;
|
||||
var post = m.post;
|
||||
var p = pre.split(',');
|
||||
|
||||
p[p.length-1] += '{' + body + '}';
|
||||
var postParts = parseCommaParts(post);
|
||||
if (post.length) {
|
||||
p[p.length-1] += postParts.shift();
|
||||
p.push.apply(p, postParts);
|
||||
}
|
||||
|
||||
parts.push.apply(parts, p);
|
||||
|
||||
return parts;
|
||||
}
|
||||
|
||||
function expandTop(str) {
|
||||
if (!str)
|
||||
return [];
|
||||
|
||||
return expand(escapeBraces(str), true).map(unescapeBraces);
|
||||
}
|
||||
|
||||
function identity(e) {
|
||||
return e;
|
||||
}
|
||||
|
||||
function embrace(str) {
|
||||
return '{' + str + '}';
|
||||
}
|
||||
function isPadded(el) {
|
||||
return /^-?0\d/.test(el);
|
||||
}
|
||||
|
||||
function lte(i, y) {
|
||||
return i <= y;
|
||||
}
|
||||
function gte(i, y) {
|
||||
return i >= y;
|
||||
}
|
||||
|
||||
function expand(str, isTop) {
|
||||
var expansions = [];
|
||||
|
||||
var m = balanced('{', '}', str);
|
||||
if (!m || /\$$/.test(m.pre)) return [str];
|
||||
|
||||
var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body);
|
||||
var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body);
|
||||
var isSequence = isNumericSequence || isAlphaSequence;
|
||||
var isOptions = /^(.*,)+(.+)?$/.test(m.body);
|
||||
if (!isSequence && !isOptions) {
|
||||
// {a},b}
|
||||
if (m.post.match(/,.*\}/)) {
|
||||
str = m.pre + '{' + m.body + escClose + m.post;
|
||||
return expand(str);
|
||||
}
|
||||
return [str];
|
||||
}
|
||||
|
||||
var n;
|
||||
if (isSequence) {
|
||||
n = m.body.split(/\.\./);
|
||||
} else {
|
||||
n = parseCommaParts(m.body);
|
||||
if (n.length === 1) {
|
||||
// x{{a,b}}y ==> x{a}y x{b}y
|
||||
n = expand(n[0], false).map(embrace);
|
||||
if (n.length === 1) {
|
||||
var post = m.post.length
|
||||
? expand(m.post, false)
|
||||
: [''];
|
||||
return post.map(function(p) {
|
||||
return m.pre + n[0] + p;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// at this point, n is the parts, and we know it's not a comma set
|
||||
// with a single entry.
|
||||
|
||||
// no need to expand pre, since it is guaranteed to be free of brace-sets
|
||||
var pre = m.pre;
|
||||
var post = m.post.length
|
||||
? expand(m.post, false)
|
||||
: [''];
|
||||
|
||||
var N;
|
||||
|
||||
if (isSequence) {
|
||||
var x = numeric(n[0]);
|
||||
var y = numeric(n[1]);
|
||||
var width = Math.max(n[0].length, n[1].length)
|
||||
var incr = n.length == 3
|
||||
? Math.abs(numeric(n[2]))
|
||||
: 1;
|
||||
var test = lte;
|
||||
var reverse = y < x;
|
||||
if (reverse) {
|
||||
incr *= -1;
|
||||
test = gte;
|
||||
}
|
||||
var pad = n.some(isPadded);
|
||||
|
||||
N = [];
|
||||
|
||||
for (var i = x; test(i, y); i += incr) {
|
||||
var c;
|
||||
if (isAlphaSequence) {
|
||||
c = String.fromCharCode(i);
|
||||
if (c === '\\')
|
||||
c = '';
|
||||
} else {
|
||||
c = String(i);
|
||||
if (pad) {
|
||||
var need = width - c.length;
|
||||
if (need > 0) {
|
||||
var z = new Array(need + 1).join('0');
|
||||
if (i < 0)
|
||||
c = '-' + z + c.slice(1);
|
||||
else
|
||||
c = z + c;
|
||||
}
|
||||
}
|
||||
}
|
||||
N.push(c);
|
||||
}
|
||||
} else {
|
||||
N = concatMap(n, function(el) { return expand(el, false) });
|
||||
}
|
||||
|
||||
for (var j = 0; j < N.length; j++) {
|
||||
for (var k = 0; k < post.length; k++) {
|
||||
var expansion = pre + N[j] + post[k];
|
||||
if (!isTop || isSequence || expansion)
|
||||
expansions.push(expansion);
|
||||
}
|
||||
}
|
||||
|
||||
return expansions;
|
||||
}
|
||||
|
103
samples/client/petstore-security-test/javascript/node_modules/brace-expansion/package.json
generated
vendored
103
samples/client/petstore-security-test/javascript/node_modules/brace-expansion/package.json
generated
vendored
@ -1,103 +0,0 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"brace-expansion@^1.0.0",
|
||||
"/Users/williamcheng/Code/may2016/swagger-codegen/samples/client/petstore-security-test/javascript/node_modules/jshint/node_modules/minimatch"
|
||||
]
|
||||
],
|
||||
"_from": "brace-expansion@>=1.0.0 <2.0.0",
|
||||
"_id": "brace-expansion@1.1.5",
|
||||
"_inCache": true,
|
||||
"_installable": true,
|
||||
"_location": "/brace-expansion",
|
||||
"_nodeVersion": "4.4.5",
|
||||
"_npmOperationalInternal": {
|
||||
"host": "packages-16-east.internal.npmjs.com",
|
||||
"tmp": "tmp/brace-expansion-1.1.5.tgz_1465989660138_0.34528115345165133"
|
||||
},
|
||||
"_npmUser": {
|
||||
"email": "julian@juliangruber.com",
|
||||
"name": "juliangruber"
|
||||
},
|
||||
"_npmVersion": "2.15.5",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"name": "brace-expansion",
|
||||
"raw": "brace-expansion@^1.0.0",
|
||||
"rawSpec": "^1.0.0",
|
||||
"scope": null,
|
||||
"spec": ">=1.0.0 <2.0.0",
|
||||
"type": "range"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/jshint/minimatch"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.5.tgz",
|
||||
"_shasum": "f5b4ad574e2cb7ccc1eb83e6fe79b8ecadf7a526",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "brace-expansion@^1.0.0",
|
||||
"_where": "/Users/williamcheng/Code/may2016/swagger-codegen/samples/client/petstore-security-test/javascript/node_modules/jshint/node_modules/minimatch",
|
||||
"author": {
|
||||
"email": "mail@juliangruber.com",
|
||||
"name": "Julian Gruber",
|
||||
"url": "http://juliangruber.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/juliangruber/brace-expansion/issues"
|
||||
},
|
||||
"dependencies": {
|
||||
"balanced-match": "^0.4.1",
|
||||
"concat-map": "0.0.1"
|
||||
},
|
||||
"description": "Brace expansion as known from sh/bash",
|
||||
"devDependencies": {
|
||||
"tape": "4.5.1"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "f5b4ad574e2cb7ccc1eb83e6fe79b8ecadf7a526",
|
||||
"tarball": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.5.tgz"
|
||||
},
|
||||
"gitHead": "ff31acab078f1bb696ac4c55ca56ea24e6495fb6",
|
||||
"homepage": "https://github.com/juliangruber/brace-expansion",
|
||||
"keywords": [],
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "juliangruber",
|
||||
"email": "julian@juliangruber.com"
|
||||
},
|
||||
{
|
||||
"name": "isaacs",
|
||||
"email": "isaacs@npmjs.com"
|
||||
}
|
||||
],
|
||||
"name": "brace-expansion",
|
||||
"optionalDependencies": {},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/juliangruber/brace-expansion.git"
|
||||
},
|
||||
"scripts": {
|
||||
"gentest": "bash test/generate.sh",
|
||||
"test": "tape test/*.js"
|
||||
},
|
||||
"testling": {
|
||||
"browsers": [
|
||||
"android-browser/4.2..latest",
|
||||
"chrome/25..latest",
|
||||
"chrome/canary",
|
||||
"firefox/20..latest",
|
||||
"firefox/nightly",
|
||||
"ie/8..latest",
|
||||
"ipad/6.0..latest",
|
||||
"iphone/6.0..latest",
|
||||
"opera/12..latest",
|
||||
"opera/next",
|
||||
"safari/5.1..latest"
|
||||
],
|
||||
"files": "test/*.js"
|
||||
},
|
||||
"version": "1.1.5"
|
||||
}
|
196
samples/client/petstore-security-test/javascript/node_modules/cli/README.md
generated
vendored
196
samples/client/petstore-security-test/javascript/node_modules/cli/README.md
generated
vendored
@ -1,196 +0,0 @@
|
||||
**cli is a toolkit for rapidly building command line apps - it includes:**
|
||||
|
||||
- Full featured opts/args parser
|
||||
- Plugin support for adding common options and switches
|
||||
- Helper methods for working with input/output and spawning child processes
|
||||
- Output colored/styled messages, [progress bars](https://github.com/chriso/cli/blob/master/examples/progress.js) or [spinners](https://github.com/chriso/cli/blob/master/examples/spinner.js)
|
||||
- Command [auto-completion](https://github.com/chriso/cli/blob/master/examples/command.js) and [glob support](https://github.com/chriso/cli/blob/master/examples/glob.js)
|
||||
|
||||
Install using `npm install cli` or just bundle [cli.js](https://github.com/chriso/cli/raw/master/cli.js) with your app.
|
||||
|
||||
## Example apps
|
||||
|
||||
### sort.js
|
||||
|
||||
```javascript
|
||||
#!/usr/bin/env node
|
||||
require('cli').withStdinLines(function(lines, newline) {
|
||||
this.output(lines.sort().join(newline));
|
||||
});
|
||||
```
|
||||
|
||||
Try it out
|
||||
|
||||
```bash
|
||||
$ ./sort.js < input.txt
|
||||
```
|
||||
|
||||
Let's add support for an `-n` switch to use a numeric sort, and a `-r` switch to reverse output - only 5 extra lines of code (!)
|
||||
|
||||
```javascript
|
||||
var cli = require('cli'), options = cli.parse();
|
||||
|
||||
cli.withStdinLines(function(lines, newline) {
|
||||
lines.sort(!options.n ? null : function(a, b) {
|
||||
return parseInt(a) > parseInt(b);
|
||||
});
|
||||
if (options.r) lines.reverse();
|
||||
this.output(lines.join(newline));
|
||||
});
|
||||
```
|
||||
|
||||
### static.js
|
||||
|
||||
Let's create a static file server with daemon support to see the opts parser + plugins in use - note: this requires `npm install creationix daemon`
|
||||
|
||||
```javascript
|
||||
var cli = require('cli').enable('daemon', 'status'); //Enable 2 plugins
|
||||
|
||||
cli.parse({
|
||||
log: ['l', 'Enable logging'],
|
||||
port: ['p', 'Listen on this port', 'number', 8080],
|
||||
serve: [false, 'Serve static files from PATH', 'path', './public']
|
||||
});
|
||||
|
||||
cli.main(function(args, options) {
|
||||
var server, middleware = [];
|
||||
|
||||
if (options.log) {
|
||||
this.debug('Enabling logging');
|
||||
middleware.push(require('creationix/log')());
|
||||
}
|
||||
|
||||
this.debug('Serving files from ' + options.serve);
|
||||
middleware.push(require('creationix/static')('/', options.serve, 'index.html'));
|
||||
|
||||
server = this.createServer(middleware).listen(options.port);
|
||||
|
||||
this.ok('Listening on port ' + options.port);
|
||||
});
|
||||
```
|
||||
|
||||
To output usage information
|
||||
|
||||
```bash
|
||||
$ ./static.js --help
|
||||
```
|
||||
|
||||
To create a daemon that serves files from */tmp*, run
|
||||
|
||||
```bash
|
||||
$ ./static.js -ld --serve=/tmp
|
||||
```
|
||||
|
||||
For more examples, see [./examples](https://github.com/chriso/cli/tree/master/examples)
|
||||
|
||||
## Helper methods
|
||||
|
||||
cli has methods that collect stdin (newline is autodetected as \n or \r\n)
|
||||
|
||||
```javascript
|
||||
cli.withStdin(callback); //callback receives stdin as a string
|
||||
cli.withStdinLines(callback); //callback receives stdin split into an array of lines (lines, newline)
|
||||
```
|
||||
|
||||
cli also has a lower level method for working with input line by line (see [./examples/cat.js](https://github.com/chriso/cli/blob/master/examples/cat.js) for an example).
|
||||
|
||||
```javascript
|
||||
cli.withInput(file, function (line, newline, eof) {
|
||||
if (!eof) {
|
||||
this.output(line + newline);
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
*Note: `file` can be omitted if you want to work with stdin*
|
||||
|
||||
To output a progress bar, call
|
||||
|
||||
```javascript
|
||||
cli.progress(progress); //Where 0 <= progress <= 1
|
||||
```
|
||||
|
||||
To spawn a child process, use
|
||||
|
||||
```javascript
|
||||
cli.exec(cmd, callback); //callback receives the output of the process (split into lines)
|
||||
```
|
||||
|
||||
cli also comes bundled with kof's [node-natives](https://github.com/kof/node-natives) (access with cli.native) and creationix' [stack](https://github.com/creationix/stack) (access with cli.createServer)
|
||||
|
||||
## Plugins
|
||||
|
||||
Plugins are a way of adding common opts and can be enabled using
|
||||
|
||||
```javascript
|
||||
cli.enable(plugin1, [plugin2, ...]); //To disable, use the equivalent disable() method
|
||||
```
|
||||
|
||||
**help** - *enabled by default*
|
||||
|
||||
Adds `-h,--help` to output auto-generated usage information
|
||||
|
||||
**version**
|
||||
|
||||
Adds `-v,--version` to output version information for the app. cli will attempt to locate and parse a nearby *package.json*
|
||||
|
||||
To set your own app name and version, use `cli.setApp(app_name, version)`
|
||||
|
||||
**status**
|
||||
|
||||
Adds options to show/hide the stylized status messages that are output to the console when using one of these methods
|
||||
|
||||
```javascript
|
||||
cli.debug(msg); //Only shown when using --debug
|
||||
cli.error(msg);
|
||||
cli.fatal(msg); //Exits the process after outputting msg
|
||||
cli.info(msg);
|
||||
cli.ok(msg);
|
||||
```
|
||||
|
||||
`-k,--no-color` will omit ANSI color escapes from the output
|
||||
|
||||
**glob** - *requires* `npm install glob`
|
||||
|
||||
Enables glob matching of arguments
|
||||
|
||||
**daemon** - *requires* `npm install daemon`
|
||||
|
||||
Adds `-d,--daemon ARG` for daemonizing the process and controlling the resulting daemon
|
||||
|
||||
`ARG` can be either start (default), stop, restart, pid (outputs the daemon's pid if it's running), or log (output the daemon's stdout+stderr)
|
||||
|
||||
**timeout**
|
||||
|
||||
Adds `-t,--timeout N` to exit the process after N seconds with an error
|
||||
|
||||
**catchall**
|
||||
|
||||
Adds `-c,--catch` to catch and output uncaughtExceptions and resume execution
|
||||
|
||||
*Note: Plugins are automatically disabled if an option or switch of the same name is already defined*
|
||||
|
||||
## LICENSE
|
||||
|
||||
(MIT license)
|
||||
|
||||
Copyright (c) 2010 Chris O'Hara <cohara87@gmail.com>
|
||||
|
||||
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.
|
1152
samples/client/petstore-security-test/javascript/node_modules/cli/cli.js
generated
vendored
1152
samples/client/petstore-security-test/javascript/node_modules/cli/cli.js
generated
vendored
File diff suppressed because it is too large
Load Diff
17
samples/client/petstore-security-test/javascript/node_modules/cli/examples/cat.js
generated
vendored
17
samples/client/petstore-security-test/javascript/node_modules/cli/examples/cat.js
generated
vendored
@ -1,17 +0,0 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
var cli = require('cli');
|
||||
|
||||
var output_file = function (file) {
|
||||
cli.withInput(file, function (line, sep, eof) {
|
||||
if (!eof) {
|
||||
cli.output(line + sep);
|
||||
} else if (cli.args.length) {
|
||||
output_file(cli.args.shift());
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
if (cli.args.length) {
|
||||
output_file(cli.args.shift());
|
||||
}
|
16
samples/client/petstore-security-test/javascript/node_modules/cli/examples/command.js
generated
vendored
16
samples/client/petstore-security-test/javascript/node_modules/cli/examples/command.js
generated
vendored
@ -1,16 +0,0 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
var cli = require('cli');
|
||||
|
||||
//The second (optional) argument of cli.parse() is a command list
|
||||
//Type `./command.js --help` for usage info
|
||||
|
||||
//cli enables auto-completion of commands (similiar to npm), e.g. all of
|
||||
//the following are equivalent and result in "Command is: install":
|
||||
// $ ./command.js install
|
||||
// $ ./command.js inst
|
||||
// $ ./command.js i
|
||||
|
||||
cli.parse(null, ['install', 'test', 'edit', 'remove', 'uninstall', 'ls']);
|
||||
|
||||
console.log('Command is: ' + cli.command);
|
54
samples/client/petstore-security-test/javascript/node_modules/cli/examples/echo.js
generated
vendored
54
samples/client/petstore-security-test/javascript/node_modules/cli/examples/echo.js
generated
vendored
@ -1,54 +0,0 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
/* All of the following commands are equivalent and write `foo\tbar foo` to out.txt
|
||||
$ ./echo.js -n -e --output=out.txt "foo\tbar" "foo"
|
||||
$ ./echo.js --newline --escape --output "out.txt" "foo\tbar" "foo"
|
||||
$ ./echo.js -ne --output=out.txt "foo\tbar" "foo"
|
||||
$ ./echo.js -en --output="out.txt" "foo\tbar" "foo"
|
||||
*/
|
||||
|
||||
var cli = require('cli');
|
||||
|
||||
cli.parse({
|
||||
newline: ['n', 'Do not output the trailing newline'],
|
||||
escape: ['e', 'Enable interpretation of backslash escapes'],
|
||||
separator: ['s', 'Separate arguments using this value', 'string', ' '],
|
||||
output: [false, 'Write to FILE rather than the console', 'file']
|
||||
});
|
||||
|
||||
cli.main(function (args, options) {
|
||||
var output = '', i, j, l, output_stream;
|
||||
|
||||
if (this.argc) {
|
||||
if (options.escape) {
|
||||
var replace = {'\\n':'\n','\\r':'\r','\\t':'\t','\\e':'\e','\\v':'\v','\\f':'\f','\\c':'\c','\\b':'\b','\\a':'\a','\\\\':'\\'};
|
||||
var escape = function (str) {
|
||||
str += '';
|
||||
for (j in replace) {
|
||||
str = str.replace(i, replace[i]);
|
||||
}
|
||||
return str;
|
||||
}
|
||||
for (i = 0, l = this.argc; i < l; i++) {
|
||||
args[i] = escape(args[i]);
|
||||
}
|
||||
options.separator = escape(options.separator);
|
||||
}
|
||||
output += args.join(options.separator);
|
||||
}
|
||||
|
||||
if (!options.newline) {
|
||||
output += '\n';
|
||||
}
|
||||
|
||||
try {
|
||||
if (options.output) {
|
||||
output_stream = this.native.fs.createWriteStream(options.output)
|
||||
} else {
|
||||
output_stream = process.stdout;
|
||||
}
|
||||
output_stream.write(output);
|
||||
} catch (e) {
|
||||
this.fatal('Could not write to output stream');
|
||||
}
|
||||
});
|
6
samples/client/petstore-security-test/javascript/node_modules/cli/examples/glob.js
generated
vendored
6
samples/client/petstore-security-test/javascript/node_modules/cli/examples/glob.js
generated
vendored
@ -1,6 +0,0 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
var cli = require('cli').enable('glob');
|
||||
|
||||
//Running `./glob.js *.js` will output a list of .js files in this directory
|
||||
console.log(cli.args);
|
20
samples/client/petstore-security-test/javascript/node_modules/cli/examples/long_desc.js
generated
vendored
20
samples/client/petstore-security-test/javascript/node_modules/cli/examples/long_desc.js
generated
vendored
@ -1,20 +0,0 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
var cli = require('../');
|
||||
|
||||
//You can (optionally) boost the width of output with:
|
||||
//cli.width = 120;
|
||||
|
||||
//You can also adjust the width of the options/command definitions
|
||||
//cli.option_width = 25;
|
||||
|
||||
var long_desc = 'Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry\'s '
|
||||
+ 'standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make'
|
||||
+ ' a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, '
|
||||
+ 'remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing '
|
||||
+ 'Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions'
|
||||
+ ' of Lorem Ipsum.';
|
||||
|
||||
cli.parse({
|
||||
foo: ['f', long_desc]
|
||||
});
|
11
samples/client/petstore-security-test/javascript/node_modules/cli/examples/progress.js
generated
vendored
11
samples/client/petstore-security-test/javascript/node_modules/cli/examples/progress.js
generated
vendored
@ -1,11 +0,0 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
var cli = require('cli');
|
||||
|
||||
var i = 0, interval = setInterval(function () {
|
||||
cli.progress(++i / 100);
|
||||
if (i === 100) {
|
||||
clearInterval(interval);
|
||||
cli.ok('Finished!');
|
||||
}
|
||||
}, 50);
|
18
samples/client/petstore-security-test/javascript/node_modules/cli/examples/sort.js
generated
vendored
18
samples/client/petstore-security-test/javascript/node_modules/cli/examples/sort.js
generated
vendored
@ -1,18 +0,0 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
var cli = require('cli');
|
||||
|
||||
var options = cli.parse({
|
||||
numeric: ['n', 'Compare using a numeric sort'],
|
||||
reverse: ['r', 'Reverse the results']
|
||||
});
|
||||
|
||||
cli.withStdinLines(function (lines, newline) {
|
||||
lines.sort(!options.numeric ? null : function (a, b) {
|
||||
return parseInt(a) > parseInt(b);
|
||||
});
|
||||
if (options.reverse) {
|
||||
lines.reverse();
|
||||
}
|
||||
this.output(lines.join(newline));
|
||||
});
|
@ -1,9 +0,0 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
var cli = require('cli');
|
||||
|
||||
cli.spinner('Working..');
|
||||
|
||||
setTimeout(function () {
|
||||
cli.spinner('Working.. done!', true); //End the spinner
|
||||
}, 3000);
|
27
samples/client/petstore-security-test/javascript/node_modules/cli/examples/static.coffee
generated
vendored
27
samples/client/petstore-security-test/javascript/node_modules/cli/examples/static.coffee
generated
vendored
@ -1,27 +0,0 @@
|
||||
#!/usr/bin/env coffee
|
||||
|
||||
cli = require 'cli'
|
||||
|
||||
cli.enable('daemon','status')
|
||||
.setUsage('static.coffee [OPTIONS]')
|
||||
|
||||
cli.parse {
|
||||
log: ['l', 'Enable logging']
|
||||
port: ['p', 'Listen on this port', 'number', 8080]
|
||||
serve: [false, 'Serve static files from PATH', 'path', './public']
|
||||
}
|
||||
|
||||
middleware = []
|
||||
|
||||
cli.main (args, options) ->
|
||||
|
||||
if options.log
|
||||
@debug 'Enabling logging'
|
||||
middleware.push require('creationix/log')()
|
||||
|
||||
@debug 'Serving files from ' + options.serve
|
||||
middleware.push require('creationix/static')('/', options.serve, 'index.html')
|
||||
|
||||
server = @createServer(middleware).listen options.port
|
||||
|
||||
@ok 'Listening on port ' + options.port
|
25
samples/client/petstore-security-test/javascript/node_modules/cli/examples/static.js
generated
vendored
25
samples/client/petstore-security-test/javascript/node_modules/cli/examples/static.js
generated
vendored
@ -1,25 +0,0 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
var cli = require('cli').enable('status', 'daemon');
|
||||
|
||||
cli.parse({
|
||||
log: ['l', 'Enable logging'],
|
||||
port: ['p', 'Listen on this port', 'number', 8080],
|
||||
serve: [false, 'Serve static files from PATH', 'path', './public']
|
||||
});
|
||||
|
||||
cli.main(function (args, options) {
|
||||
var server, middleware = [];
|
||||
|
||||
if (options.log) {
|
||||
this.debug('Enabling logging');
|
||||
middleware.push(require('creationix/log')());
|
||||
}
|
||||
|
||||
this.debug('Serving files from ' + options.serve);
|
||||
middleware.push(require('creationix/static')('/', options.serve, 'index.html'));
|
||||
|
||||
server = this.createServer(middleware).listen(options.port);
|
||||
|
||||
this.ok('Listening on port ' + options.port);
|
||||
});
|
1
samples/client/petstore-security-test/javascript/node_modules/cli/index.js
generated
vendored
1
samples/client/petstore-security-test/javascript/node_modules/cli/index.js
generated
vendored
@ -1 +0,0 @@
|
||||
module.exports = require('./cli');
|
99
samples/client/petstore-security-test/javascript/node_modules/cli/package.json
generated
vendored
99
samples/client/petstore-security-test/javascript/node_modules/cli/package.json
generated
vendored
@ -1,99 +0,0 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"cli@0.6.x",
|
||||
"/Users/williamcheng/Code/may2016/swagger-codegen/samples/client/petstore-security-test/javascript/node_modules/jshint"
|
||||
]
|
||||
],
|
||||
"_from": "cli@>=0.6.0 <0.7.0",
|
||||
"_id": "cli@0.6.6",
|
||||
"_inCache": true,
|
||||
"_installable": true,
|
||||
"_location": "/cli",
|
||||
"_nodeVersion": "0.12.1",
|
||||
"_npmUser": {
|
||||
"email": "cohara87@gmail.com",
|
||||
"name": "cohara87"
|
||||
},
|
||||
"_npmVersion": "2.7.3",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"name": "cli",
|
||||
"raw": "cli@0.6.x",
|
||||
"rawSpec": "0.6.x",
|
||||
"scope": null,
|
||||
"spec": ">=0.6.0 <0.7.0",
|
||||
"type": "range"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/jshint"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/cli/-/cli-0.6.6.tgz",
|
||||
"_shasum": "02ad44a380abf27adac5e6f0cdd7b043d74c53e3",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "cli@0.6.x",
|
||||
"_where": "/Users/williamcheng/Code/may2016/swagger-codegen/samples/client/petstore-security-test/javascript/node_modules/jshint",
|
||||
"author": {
|
||||
"email": "cohara87@gmail.com",
|
||||
"name": "Chris O'Hara"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "http://github.com/chriso/cli/issues"
|
||||
},
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Douglas Meyer"
|
||||
}
|
||||
],
|
||||
"dependencies": {
|
||||
"exit": "0.1.2",
|
||||
"glob": "~ 3.2.1"
|
||||
},
|
||||
"description": "A tool for rapidly building command line apps",
|
||||
"devDependencies": {},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "02ad44a380abf27adac5e6f0cdd7b043d74c53e3",
|
||||
"tarball": "https://registry.npmjs.org/cli/-/cli-0.6.6.tgz"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.2.5"
|
||||
},
|
||||
"gitHead": "088e01c2df81b0850ae4ae2daa7827fb6dcf0502",
|
||||
"homepage": "http://github.com/chriso/cli",
|
||||
"keywords": [
|
||||
"args",
|
||||
"argsparse",
|
||||
"autocomplete",
|
||||
"autocompletion",
|
||||
"cli",
|
||||
"command",
|
||||
"command line",
|
||||
"console",
|
||||
"daemon",
|
||||
"opt",
|
||||
"optparse",
|
||||
"opts",
|
||||
"parseopt"
|
||||
],
|
||||
"licenses": [
|
||||
{
|
||||
"type": "MIT"
|
||||
}
|
||||
],
|
||||
"main": "cli.js",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "cohara87",
|
||||
"email": "cohara87@gmail.com"
|
||||
}
|
||||
],
|
||||
"name": "cli",
|
||||
"optionalDependencies": {},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "http://github.com/chriso/cli.git"
|
||||
},
|
||||
"scripts": {},
|
||||
"version": "0.6.6"
|
||||
}
|
11
samples/client/petstore-security-test/javascript/node_modules/cli/progress.js
generated
vendored
11
samples/client/petstore-security-test/javascript/node_modules/cli/progress.js
generated
vendored
@ -1,11 +0,0 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
var cli = require('./');
|
||||
|
||||
var i = 0, interval = setInterval(function () {
|
||||
cli.progress(++i / 100);
|
||||
if (i === 100) {
|
||||
clearInterval(interval);
|
||||
cli.ok('Finished!');
|
||||
}
|
||||
}, 50);
|
9
samples/client/petstore-security-test/javascript/node_modules/cli/spinner.js
generated
vendored
9
samples/client/petstore-security-test/javascript/node_modules/cli/spinner.js
generated
vendored
@ -1,9 +0,0 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
var cli = require('./');
|
||||
|
||||
cli.spinner('Working..');
|
||||
|
||||
setTimeout(function () {
|
||||
cli.spinner('Working.. done!', true); //End the spinner
|
||||
}, 3000);
|
19
samples/client/petstore-security-test/javascript/node_modules/combined-stream/License
generated
vendored
19
samples/client/petstore-security-test/javascript/node_modules/combined-stream/License
generated
vendored
@ -1,19 +0,0 @@
|
||||
Copyright (c) 2011 Debuggable Limited <felix@debuggable.com>
|
||||
|
||||
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.
|
132
samples/client/petstore-security-test/javascript/node_modules/combined-stream/Readme.md
generated
vendored
132
samples/client/petstore-security-test/javascript/node_modules/combined-stream/Readme.md
generated
vendored
@ -1,132 +0,0 @@
|
||||
# combined-stream [![Build Status](https://travis-ci.org/felixge/node-combined-stream.svg?branch=master)](https://travis-ci.org/felixge/node-combined-stream)
|
||||
|
||||
A stream that emits multiple other streams one after another.
|
||||
|
||||
## Installation
|
||||
|
||||
``` bash
|
||||
npm install combined-stream
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
Here is a simple example that shows how you can use combined-stream to combine
|
||||
two files into one:
|
||||
|
||||
``` javascript
|
||||
var CombinedStream = require('combined-stream');
|
||||
var fs = require('fs');
|
||||
|
||||
var combinedStream = CombinedStream.create();
|
||||
combinedStream.append(fs.createReadStream('file1.txt'));
|
||||
combinedStream.append(fs.createReadStream('file2.txt'));
|
||||
|
||||
combinedStream.pipe(fs.createWriteStream('combined.txt'));
|
||||
```
|
||||
|
||||
While the example above works great, it will pause all source streams until
|
||||
they are needed. If you don't want that to happen, you can set `pauseStreams`
|
||||
to `false`:
|
||||
|
||||
``` javascript
|
||||
var CombinedStream = require('combined-stream');
|
||||
var fs = require('fs');
|
||||
|
||||
var combinedStream = CombinedStream.create({pauseStreams: false});
|
||||
combinedStream.append(fs.createReadStream('file1.txt'));
|
||||
combinedStream.append(fs.createReadStream('file2.txt'));
|
||||
|
||||
combinedStream.pipe(fs.createWriteStream('combined.txt'));
|
||||
```
|
||||
|
||||
However, what if you don't have all the source streams yet, or you don't want
|
||||
to allocate the resources (file descriptors, memory, etc.) for them right away?
|
||||
Well, in that case you can simply provide a callback that supplies the stream
|
||||
by calling a `next()` function:
|
||||
|
||||
``` javascript
|
||||
var CombinedStream = require('combined-stream');
|
||||
var fs = require('fs');
|
||||
|
||||
var combinedStream = CombinedStream.create();
|
||||
combinedStream.append(function(next) {
|
||||
next(fs.createReadStream('file1.txt'));
|
||||
});
|
||||
combinedStream.append(function(next) {
|
||||
next(fs.createReadStream('file2.txt'));
|
||||
});
|
||||
|
||||
combinedStream.pipe(fs.createWriteStream('combined.txt'));
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### CombinedStream.create([options])
|
||||
|
||||
Returns a new combined stream object. Available options are:
|
||||
|
||||
* `maxDataSize`
|
||||
* `pauseStreams`
|
||||
|
||||
The effect of those options is described below.
|
||||
|
||||
### combinedStream.pauseStreams = `true`
|
||||
|
||||
Whether to apply back pressure to the underlaying streams. If set to `false`,
|
||||
the underlaying streams will never be paused. If set to `true`, the
|
||||
underlaying streams will be paused right after being appended, as well as when
|
||||
`delayedStream.pipe()` wants to throttle.
|
||||
|
||||
### combinedStream.maxDataSize = `2 * 1024 * 1024`
|
||||
|
||||
The maximum amount of bytes (or characters) to buffer for all source streams.
|
||||
If this value is exceeded, `combinedStream` emits an `'error'` event.
|
||||
|
||||
### combinedStream.dataSize = `0`
|
||||
|
||||
The amount of bytes (or characters) currently buffered by `combinedStream`.
|
||||
|
||||
### combinedStream.append(stream)
|
||||
|
||||
Appends the given `stream` to the combinedStream object. If `pauseStreams` is
|
||||
set to `true, this stream will also be paused right away.
|
||||
|
||||
`streams` can also be a function that takes one parameter called `next`. `next`
|
||||
is a function that must be invoked in order to provide the `next` stream, see
|
||||
example above.
|
||||
|
||||
Regardless of how the `stream` is appended, combined-stream always attaches an
|
||||
`'error'` listener to it, so you don't have to do that manually.
|
||||
|
||||
Special case: `stream` can also be a String or Buffer.
|
||||
|
||||
### combinedStream.write(data)
|
||||
|
||||
You should not call this, `combinedStream` takes care of piping the appended
|
||||
streams into itself for you.
|
||||
|
||||
### combinedStream.resume()
|
||||
|
||||
Causes `combinedStream` to start drain the streams it manages. The function is
|
||||
idempotent, and also emits a `'resume'` event each time which usually goes to
|
||||
the stream that is currently being drained.
|
||||
|
||||
### combinedStream.pause();
|
||||
|
||||
If `combinedStream.pauseStreams` is set to `false`, this does nothing.
|
||||
Otherwise a `'pause'` event is emitted, this goes to the stream that is
|
||||
currently being drained, so you can use it to apply back pressure.
|
||||
|
||||
### combinedStream.end();
|
||||
|
||||
Sets `combinedStream.writable` to false, emits an `'end'` event, and removes
|
||||
all streams from the queue.
|
||||
|
||||
### combinedStream.destroy();
|
||||
|
||||
Same as `combinedStream.end()`, except it emits a `'close'` event instead of
|
||||
`'end'`.
|
||||
|
||||
## License
|
||||
|
||||
combined-stream is licensed under the MIT license.
|
@ -1,188 +0,0 @@
|
||||
var util = require('util');
|
||||
var Stream = require('stream').Stream;
|
||||
var DelayedStream = require('delayed-stream');
|
||||
|
||||
module.exports = CombinedStream;
|
||||
function CombinedStream() {
|
||||
this.writable = false;
|
||||
this.readable = true;
|
||||
this.dataSize = 0;
|
||||
this.maxDataSize = 2 * 1024 * 1024;
|
||||
this.pauseStreams = true;
|
||||
|
||||
this._released = false;
|
||||
this._streams = [];
|
||||
this._currentStream = null;
|
||||
}
|
||||
util.inherits(CombinedStream, Stream);
|
||||
|
||||
CombinedStream.create = function(options) {
|
||||
var combinedStream = new this();
|
||||
|
||||
options = options || {};
|
||||
for (var option in options) {
|
||||
combinedStream[option] = options[option];
|
||||
}
|
||||
|
||||
return combinedStream;
|
||||
};
|
||||
|
||||
CombinedStream.isStreamLike = function(stream) {
|
||||
return (typeof stream !== 'function')
|
||||
&& (typeof stream !== 'string')
|
||||
&& (typeof stream !== 'boolean')
|
||||
&& (typeof stream !== 'number')
|
||||
&& (!Buffer.isBuffer(stream));
|
||||
};
|
||||
|
||||
CombinedStream.prototype.append = function(stream) {
|
||||
var isStreamLike = CombinedStream.isStreamLike(stream);
|
||||
|
||||
if (isStreamLike) {
|
||||
if (!(stream instanceof DelayedStream)) {
|
||||
var newStream = DelayedStream.create(stream, {
|
||||
maxDataSize: Infinity,
|
||||
pauseStream: this.pauseStreams,
|
||||
});
|
||||
stream.on('data', this._checkDataSize.bind(this));
|
||||
stream = newStream;
|
||||
}
|
||||
|
||||
this._handleErrors(stream);
|
||||
|
||||
if (this.pauseStreams) {
|
||||
stream.pause();
|
||||
}
|
||||
}
|
||||
|
||||
this._streams.push(stream);
|
||||
return this;
|
||||
};
|
||||
|
||||
CombinedStream.prototype.pipe = function(dest, options) {
|
||||
Stream.prototype.pipe.call(this, dest, options);
|
||||
this.resume();
|
||||
return dest;
|
||||
};
|
||||
|
||||
CombinedStream.prototype._getNext = function() {
|
||||
this._currentStream = null;
|
||||
var stream = this._streams.shift();
|
||||
|
||||
|
||||
if (typeof stream == 'undefined') {
|
||||
this.end();
|
||||
return;
|
||||
}
|
||||
|
||||
if (typeof stream !== 'function') {
|
||||
this._pipeNext(stream);
|
||||
return;
|
||||
}
|
||||
|
||||
var getStream = stream;
|
||||
getStream(function(stream) {
|
||||
var isStreamLike = CombinedStream.isStreamLike(stream);
|
||||
if (isStreamLike) {
|
||||
stream.on('data', this._checkDataSize.bind(this));
|
||||
this._handleErrors(stream);
|
||||
}
|
||||
|
||||
this._pipeNext(stream);
|
||||
}.bind(this));
|
||||
};
|
||||
|
||||
CombinedStream.prototype._pipeNext = function(stream) {
|
||||
this._currentStream = stream;
|
||||
|
||||
var isStreamLike = CombinedStream.isStreamLike(stream);
|
||||
if (isStreamLike) {
|
||||
stream.on('end', this._getNext.bind(this));
|
||||
stream.pipe(this, {end: false});
|
||||
return;
|
||||
}
|
||||
|
||||
var value = stream;
|
||||
this.write(value);
|
||||
this._getNext();
|
||||
};
|
||||
|
||||
CombinedStream.prototype._handleErrors = function(stream) {
|
||||
var self = this;
|
||||
stream.on('error', function(err) {
|
||||
self._emitError(err);
|
||||
});
|
||||
};
|
||||
|
||||
CombinedStream.prototype.write = function(data) {
|
||||
this.emit('data', data);
|
||||
};
|
||||
|
||||
CombinedStream.prototype.pause = function() {
|
||||
if (!this.pauseStreams) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(this.pauseStreams && this._currentStream && typeof(this._currentStream.pause) == 'function') this._currentStream.pause();
|
||||
this.emit('pause');
|
||||
};
|
||||
|
||||
CombinedStream.prototype.resume = function() {
|
||||
if (!this._released) {
|
||||
this._released = true;
|
||||
this.writable = true;
|
||||
this._getNext();
|
||||
}
|
||||
|
||||
if(this.pauseStreams && this._currentStream && typeof(this._currentStream.resume) == 'function') this._currentStream.resume();
|
||||
this.emit('resume');
|
||||
};
|
||||
|
||||
CombinedStream.prototype.end = function() {
|
||||
this._reset();
|
||||
this.emit('end');
|
||||
};
|
||||
|
||||
CombinedStream.prototype.destroy = function() {
|
||||
this._reset();
|
||||
this.emit('close');
|
||||
};
|
||||
|
||||
CombinedStream.prototype._reset = function() {
|
||||
this.writable = false;
|
||||
this._streams = [];
|
||||
this._currentStream = null;
|
||||
};
|
||||
|
||||
CombinedStream.prototype._checkDataSize = function() {
|
||||
this._updateDataSize();
|
||||
if (this.dataSize <= this.maxDataSize) {
|
||||
return;
|
||||
}
|
||||
|
||||
var message =
|
||||
'DelayedStream#maxDataSize of ' + this.maxDataSize + ' bytes exceeded.';
|
||||
this._emitError(new Error(message));
|
||||
};
|
||||
|
||||
CombinedStream.prototype._updateDataSize = function() {
|
||||
this.dataSize = 0;
|
||||
|
||||
var self = this;
|
||||
this._streams.forEach(function(stream) {
|
||||
if (!stream.dataSize) {
|
||||
return;
|
||||
}
|
||||
|
||||
self.dataSize += stream.dataSize;
|
||||
});
|
||||
|
||||
if (this._currentStream && this._currentStream.dataSize) {
|
||||
this.dataSize += this._currentStream.dataSize;
|
||||
}
|
||||
};
|
||||
|
||||
CombinedStream.prototype._emitError = function(err) {
|
||||
this._reset();
|
||||
this.emit('error', err);
|
||||
};
|
@ -1,84 +0,0 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"combined-stream@~0.0.4",
|
||||
"/Users/williamcheng/Code/may2016/swagger-codegen/samples/client/petstore-security-test/javascript/node_modules/form-data"
|
||||
]
|
||||
],
|
||||
"_from": "combined-stream@>=0.0.4 <0.1.0",
|
||||
"_id": "combined-stream@0.0.7",
|
||||
"_inCache": true,
|
||||
"_installable": true,
|
||||
"_location": "/combined-stream",
|
||||
"_npmUser": {
|
||||
"email": "felix@debuggable.com",
|
||||
"name": "felixge"
|
||||
},
|
||||
"_npmVersion": "1.4.3",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"name": "combined-stream",
|
||||
"raw": "combined-stream@~0.0.4",
|
||||
"rawSpec": "~0.0.4",
|
||||
"scope": null,
|
||||
"spec": ">=0.0.4 <0.1.0",
|
||||
"type": "range"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/form-data"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-0.0.7.tgz",
|
||||
"_shasum": "0137e657baa5a7541c57ac37ac5fc07d73b4dc1f",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "combined-stream@~0.0.4",
|
||||
"_where": "/Users/williamcheng/Code/may2016/swagger-codegen/samples/client/petstore-security-test/javascript/node_modules/form-data",
|
||||
"author": {
|
||||
"email": "felix@debuggable.com",
|
||||
"name": "Felix Geisendörfer",
|
||||
"url": "http://debuggable.com/"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/felixge/node-combined-stream/issues"
|
||||
},
|
||||
"dependencies": {
|
||||
"delayed-stream": "0.0.5"
|
||||
},
|
||||
"description": "A stream that emits multiple other streams one after another.",
|
||||
"devDependencies": {
|
||||
"far": "~0.0.7"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "0137e657baa5a7541c57ac37ac5fc07d73b4dc1f",
|
||||
"tarball": "http://registry.npmjs.org/combined-stream/-/combined-stream-0.0.7.tgz"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
},
|
||||
"homepage": "https://github.com/felixge/node-combined-stream",
|
||||
"main": "./lib/combined_stream",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "felixge",
|
||||
"email": "felix@debuggable.com"
|
||||
},
|
||||
{
|
||||
"name": "celer",
|
||||
"email": "celer@scrypt.net"
|
||||
},
|
||||
{
|
||||
"name": "alexindigo",
|
||||
"email": "iam@alexindigo.com"
|
||||
}
|
||||
],
|
||||
"name": "combined-stream",
|
||||
"optionalDependencies": {},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/felixge/node-combined-stream.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "node test/run.js"
|
||||
},
|
||||
"version": "0.0.7"
|
||||
}
|
208
samples/client/petstore-security-test/javascript/node_modules/commander/Readme.md
generated
vendored
208
samples/client/petstore-security-test/javascript/node_modules/commander/Readme.md
generated
vendored
@ -1,208 +0,0 @@
|
||||
# Commander.js
|
||||
|
||||
The complete solution for [node.js](http://nodejs.org) command-line interfaces, inspired by Ruby's [commander](https://github.com/visionmedia/commander).
|
||||
|
||||
[![Build Status](https://api.travis-ci.org/visionmedia/commander.js.svg)](http://travis-ci.org/visionmedia/commander.js)
|
||||
|
||||
## Installation
|
||||
|
||||
$ npm install commander
|
||||
|
||||
## Option parsing
|
||||
|
||||
Options with commander are defined with the `.option()` method, also serving as documentation for the options. The example below parses args and options from `process.argv`, leaving remaining args as the `program.args` array which were not consumed by options.
|
||||
|
||||
```js
|
||||
#!/usr/bin/env node
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var program = require('commander');
|
||||
|
||||
program
|
||||
.version('0.0.1')
|
||||
.option('-p, --peppers', 'Add peppers')
|
||||
.option('-P, --pineapple', 'Add pineapple')
|
||||
.option('-b, --bbq', 'Add bbq sauce')
|
||||
.option('-c, --cheese [type]', 'Add the specified type of cheese [marble]', 'marble')
|
||||
.parse(process.argv);
|
||||
|
||||
console.log('you ordered a pizza with:');
|
||||
if (program.peppers) console.log(' - peppers');
|
||||
if (program.pineapple) console.log(' - pineapple');
|
||||
if (program.bbq) console.log(' - bbq');
|
||||
console.log(' - %s cheese', program.cheese);
|
||||
```
|
||||
|
||||
Short flags may be passed as a single arg, for example `-abc` is equivalent to `-a -b -c`. Multi-word options such as "--template-engine" are camel-cased, becoming `program.templateEngine` etc.
|
||||
|
||||
## Automated --help
|
||||
|
||||
The help information is auto-generated based on the information commander already knows about your program, so the following `--help` info is for free:
|
||||
|
||||
```
|
||||
$ ./examples/pizza --help
|
||||
|
||||
Usage: pizza [options]
|
||||
|
||||
Options:
|
||||
|
||||
-V, --version output the version number
|
||||
-p, --peppers Add peppers
|
||||
-P, --pineapple Add pineapple
|
||||
-b, --bbq Add bbq sauce
|
||||
-c, --cheese <type> Add the specified type of cheese [marble]
|
||||
-h, --help output usage information
|
||||
|
||||
```
|
||||
|
||||
## Coercion
|
||||
|
||||
```js
|
||||
function range(val) {
|
||||
return val.split('..').map(Number);
|
||||
}
|
||||
|
||||
function list(val) {
|
||||
return val.split(',');
|
||||
}
|
||||
|
||||
function collect(val, memo) {
|
||||
memo.push(val);
|
||||
return memo;
|
||||
}
|
||||
|
||||
function increaseVerbosity(v, total) {
|
||||
return total + 1;
|
||||
}
|
||||
|
||||
program
|
||||
.version('0.0.1')
|
||||
.usage('[options] <file ...>')
|
||||
.option('-i, --integer <n>', 'An integer argument', parseInt)
|
||||
.option('-f, --float <n>', 'A float argument', parseFloat)
|
||||
.option('-r, --range <a>..<b>', 'A range', range)
|
||||
.option('-l, --list <items>', 'A list', list)
|
||||
.option('-o, --optional [value]', 'An optional value')
|
||||
.option('-c, --collect [value]', 'A repeatable value', collect, [])
|
||||
.option('-v, --verbose', 'A value that can be increased', increaseVerbosity, 0)
|
||||
.parse(process.argv);
|
||||
|
||||
console.log(' int: %j', program.integer);
|
||||
console.log(' float: %j', program.float);
|
||||
console.log(' optional: %j', program.optional);
|
||||
program.range = program.range || [];
|
||||
console.log(' range: %j..%j', program.range[0], program.range[1]);
|
||||
console.log(' list: %j', program.list);
|
||||
console.log(' collect: %j', program.collect);
|
||||
console.log(' verbosity: %j', program.verbose);
|
||||
console.log(' args: %j', program.args);
|
||||
```
|
||||
|
||||
## Custom help
|
||||
|
||||
You can display arbitrary `-h, --help` information
|
||||
by listening for "--help". Commander will automatically
|
||||
exit once you are done so that the remainder of your program
|
||||
does not execute causing undesired behaviours, for example
|
||||
in the following executable "stuff" will not output when
|
||||
`--help` is used.
|
||||
|
||||
```js
|
||||
#!/usr/bin/env node
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var program = require('../');
|
||||
|
||||
function list(val) {
|
||||
return val.split(',').map(Number);
|
||||
}
|
||||
|
||||
program
|
||||
.version('0.0.1')
|
||||
.option('-f, --foo', 'enable some foo')
|
||||
.option('-b, --bar', 'enable some bar')
|
||||
.option('-B, --baz', 'enable some baz');
|
||||
|
||||
// must be before .parse() since
|
||||
// node's emit() is immediate
|
||||
|
||||
program.on('--help', function(){
|
||||
console.log(' Examples:');
|
||||
console.log('');
|
||||
console.log(' $ custom-help --help');
|
||||
console.log(' $ custom-help -h');
|
||||
console.log('');
|
||||
});
|
||||
|
||||
program.parse(process.argv);
|
||||
|
||||
console.log('stuff');
|
||||
```
|
||||
|
||||
yielding the following help output:
|
||||
|
||||
```
|
||||
|
||||
Usage: custom-help [options]
|
||||
|
||||
Options:
|
||||
|
||||
-h, --help output usage information
|
||||
-V, --version output the version number
|
||||
-f, --foo enable some foo
|
||||
-b, --bar enable some bar
|
||||
-B, --baz enable some baz
|
||||
|
||||
Examples:
|
||||
|
||||
$ custom-help --help
|
||||
$ custom-help -h
|
||||
|
||||
```
|
||||
|
||||
## .outputHelp()
|
||||
|
||||
Output help information without exiting.
|
||||
|
||||
## .help()
|
||||
|
||||
Output help information and exit immediately.
|
||||
|
||||
## Links
|
||||
|
||||
- [API documentation](http://visionmedia.github.com/commander.js/)
|
||||
- [ascii tables](https://github.com/LearnBoost/cli-table)
|
||||
- [progress bars](https://github.com/visionmedia/node-progress)
|
||||
- [more progress bars](https://github.com/substack/node-multimeter)
|
||||
- [examples](https://github.com/visionmedia/commander.js/tree/master/examples)
|
||||
|
||||
## License
|
||||
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2011 TJ Holowaychuk <tj@vision-media.ca>
|
||||
|
||||
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.
|
876
samples/client/petstore-security-test/javascript/node_modules/commander/index.js
generated
vendored
876
samples/client/petstore-security-test/javascript/node_modules/commander/index.js
generated
vendored
@ -1,876 +0,0 @@
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var EventEmitter = require('events').EventEmitter;
|
||||
var spawn = require('child_process').spawn;
|
||||
var path = require('path');
|
||||
var dirname = path.dirname;
|
||||
var basename = path.basename;
|
||||
|
||||
/**
|
||||
* Expose the root command.
|
||||
*/
|
||||
|
||||
exports = module.exports = new Command;
|
||||
|
||||
/**
|
||||
* Expose `Command`.
|
||||
*/
|
||||
|
||||
exports.Command = Command;
|
||||
|
||||
/**
|
||||
* Expose `Option`.
|
||||
*/
|
||||
|
||||
exports.Option = Option;
|
||||
|
||||
/**
|
||||
* Initialize a new `Option` with the given `flags` and `description`.
|
||||
*
|
||||
* @param {String} flags
|
||||
* @param {String} description
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function Option(flags, description) {
|
||||
this.flags = flags;
|
||||
this.required = ~flags.indexOf('<');
|
||||
this.optional = ~flags.indexOf('[');
|
||||
this.bool = !~flags.indexOf('-no-');
|
||||
flags = flags.split(/[ ,|]+/);
|
||||
if (flags.length > 1 && !/^[[<]/.test(flags[1])) this.short = flags.shift();
|
||||
this.long = flags.shift();
|
||||
this.description = description || '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Return option name.
|
||||
*
|
||||
* @return {String}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Option.prototype.name = function(){
|
||||
return this.long
|
||||
.replace('--', '')
|
||||
.replace('no-', '');
|
||||
};
|
||||
|
||||
/**
|
||||
* Check if `arg` matches the short or long flag.
|
||||
*
|
||||
* @param {String} arg
|
||||
* @return {Boolean}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Option.prototype.is = function(arg){
|
||||
return arg == this.short
|
||||
|| arg == this.long;
|
||||
};
|
||||
|
||||
/**
|
||||
* Initialize a new `Command`.
|
||||
*
|
||||
* @param {String} name
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function Command(name) {
|
||||
this.commands = [];
|
||||
this.options = [];
|
||||
this._execs = [];
|
||||
this._args = [];
|
||||
this._name = name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Inherit from `EventEmitter.prototype`.
|
||||
*/
|
||||
|
||||
Command.prototype.__proto__ = EventEmitter.prototype;
|
||||
|
||||
/**
|
||||
* Add command `name`.
|
||||
*
|
||||
* The `.action()` callback is invoked when the
|
||||
* command `name` is specified via __ARGV__,
|
||||
* and the remaining arguments are applied to the
|
||||
* function for access.
|
||||
*
|
||||
* When the `name` is "*" an un-matched command
|
||||
* will be passed as the first arg, followed by
|
||||
* the rest of __ARGV__ remaining.
|
||||
*
|
||||
* Examples:
|
||||
*
|
||||
* program
|
||||
* .version('0.0.1')
|
||||
* .option('-C, --chdir <path>', 'change the working directory')
|
||||
* .option('-c, --config <path>', 'set config path. defaults to ./deploy.conf')
|
||||
* .option('-T, --no-tests', 'ignore test hook')
|
||||
*
|
||||
* program
|
||||
* .command('setup')
|
||||
* .description('run remote setup commands')
|
||||
* .action(function(){
|
||||
* console.log('setup');
|
||||
* });
|
||||
*
|
||||
* program
|
||||
* .command('exec <cmd>')
|
||||
* .description('run the given remote command')
|
||||
* .action(function(cmd){
|
||||
* console.log('exec "%s"', cmd);
|
||||
* });
|
||||
*
|
||||
* program
|
||||
* .command('*')
|
||||
* .description('deploy the given env')
|
||||
* .action(function(env){
|
||||
* console.log('deploying "%s"', env);
|
||||
* });
|
||||
*
|
||||
* program.parse(process.argv);
|
||||
*
|
||||
* @param {String} name
|
||||
* @param {String} [desc]
|
||||
* @return {Command} the new command
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Command.prototype.command = function(name, desc) {
|
||||
var args = name.split(/ +/);
|
||||
var cmd = new Command(args.shift());
|
||||
if (desc) cmd.description(desc);
|
||||
if (desc) this.executables = true;
|
||||
if (desc) this._execs[cmd._name] = true;
|
||||
this.commands.push(cmd);
|
||||
cmd.parseExpectedArgs(args);
|
||||
cmd.parent = this;
|
||||
if (desc) return this;
|
||||
return cmd;
|
||||
};
|
||||
|
||||
/**
|
||||
* Add an implicit `help [cmd]` subcommand
|
||||
* which invokes `--help` for the given command.
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Command.prototype.addImplicitHelpCommand = function() {
|
||||
this.command('help [cmd]', 'display help for [cmd]');
|
||||
};
|
||||
|
||||
/**
|
||||
* Parse expected `args`.
|
||||
*
|
||||
* For example `["[type]"]` becomes `[{ required: false, name: 'type' }]`.
|
||||
*
|
||||
* @param {Array} args
|
||||
* @return {Command} for chaining
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Command.prototype.parseExpectedArgs = function(args){
|
||||
if (!args.length) return;
|
||||
var self = this;
|
||||
args.forEach(function(arg){
|
||||
switch (arg[0]) {
|
||||
case '<':
|
||||
self._args.push({ required: true, name: arg.slice(1, -1) });
|
||||
break;
|
||||
case '[':
|
||||
self._args.push({ required: false, name: arg.slice(1, -1) });
|
||||
break;
|
||||
}
|
||||
});
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Register callback `fn` for the command.
|
||||
*
|
||||
* Examples:
|
||||
*
|
||||
* program
|
||||
* .command('help')
|
||||
* .description('display verbose help')
|
||||
* .action(function(){
|
||||
* // output help here
|
||||
* });
|
||||
*
|
||||
* @param {Function} fn
|
||||
* @return {Command} for chaining
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Command.prototype.action = function(fn){
|
||||
var self = this;
|
||||
var listener = function(args, unknown){
|
||||
// Parse any so-far unknown options
|
||||
args = args || [];
|
||||
unknown = unknown || [];
|
||||
|
||||
var parsed = self.parseOptions(unknown);
|
||||
|
||||
// Output help if necessary
|
||||
outputHelpIfNecessary(self, parsed.unknown);
|
||||
|
||||
// If there are still any unknown options, then we simply
|
||||
// die, unless someone asked for help, in which case we give it
|
||||
// to them, and then we die.
|
||||
if (parsed.unknown.length > 0) {
|
||||
self.unknownOption(parsed.unknown[0]);
|
||||
}
|
||||
|
||||
// Leftover arguments need to be pushed back. Fixes issue #56
|
||||
if (parsed.args.length) args = parsed.args.concat(args);
|
||||
|
||||
self._args.forEach(function(arg, i){
|
||||
if (arg.required && null == args[i]) {
|
||||
self.missingArgument(arg.name);
|
||||
}
|
||||
});
|
||||
|
||||
// Always append ourselves to the end of the arguments,
|
||||
// to make sure we match the number of arguments the user
|
||||
// expects
|
||||
if (self._args.length) {
|
||||
args[self._args.length] = self;
|
||||
} else {
|
||||
args.push(self);
|
||||
}
|
||||
|
||||
fn.apply(this, args);
|
||||
};
|
||||
this.parent.on(this._name, listener);
|
||||
if (this._alias) this.parent.on(this._alias, listener);
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Define option with `flags`, `description` and optional
|
||||
* coercion `fn`.
|
||||
*
|
||||
* The `flags` string should contain both the short and long flags,
|
||||
* separated by comma, a pipe or space. The following are all valid
|
||||
* all will output this way when `--help` is used.
|
||||
*
|
||||
* "-p, --pepper"
|
||||
* "-p|--pepper"
|
||||
* "-p --pepper"
|
||||
*
|
||||
* Examples:
|
||||
*
|
||||
* // simple boolean defaulting to false
|
||||
* program.option('-p, --pepper', 'add pepper');
|
||||
*
|
||||
* --pepper
|
||||
* program.pepper
|
||||
* // => Boolean
|
||||
*
|
||||
* // simple boolean defaulting to true
|
||||
* program.option('-C, --no-cheese', 'remove cheese');
|
||||
*
|
||||
* program.cheese
|
||||
* // => true
|
||||
*
|
||||
* --no-cheese
|
||||
* program.cheese
|
||||
* // => false
|
||||
*
|
||||
* // required argument
|
||||
* program.option('-C, --chdir <path>', 'change the working directory');
|
||||
*
|
||||
* --chdir /tmp
|
||||
* program.chdir
|
||||
* // => "/tmp"
|
||||
*
|
||||
* // optional argument
|
||||
* program.option('-c, --cheese [type]', 'add cheese [marble]');
|
||||
*
|
||||
* @param {String} flags
|
||||
* @param {String} description
|
||||
* @param {Function|Mixed} fn or default
|
||||
* @param {Mixed} defaultValue
|
||||
* @return {Command} for chaining
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Command.prototype.option = function(flags, description, fn, defaultValue){
|
||||
var self = this
|
||||
, option = new Option(flags, description)
|
||||
, oname = option.name()
|
||||
, name = camelcase(oname);
|
||||
|
||||
// default as 3rd arg
|
||||
if ('function' != typeof fn) defaultValue = fn, fn = null;
|
||||
|
||||
// preassign default value only for --no-*, [optional], or <required>
|
||||
if (false == option.bool || option.optional || option.required) {
|
||||
// when --no-* we make sure default is true
|
||||
if (false == option.bool) defaultValue = true;
|
||||
// preassign only if we have a default
|
||||
if (undefined !== defaultValue) self[name] = defaultValue;
|
||||
}
|
||||
|
||||
// register the option
|
||||
this.options.push(option);
|
||||
|
||||
// when it's passed assign the value
|
||||
// and conditionally invoke the callback
|
||||
this.on(oname, function(val){
|
||||
// coercion
|
||||
if (null !== val && fn) val = fn(val, undefined === self[name] ? defaultValue : self[name]);
|
||||
|
||||
// unassigned or bool
|
||||
if ('boolean' == typeof self[name] || 'undefined' == typeof self[name]) {
|
||||
// if no value, bool true, and we have a default, then use it!
|
||||
if (null == val) {
|
||||
self[name] = option.bool
|
||||
? defaultValue || true
|
||||
: false;
|
||||
} else {
|
||||
self[name] = val;
|
||||
}
|
||||
} else if (null !== val) {
|
||||
// reassign
|
||||
self[name] = val;
|
||||
}
|
||||
});
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Parse `argv`, settings options and invoking commands when defined.
|
||||
*
|
||||
* @param {Array} argv
|
||||
* @return {Command} for chaining
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Command.prototype.parse = function(argv){
|
||||
// implicit help
|
||||
if (this.executables) this.addImplicitHelpCommand();
|
||||
|
||||
// store raw args
|
||||
this.rawArgs = argv;
|
||||
|
||||
// guess name
|
||||
this._name = this._name || basename(argv[1], '.js');
|
||||
|
||||
// process argv
|
||||
var parsed = this.parseOptions(this.normalize(argv.slice(2)));
|
||||
var args = this.args = parsed.args;
|
||||
|
||||
var result = this.parseArgs(this.args, parsed.unknown);
|
||||
|
||||
// executable sub-commands
|
||||
var name = result.args[0];
|
||||
if (this._execs[name]) return this.executeSubCommand(argv, args, parsed.unknown);
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
/**
|
||||
* Execute a sub-command executable.
|
||||
*
|
||||
* @param {Array} argv
|
||||
* @param {Array} args
|
||||
* @param {Array} unknown
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Command.prototype.executeSubCommand = function(argv, args, unknown) {
|
||||
args = args.concat(unknown);
|
||||
|
||||
if (!args.length) this.help();
|
||||
if ('help' == args[0] && 1 == args.length) this.help();
|
||||
|
||||
// <cmd> --help
|
||||
if ('help' == args[0]) {
|
||||
args[0] = args[1];
|
||||
args[1] = '--help';
|
||||
}
|
||||
|
||||
// executable
|
||||
var dir = dirname(argv[1]);
|
||||
var bin = basename(argv[1], '.js') + '-' + args[0];
|
||||
|
||||
// check for ./<bin> first
|
||||
var local = path.join(dir, bin);
|
||||
|
||||
// run it
|
||||
args = args.slice(1);
|
||||
args.unshift(local);
|
||||
var proc = spawn('node', args, { stdio: 'inherit', customFds: [0, 1, 2] });
|
||||
proc.on('error', function(err){
|
||||
if (err.code == "ENOENT") {
|
||||
console.error('\n %s(1) does not exist, try --help\n', bin);
|
||||
} else if (err.code == "EACCES") {
|
||||
console.error('\n %s(1) not executable. try chmod or run with root\n', bin);
|
||||
}
|
||||
});
|
||||
|
||||
this.runningCommand = proc;
|
||||
};
|
||||
|
||||
/**
|
||||
* Normalize `args`, splitting joined short flags. For example
|
||||
* the arg "-abc" is equivalent to "-a -b -c".
|
||||
* This also normalizes equal sign and splits "--abc=def" into "--abc def".
|
||||
*
|
||||
* @param {Array} args
|
||||
* @return {Array}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Command.prototype.normalize = function(args){
|
||||
var ret = []
|
||||
, arg
|
||||
, lastOpt
|
||||
, index;
|
||||
|
||||
for (var i = 0, len = args.length; i < len; ++i) {
|
||||
arg = args[i];
|
||||
i > 0 && (lastOpt = this.optionFor(args[i-1]));
|
||||
|
||||
if (lastOpt && lastOpt.required) {
|
||||
ret.push(arg);
|
||||
} else if (arg.length > 1 && '-' == arg[0] && '-' != arg[1]) {
|
||||
arg.slice(1).split('').forEach(function(c){
|
||||
ret.push('-' + c);
|
||||
});
|
||||
} else if (/^--/.test(arg) && ~(index = arg.indexOf('='))) {
|
||||
ret.push(arg.slice(0, index), arg.slice(index + 1));
|
||||
} else {
|
||||
ret.push(arg);
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
};
|
||||
|
||||
/**
|
||||
* Parse command `args`.
|
||||
*
|
||||
* When listener(s) are available those
|
||||
* callbacks are invoked, otherwise the "*"
|
||||
* event is emitted and those actions are invoked.
|
||||
*
|
||||
* @param {Array} args
|
||||
* @return {Command} for chaining
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Command.prototype.parseArgs = function(args, unknown){
|
||||
var cmds = this.commands
|
||||
, len = cmds.length
|
||||
, name;
|
||||
|
||||
if (args.length) {
|
||||
name = args[0];
|
||||
if (this.listeners(name).length) {
|
||||
this.emit(args.shift(), args, unknown);
|
||||
} else {
|
||||
this.emit('*', args);
|
||||
}
|
||||
} else {
|
||||
outputHelpIfNecessary(this, unknown);
|
||||
|
||||
// If there were no args and we have unknown options,
|
||||
// then they are extraneous and we need to error.
|
||||
if (unknown.length > 0) {
|
||||
this.unknownOption(unknown[0]);
|
||||
}
|
||||
}
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Return an option matching `arg` if any.
|
||||
*
|
||||
* @param {String} arg
|
||||
* @return {Option}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Command.prototype.optionFor = function(arg){
|
||||
for (var i = 0, len = this.options.length; i < len; ++i) {
|
||||
if (this.options[i].is(arg)) {
|
||||
return this.options[i];
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Parse options from `argv` returning `argv`
|
||||
* void of these options.
|
||||
*
|
||||
* @param {Array} argv
|
||||
* @return {Array}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Command.prototype.parseOptions = function(argv){
|
||||
var args = []
|
||||
, len = argv.length
|
||||
, literal
|
||||
, option
|
||||
, arg;
|
||||
|
||||
var unknownOptions = [];
|
||||
|
||||
// parse options
|
||||
for (var i = 0; i < len; ++i) {
|
||||
arg = argv[i];
|
||||
|
||||
// literal args after --
|
||||
if ('--' == arg) {
|
||||
literal = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (literal) {
|
||||
args.push(arg);
|
||||
continue;
|
||||
}
|
||||
|
||||
// find matching Option
|
||||
option = this.optionFor(arg);
|
||||
|
||||
// option is defined
|
||||
if (option) {
|
||||
// requires arg
|
||||
if (option.required) {
|
||||
arg = argv[++i];
|
||||
if (null == arg) return this.optionMissingArgument(option);
|
||||
this.emit(option.name(), arg);
|
||||
// optional arg
|
||||
} else if (option.optional) {
|
||||
arg = argv[i+1];
|
||||
if (null == arg || ('-' == arg[0] && '-' != arg)) {
|
||||
arg = null;
|
||||
} else {
|
||||
++i;
|
||||
}
|
||||
this.emit(option.name(), arg);
|
||||
// bool
|
||||
} else {
|
||||
this.emit(option.name());
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
// looks like an option
|
||||
if (arg.length > 1 && '-' == arg[0]) {
|
||||
unknownOptions.push(arg);
|
||||
|
||||
// If the next argument looks like it might be
|
||||
// an argument for this option, we pass it on.
|
||||
// If it isn't, then it'll simply be ignored
|
||||
if (argv[i+1] && '-' != argv[i+1][0]) {
|
||||
unknownOptions.push(argv[++i]);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
// arg
|
||||
args.push(arg);
|
||||
}
|
||||
|
||||
return { args: args, unknown: unknownOptions };
|
||||
};
|
||||
|
||||
/**
|
||||
* Argument `name` is missing.
|
||||
*
|
||||
* @param {String} name
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Command.prototype.missingArgument = function(name){
|
||||
console.error();
|
||||
console.error(" error: missing required argument `%s'", name);
|
||||
console.error();
|
||||
process.exit(1);
|
||||
};
|
||||
|
||||
/**
|
||||
* `Option` is missing an argument, but received `flag` or nothing.
|
||||
*
|
||||
* @param {String} option
|
||||
* @param {String} flag
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Command.prototype.optionMissingArgument = function(option, flag){
|
||||
console.error();
|
||||
if (flag) {
|
||||
console.error(" error: option `%s' argument missing, got `%s'", option.flags, flag);
|
||||
} else {
|
||||
console.error(" error: option `%s' argument missing", option.flags);
|
||||
}
|
||||
console.error();
|
||||
process.exit(1);
|
||||
};
|
||||
|
||||
/**
|
||||
* Unknown option `flag`.
|
||||
*
|
||||
* @param {String} flag
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Command.prototype.unknownOption = function(flag){
|
||||
console.error();
|
||||
console.error(" error: unknown option `%s'", flag);
|
||||
console.error();
|
||||
process.exit(1);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Set the program version to `str`.
|
||||
*
|
||||
* This method auto-registers the "-V, --version" flag
|
||||
* which will print the version number when passed.
|
||||
*
|
||||
* @param {String} str
|
||||
* @param {String} flags
|
||||
* @return {Command} for chaining
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Command.prototype.version = function(str, flags){
|
||||
if (0 == arguments.length) return this._version;
|
||||
this._version = str;
|
||||
flags = flags || '-V, --version';
|
||||
this.option(flags, 'output the version number');
|
||||
this.on('version', function(){
|
||||
console.log(str);
|
||||
process.exit(0);
|
||||
});
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Set the description `str`.
|
||||
*
|
||||
* @param {String} str
|
||||
* @return {String|Command}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Command.prototype.description = function(str){
|
||||
if (0 == arguments.length) return this._description;
|
||||
this._description = str;
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Set an alias for the command
|
||||
*
|
||||
* @param {String} alias
|
||||
* @return {String|Command}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Command.prototype.alias = function(alias){
|
||||
if (0 == arguments.length) return this._alias;
|
||||
this._alias = alias;
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Set / get the command usage `str`.
|
||||
*
|
||||
* @param {String} str
|
||||
* @return {String|Command}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Command.prototype.usage = function(str){
|
||||
var args = this._args.map(function(arg){
|
||||
return arg.required
|
||||
? '<' + arg.name + '>'
|
||||
: '[' + arg.name + ']';
|
||||
});
|
||||
|
||||
var usage = '[options'
|
||||
+ (this.commands.length ? '] [command' : '')
|
||||
+ ']'
|
||||
+ (this._args.length ? ' ' + args : '');
|
||||
|
||||
if (0 == arguments.length) return this._usage || usage;
|
||||
this._usage = str;
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Return the largest option length.
|
||||
*
|
||||
* @return {Number}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Command.prototype.largestOptionLength = function(){
|
||||
return this.options.reduce(function(max, option){
|
||||
return Math.max(max, option.flags.length);
|
||||
}, 0);
|
||||
};
|
||||
|
||||
/**
|
||||
* Return help for options.
|
||||
*
|
||||
* @return {String}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Command.prototype.optionHelp = function(){
|
||||
var width = this.largestOptionLength();
|
||||
|
||||
// Prepend the help information
|
||||
return [pad('-h, --help', width) + ' ' + 'output usage information']
|
||||
.concat(this.options.map(function(option){
|
||||
return pad(option.flags, width)
|
||||
+ ' ' + option.description;
|
||||
}))
|
||||
.join('\n');
|
||||
};
|
||||
|
||||
/**
|
||||
* Return command help documentation.
|
||||
*
|
||||
* @return {String}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Command.prototype.commandHelp = function(){
|
||||
if (!this.commands.length) return '';
|
||||
return [
|
||||
''
|
||||
, ' Commands:'
|
||||
, ''
|
||||
, this.commands.map(function(cmd){
|
||||
var args = cmd._args.map(function(arg){
|
||||
return arg.required
|
||||
? '<' + arg.name + '>'
|
||||
: '[' + arg.name + ']';
|
||||
}).join(' ');
|
||||
|
||||
return cmd._name
|
||||
+ (cmd._alias
|
||||
? '|' + cmd._alias
|
||||
: '')
|
||||
+ (cmd.options.length
|
||||
? ' [options]'
|
||||
: '') + ' ' + args
|
||||
+ (cmd.description()
|
||||
? '\n ' + cmd.description()
|
||||
: '')
|
||||
+ '\n';
|
||||
}).join('\n').replace(/^/gm, ' ')
|
||||
, ''
|
||||
].join('\n');
|
||||
};
|
||||
|
||||
/**
|
||||
* Return program help documentation.
|
||||
*
|
||||
* @return {String}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Command.prototype.helpInformation = function(){
|
||||
return [
|
||||
''
|
||||
, ' Usage: ' + this._name
|
||||
+ (this._alias
|
||||
? '|' + this._alias
|
||||
: '')
|
||||
+ ' ' + this.usage()
|
||||
, '' + this.commandHelp()
|
||||
, ' Options:'
|
||||
, ''
|
||||
, '' + this.optionHelp().replace(/^/gm, ' ')
|
||||
, ''
|
||||
, ''
|
||||
].join('\n');
|
||||
};
|
||||
|
||||
/**
|
||||
* Output help information for this command
|
||||
*
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Command.prototype.outputHelp = function(){
|
||||
process.stdout.write(this.helpInformation());
|
||||
this.emit('--help');
|
||||
};
|
||||
|
||||
/**
|
||||
* Output help information and exit.
|
||||
*
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Command.prototype.help = function(){
|
||||
this.outputHelp();
|
||||
process.exit();
|
||||
};
|
||||
|
||||
/**
|
||||
* Camel-case the given `flag`
|
||||
*
|
||||
* @param {String} flag
|
||||
* @return {String}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function camelcase(flag) {
|
||||
return flag.split('-').reduce(function(str, word){
|
||||
return str + word[0].toUpperCase() + word.slice(1);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Pad `str` to `width`.
|
||||
*
|
||||
* @param {String} str
|
||||
* @param {Number} width
|
||||
* @return {String}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function pad(str, width) {
|
||||
var len = Math.max(0, width - str.length);
|
||||
return str + Array(len + 1).join(' ');
|
||||
}
|
||||
|
||||
/**
|
||||
* Output help information if necessary
|
||||
*
|
||||
* @param {Command} command to output help for
|
||||
* @param {Array} array of options to search for -h or --help
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function outputHelpIfNecessary(cmd, options) {
|
||||
options = options || [];
|
||||
for (var i = 0; i < options.length; i++) {
|
||||
if (options[i] == '--help' || options[i] == '-h') {
|
||||
cmd.outputHelp();
|
||||
process.exit(0);
|
||||
}
|
||||
}
|
||||
}
|
96
samples/client/petstore-security-test/javascript/node_modules/commander/package.json
generated
vendored
96
samples/client/petstore-security-test/javascript/node_modules/commander/package.json
generated
vendored
@ -1,96 +0,0 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"commander@2.3.0",
|
||||
"/Users/williamcheng/Code/may2016/swagger-codegen/samples/client/petstore-security-test/javascript/node_modules/mocha"
|
||||
]
|
||||
],
|
||||
"_from": "commander@2.3.0",
|
||||
"_id": "commander@2.3.0",
|
||||
"_inCache": true,
|
||||
"_installable": true,
|
||||
"_location": "/commander",
|
||||
"_npmUser": {
|
||||
"email": "rkoutnik@gmail.com",
|
||||
"name": "somekittens"
|
||||
},
|
||||
"_npmVersion": "1.4.21",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"name": "commander",
|
||||
"raw": "commander@2.3.0",
|
||||
"rawSpec": "2.3.0",
|
||||
"scope": null,
|
||||
"spec": "2.3.0",
|
||||
"type": "version"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/mocha"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/commander/-/commander-2.3.0.tgz",
|
||||
"_shasum": "fd430e889832ec353b9acd1de217c11cb3eef873",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "commander@2.3.0",
|
||||
"_where": "/Users/williamcheng/Code/may2016/swagger-codegen/samples/client/petstore-security-test/javascript/node_modules/mocha",
|
||||
"author": {
|
||||
"email": "tj@vision-media.ca",
|
||||
"name": "TJ Holowaychuk"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/visionmedia/commander.js/issues"
|
||||
},
|
||||
"dependencies": {},
|
||||
"description": "the complete solution for node.js command-line programs",
|
||||
"devDependencies": {
|
||||
"should": ">= 0.0.1"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "fd430e889832ec353b9acd1de217c11cb3eef873",
|
||||
"tarball": "https://registry.npmjs.org/commander/-/commander-2.3.0.tgz"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.6.x"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"gitHead": "7e9f407ec03d4371a478c2fe417db4998ecb6169",
|
||||
"homepage": "https://github.com/visionmedia/commander.js",
|
||||
"keywords": [
|
||||
"command",
|
||||
"option",
|
||||
"parser",
|
||||
"prompt",
|
||||
"stdin"
|
||||
],
|
||||
"main": "index",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "tjholowaychuk",
|
||||
"email": "tj@vision-media.ca"
|
||||
},
|
||||
{
|
||||
"name": "somekittens",
|
||||
"email": "rkoutnik@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "zhiyelee",
|
||||
"email": "zhiyelee@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "thethomaseffect",
|
||||
"email": "thethomaseffect@gmail.com"
|
||||
}
|
||||
],
|
||||
"name": "commander",
|
||||
"optionalDependencies": {},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/visionmedia/commander.js.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "make test"
|
||||
},
|
||||
"version": "2.3.0"
|
||||
}
|
@ -1,68 +0,0 @@
|
||||
|
||||
1.2.1 / 2016-04-18
|
||||
==================
|
||||
|
||||
* enable client side use
|
||||
|
||||
1.2.0 / 2014-02-12
|
||||
==================
|
||||
|
||||
* prefix events with `$` to support object prototype method names
|
||||
|
||||
1.1.3 / 2014-06-20
|
||||
==================
|
||||
|
||||
* republish for npm
|
||||
* add LICENSE file
|
||||
|
||||
1.1.2 / 2014-02-10
|
||||
==================
|
||||
|
||||
* package: rename to "component-emitter"
|
||||
* package: update "main" and "component" fields
|
||||
* Add license to Readme (same format as the other components)
|
||||
* created .npmignore
|
||||
* travis stuff
|
||||
|
||||
1.1.1 / 2013-12-01
|
||||
==================
|
||||
|
||||
* fix .once adding .on to the listener
|
||||
* docs: Emitter#off()
|
||||
* component: add `.repo` prop
|
||||
|
||||
1.1.0 / 2013-10-20
|
||||
==================
|
||||
|
||||
* add `.addEventListener()` and `.removeEventListener()` aliases
|
||||
|
||||
1.0.1 / 2013-06-27
|
||||
==================
|
||||
|
||||
* add support for legacy ie
|
||||
|
||||
1.0.0 / 2013-02-26
|
||||
==================
|
||||
|
||||
* add `.off()` support for removing all listeners
|
||||
|
||||
0.0.6 / 2012-10-08
|
||||
==================
|
||||
|
||||
* add `this._callbacks` initialization to prevent funky gotcha
|
||||
|
||||
0.0.5 / 2012-09-07
|
||||
==================
|
||||
|
||||
* fix `Emitter.call(this)` usage
|
||||
|
||||
0.0.3 / 2012-07-11
|
||||
==================
|
||||
|
||||
* add `.listeners()`
|
||||
* rename `.has()` to `.hasListeners()`
|
||||
|
||||
0.0.2 / 2012-06-28
|
||||
==================
|
||||
|
||||
* fix `.off()` with `.once()`-registered callbacks
|
24
samples/client/petstore-security-test/javascript/node_modules/component-emitter/LICENSE
generated
vendored
24
samples/client/petstore-security-test/javascript/node_modules/component-emitter/LICENSE
generated
vendored
@ -1,24 +0,0 @@
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2014 Component contributors <dev@component.io>
|
||||
|
||||
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.
|
@ -1,74 +0,0 @@
|
||||
# Emitter [![Build Status](https://travis-ci.org/component/emitter.png)](https://travis-ci.org/component/emitter)
|
||||
|
||||
Event emitter component.
|
||||
|
||||
## Installation
|
||||
|
||||
```
|
||||
$ component install component/emitter
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### Emitter(obj)
|
||||
|
||||
The `Emitter` may also be used as a mixin. For example
|
||||
a "plain" object may become an emitter, or you may
|
||||
extend an existing prototype.
|
||||
|
||||
As an `Emitter` instance:
|
||||
|
||||
```js
|
||||
var Emitter = require('emitter');
|
||||
var emitter = new Emitter;
|
||||
emitter.emit('something');
|
||||
```
|
||||
|
||||
As a mixin:
|
||||
|
||||
```js
|
||||
var Emitter = require('emitter');
|
||||
var user = { name: 'tobi' };
|
||||
Emitter(user);
|
||||
|
||||
user.emit('im a user');
|
||||
```
|
||||
|
||||
As a prototype mixin:
|
||||
|
||||
```js
|
||||
var Emitter = require('emitter');
|
||||
Emitter(User.prototype);
|
||||
```
|
||||
|
||||
### Emitter#on(event, fn)
|
||||
|
||||
Register an `event` handler `fn`.
|
||||
|
||||
### Emitter#once(event, fn)
|
||||
|
||||
Register a single-shot `event` handler `fn`,
|
||||
removed immediately after it is invoked the
|
||||
first time.
|
||||
|
||||
### Emitter#off(event, fn)
|
||||
|
||||
* Pass `event` and `fn` to remove a listener.
|
||||
* Pass `event` to remove all listeners on that event.
|
||||
* Pass nothing to remove all listeners on all events.
|
||||
|
||||
### Emitter#emit(event, ...)
|
||||
|
||||
Emit an `event` with variable option args.
|
||||
|
||||
### Emitter#listeners(event)
|
||||
|
||||
Return an array of callbacks, or an empty array.
|
||||
|
||||
### Emitter#hasListeners(event)
|
||||
|
||||
Check if this emitter has `event` handlers.
|
||||
|
||||
## License
|
||||
|
||||
MIT
|
163
samples/client/petstore-security-test/javascript/node_modules/component-emitter/index.js
generated
vendored
163
samples/client/petstore-security-test/javascript/node_modules/component-emitter/index.js
generated
vendored
@ -1,163 +0,0 @@
|
||||
|
||||
/**
|
||||
* Expose `Emitter`.
|
||||
*/
|
||||
|
||||
if (typeof module !== 'undefined') {
|
||||
module.exports = Emitter;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize a new `Emitter`.
|
||||
*
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function Emitter(obj) {
|
||||
if (obj) return mixin(obj);
|
||||
};
|
||||
|
||||
/**
|
||||
* Mixin the emitter properties.
|
||||
*
|
||||
* @param {Object} obj
|
||||
* @return {Object}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function mixin(obj) {
|
||||
for (var key in Emitter.prototype) {
|
||||
obj[key] = Emitter.prototype[key];
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
|
||||
/**
|
||||
* Listen on the given `event` with `fn`.
|
||||
*
|
||||
* @param {String} event
|
||||
* @param {Function} fn
|
||||
* @return {Emitter}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Emitter.prototype.on =
|
||||
Emitter.prototype.addEventListener = function(event, fn){
|
||||
this._callbacks = this._callbacks || {};
|
||||
(this._callbacks['$' + event] = this._callbacks['$' + event] || [])
|
||||
.push(fn);
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Adds an `event` listener that will be invoked a single
|
||||
* time then automatically removed.
|
||||
*
|
||||
* @param {String} event
|
||||
* @param {Function} fn
|
||||
* @return {Emitter}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Emitter.prototype.once = function(event, fn){
|
||||
function on() {
|
||||
this.off(event, on);
|
||||
fn.apply(this, arguments);
|
||||
}
|
||||
|
||||
on.fn = fn;
|
||||
this.on(event, on);
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Remove the given callback for `event` or all
|
||||
* registered callbacks.
|
||||
*
|
||||
* @param {String} event
|
||||
* @param {Function} fn
|
||||
* @return {Emitter}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Emitter.prototype.off =
|
||||
Emitter.prototype.removeListener =
|
||||
Emitter.prototype.removeAllListeners =
|
||||
Emitter.prototype.removeEventListener = function(event, fn){
|
||||
this._callbacks = this._callbacks || {};
|
||||
|
||||
// all
|
||||
if (0 == arguments.length) {
|
||||
this._callbacks = {};
|
||||
return this;
|
||||
}
|
||||
|
||||
// specific event
|
||||
var callbacks = this._callbacks['$' + event];
|
||||
if (!callbacks) return this;
|
||||
|
||||
// remove all handlers
|
||||
if (1 == arguments.length) {
|
||||
delete this._callbacks['$' + event];
|
||||
return this;
|
||||
}
|
||||
|
||||
// remove specific handler
|
||||
var cb;
|
||||
for (var i = 0; i < callbacks.length; i++) {
|
||||
cb = callbacks[i];
|
||||
if (cb === fn || cb.fn === fn) {
|
||||
callbacks.splice(i, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Emit `event` with the given args.
|
||||
*
|
||||
* @param {String} event
|
||||
* @param {Mixed} ...
|
||||
* @return {Emitter}
|
||||
*/
|
||||
|
||||
Emitter.prototype.emit = function(event){
|
||||
this._callbacks = this._callbacks || {};
|
||||
var args = [].slice.call(arguments, 1)
|
||||
, callbacks = this._callbacks['$' + event];
|
||||
|
||||
if (callbacks) {
|
||||
callbacks = callbacks.slice(0);
|
||||
for (var i = 0, len = callbacks.length; i < len; ++i) {
|
||||
callbacks[i].apply(this, args);
|
||||
}
|
||||
}
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Return array of callbacks for `event`.
|
||||
*
|
||||
* @param {String} event
|
||||
* @return {Array}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Emitter.prototype.listeners = function(event){
|
||||
this._callbacks = this._callbacks || {};
|
||||
return this._callbacks['$' + event] || [];
|
||||
};
|
||||
|
||||
/**
|
||||
* Check if this emitter has `event` handlers.
|
||||
*
|
||||
* @param {String} event
|
||||
* @return {Boolean}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Emitter.prototype.hasListeners = function(event){
|
||||
return !! this.listeners(event).length;
|
||||
};
|
207
samples/client/petstore-security-test/javascript/node_modules/component-emitter/package.json
generated
vendored
207
samples/client/petstore-security-test/javascript/node_modules/component-emitter/package.json
generated
vendored
@ -1,207 +0,0 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"component-emitter@~1.2.0",
|
||||
"/Users/williamcheng/Code/may2016/swagger-codegen/samples/client/petstore-security-test/javascript/node_modules/superagent"
|
||||
]
|
||||
],
|
||||
"_from": "component-emitter@>=1.2.0 <1.3.0",
|
||||
"_id": "component-emitter@1.2.1",
|
||||
"_inCache": true,
|
||||
"_installable": true,
|
||||
"_location": "/component-emitter",
|
||||
"_nodeVersion": "0.12.4",
|
||||
"_npmOperationalInternal": {
|
||||
"host": "packages-12-west.internal.npmjs.com",
|
||||
"tmp": "tmp/component-emitter-1.2.1.tgz_1461005707641_0.14232611074112356"
|
||||
},
|
||||
"_npmUser": {
|
||||
"email": "karp@hotmail.fr",
|
||||
"name": "nami-doc"
|
||||
},
|
||||
"_npmVersion": "2.10.1",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"name": "component-emitter",
|
||||
"raw": "component-emitter@~1.2.0",
|
||||
"rawSpec": "~1.2.0",
|
||||
"scope": null,
|
||||
"spec": ">=1.2.0 <1.3.0",
|
||||
"type": "range"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/superagent"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.2.1.tgz",
|
||||
"_shasum": "137918d6d78283f7df7a6b7c5a63e140e69425e6",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "component-emitter@~1.2.0",
|
||||
"_where": "/Users/williamcheng/Code/may2016/swagger-codegen/samples/client/petstore-security-test/javascript/node_modules/superagent",
|
||||
"bugs": {
|
||||
"url": "https://github.com/component/emitter/issues"
|
||||
},
|
||||
"component": {
|
||||
"scripts": {
|
||||
"emitter/index.js": "index.js"
|
||||
}
|
||||
},
|
||||
"dependencies": {},
|
||||
"description": "Event emitter",
|
||||
"devDependencies": {
|
||||
"mocha": "*",
|
||||
"should": "*"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "137918d6d78283f7df7a6b7c5a63e140e69425e6",
|
||||
"tarball": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.2.1.tgz"
|
||||
},
|
||||
"files": [
|
||||
"LICENSE",
|
||||
"index.js"
|
||||
],
|
||||
"gitHead": "187492ab8028c7221b589bdfd482b715149cd868",
|
||||
"homepage": "https://github.com/component/emitter#readme",
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "swatinem",
|
||||
"email": "arpad.borsos@googlemail.com"
|
||||
},
|
||||
{
|
||||
"name": "tootallnate",
|
||||
"email": "nathan@tootallnate.net"
|
||||
},
|
||||
{
|
||||
"name": "trevorgerhardt",
|
||||
"email": "trevorgerhardt@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "timaschew",
|
||||
"email": "timaschew@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "tjholowaychuk",
|
||||
"email": "tj@vision-media.ca"
|
||||
},
|
||||
{
|
||||
"name": "rauchg",
|
||||
"email": "rauchg@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "retrofox",
|
||||
"email": "rdsuarez@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "coreh",
|
||||
"email": "thecoreh@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "forbeslindesay",
|
||||
"email": "forbes@lindesay.co.uk"
|
||||
},
|
||||
{
|
||||
"name": "kelonye",
|
||||
"email": "kelonyemitchel@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "mattmueller",
|
||||
"email": "mattmuelle@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "yields",
|
||||
"email": "yields@icloud.com"
|
||||
},
|
||||
{
|
||||
"name": "anthonyshort",
|
||||
"email": "antshort@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "jongleberry",
|
||||
"email": "jonathanrichardong@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "ianstormtaylor",
|
||||
"email": "ian@ianstormtaylor.com"
|
||||
},
|
||||
{
|
||||
"name": "cristiandouce",
|
||||
"email": "cristian@gravityonmars.com"
|
||||
},
|
||||
{
|
||||
"name": "hughsk",
|
||||
"email": "hughskennedy@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "stagas",
|
||||
"email": "gstagas@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "amasad",
|
||||
"email": "amjad.masad@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "juliangruber",
|
||||
"email": "julian@juliangruber.com"
|
||||
},
|
||||
{
|
||||
"name": "calvinfo",
|
||||
"email": "calvin@calv.info"
|
||||
},
|
||||
{
|
||||
"name": "dominicbarnes",
|
||||
"email": "dominic@dbarnes.info"
|
||||
},
|
||||
{
|
||||
"name": "blakeembrey",
|
||||
"email": "hello@blakeembrey.com"
|
||||
},
|
||||
{
|
||||
"name": "timoxley",
|
||||
"email": "secoif@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "jonathanong",
|
||||
"email": "jonathanrichardong@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "queckezz",
|
||||
"email": "fabian.eichenberger@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "nami-doc",
|
||||
"email": "vendethiel@hotmail.fr"
|
||||
},
|
||||
{
|
||||
"name": "clintwood",
|
||||
"email": "clint@anotherway.co.za"
|
||||
},
|
||||
{
|
||||
"name": "thehydroimpulse",
|
||||
"email": "dnfagnan@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "stephenmathieson",
|
||||
"email": "me@stephenmathieson.com"
|
||||
},
|
||||
{
|
||||
"name": "dfcreative",
|
||||
"email": "df.creative@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "defunctzombie",
|
||||
"email": "shtylman@gmail.com"
|
||||
}
|
||||
],
|
||||
"name": "component-emitter",
|
||||
"optionalDependencies": {},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/component/emitter.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "make test"
|
||||
},
|
||||
"version": "1.2.1"
|
||||
}
|
4
samples/client/petstore-security-test/javascript/node_modules/concat-map/.travis.yml
generated
vendored
4
samples/client/petstore-security-test/javascript/node_modules/concat-map/.travis.yml
generated
vendored
@ -1,4 +0,0 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- 0.4
|
||||
- 0.6
|
18
samples/client/petstore-security-test/javascript/node_modules/concat-map/LICENSE
generated
vendored
18
samples/client/petstore-security-test/javascript/node_modules/concat-map/LICENSE
generated
vendored
@ -1,18 +0,0 @@
|
||||
This software is released under the MIT license:
|
||||
|
||||
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.
|
62
samples/client/petstore-security-test/javascript/node_modules/concat-map/README.markdown
generated
vendored
62
samples/client/petstore-security-test/javascript/node_modules/concat-map/README.markdown
generated
vendored
@ -1,62 +0,0 @@
|
||||
concat-map
|
||||
==========
|
||||
|
||||
Concatenative mapdashery.
|
||||
|
||||
[![browser support](http://ci.testling.com/substack/node-concat-map.png)](http://ci.testling.com/substack/node-concat-map)
|
||||
|
||||
[![build status](https://secure.travis-ci.org/substack/node-concat-map.png)](http://travis-ci.org/substack/node-concat-map)
|
||||
|
||||
example
|
||||
=======
|
||||
|
||||
``` js
|
||||
var concatMap = require('concat-map');
|
||||
var xs = [ 1, 2, 3, 4, 5, 6 ];
|
||||
var ys = concatMap(xs, function (x) {
|
||||
return x % 2 ? [ x - 0.1, x, x + 0.1 ] : [];
|
||||
});
|
||||
console.dir(ys);
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
```
|
||||
[ 0.9, 1, 1.1, 2.9, 3, 3.1, 4.9, 5, 5.1 ]
|
||||
```
|
||||
|
||||
methods
|
||||
=======
|
||||
|
||||
``` js
|
||||
var concatMap = require('concat-map')
|
||||
```
|
||||
|
||||
concatMap(xs, fn)
|
||||
-----------------
|
||||
|
||||
Return an array of concatenated elements by calling `fn(x, i)` for each element
|
||||
`x` and each index `i` in the array `xs`.
|
||||
|
||||
When `fn(x, i)` returns an array, its result will be concatenated with the
|
||||
result array. If `fn(x, i)` returns anything else, that value will be pushed
|
||||
onto the end of the result array.
|
||||
|
||||
install
|
||||
=======
|
||||
|
||||
With [npm](http://npmjs.org) do:
|
||||
|
||||
```
|
||||
npm install concat-map
|
||||
```
|
||||
|
||||
license
|
||||
=======
|
||||
|
||||
MIT
|
||||
|
||||
notes
|
||||
=====
|
||||
|
||||
This module was written while sitting high above the ground in a tree.
|
@ -1,6 +0,0 @@
|
||||
var concatMap = require('../');
|
||||
var xs = [ 1, 2, 3, 4, 5, 6 ];
|
||||
var ys = concatMap(xs, function (x) {
|
||||
return x % 2 ? [ x - 0.1, x, x + 0.1 ] : [];
|
||||
});
|
||||
console.dir(ys);
|
13
samples/client/petstore-security-test/javascript/node_modules/concat-map/index.js
generated
vendored
13
samples/client/petstore-security-test/javascript/node_modules/concat-map/index.js
generated
vendored
@ -1,13 +0,0 @@
|
||||
module.exports = function (xs, fn) {
|
||||
var res = [];
|
||||
for (var i = 0; i < xs.length; i++) {
|
||||
var x = fn(xs[i], i);
|
||||
if (isArray(x)) res.push.apply(res, x);
|
||||
else res.push(x);
|
||||
}
|
||||
return res;
|
||||
};
|
||||
|
||||
var isArray = Array.isArray || function (xs) {
|
||||
return Object.prototype.toString.call(xs) === '[object Array]';
|
||||
};
|
108
samples/client/petstore-security-test/javascript/node_modules/concat-map/package.json
generated
vendored
108
samples/client/petstore-security-test/javascript/node_modules/concat-map/package.json
generated
vendored
@ -1,108 +0,0 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"concat-map@0.0.1",
|
||||
"/Users/williamcheng/Code/may2016/swagger-codegen/samples/client/petstore-security-test/javascript/node_modules/brace-expansion"
|
||||
]
|
||||
],
|
||||
"_from": "concat-map@0.0.1",
|
||||
"_id": "concat-map@0.0.1",
|
||||
"_inCache": true,
|
||||
"_installable": true,
|
||||
"_location": "/concat-map",
|
||||
"_npmUser": {
|
||||
"email": "mail@substack.net",
|
||||
"name": "substack"
|
||||
},
|
||||
"_npmVersion": "1.3.21",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"name": "concat-map",
|
||||
"raw": "concat-map@0.0.1",
|
||||
"rawSpec": "0.0.1",
|
||||
"scope": null,
|
||||
"spec": "0.0.1",
|
||||
"type": "version"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/brace-expansion"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
|
||||
"_shasum": "d8a96bd77fd68df7793a73036a3ba0d5405d477b",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "concat-map@0.0.1",
|
||||
"_where": "/Users/williamcheng/Code/may2016/swagger-codegen/samples/client/petstore-security-test/javascript/node_modules/brace-expansion",
|
||||
"author": {
|
||||
"email": "mail@substack.net",
|
||||
"name": "James Halliday",
|
||||
"url": "http://substack.net"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/substack/node-concat-map/issues"
|
||||
},
|
||||
"dependencies": {},
|
||||
"description": "concatenative mapdashery",
|
||||
"devDependencies": {
|
||||
"tape": "~2.4.0"
|
||||
},
|
||||
"directories": {
|
||||
"example": "example",
|
||||
"test": "test"
|
||||
},
|
||||
"dist": {
|
||||
"shasum": "d8a96bd77fd68df7793a73036a3ba0d5405d477b",
|
||||
"tarball": "http://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz"
|
||||
},
|
||||
"homepage": "https://github.com/substack/node-concat-map",
|
||||
"keywords": [
|
||||
"concat",
|
||||
"concatMap",
|
||||
"functional",
|
||||
"higher-order",
|
||||
"map"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "substack",
|
||||
"email": "mail@substack.net"
|
||||
}
|
||||
],
|
||||
"name": "concat-map",
|
||||
"optionalDependencies": {},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/substack/node-concat-map.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "tape test/*.js"
|
||||
},
|
||||
"testling": {
|
||||
"browsers": {
|
||||
"chrome": [
|
||||
10,
|
||||
22
|
||||
],
|
||||
"ff": [
|
||||
10,
|
||||
15,
|
||||
3.5
|
||||
],
|
||||
"ie": [
|
||||
6,
|
||||
7,
|
||||
8,
|
||||
9
|
||||
],
|
||||
"opera": [
|
||||
12
|
||||
],
|
||||
"safari": [
|
||||
5.1
|
||||
]
|
||||
},
|
||||
"files": "test/*.js"
|
||||
},
|
||||
"version": "0.0.1"
|
||||
}
|
39
samples/client/petstore-security-test/javascript/node_modules/concat-map/test/map.js
generated
vendored
39
samples/client/petstore-security-test/javascript/node_modules/concat-map/test/map.js
generated
vendored
@ -1,39 +0,0 @@
|
||||
var concatMap = require('../');
|
||||
var test = require('tape');
|
||||
|
||||
test('empty or not', function (t) {
|
||||
var xs = [ 1, 2, 3, 4, 5, 6 ];
|
||||
var ixes = [];
|
||||
var ys = concatMap(xs, function (x, ix) {
|
||||
ixes.push(ix);
|
||||
return x % 2 ? [ x - 0.1, x, x + 0.1 ] : [];
|
||||
});
|
||||
t.same(ys, [ 0.9, 1, 1.1, 2.9, 3, 3.1, 4.9, 5, 5.1 ]);
|
||||
t.same(ixes, [ 0, 1, 2, 3, 4, 5 ]);
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('always something', function (t) {
|
||||
var xs = [ 'a', 'b', 'c', 'd' ];
|
||||
var ys = concatMap(xs, function (x) {
|
||||
return x === 'b' ? [ 'B', 'B', 'B' ] : [ x ];
|
||||
});
|
||||
t.same(ys, [ 'a', 'B', 'B', 'B', 'c', 'd' ]);
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('scalars', function (t) {
|
||||
var xs = [ 'a', 'b', 'c', 'd' ];
|
||||
var ys = concatMap(xs, function (x) {
|
||||
return x === 'b' ? [ 'B', 'B', 'B' ] : x;
|
||||
});
|
||||
t.same(ys, [ 'a', 'B', 'B', 'B', 'c', 'd' ]);
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('undefs', function (t) {
|
||||
var xs = [ 'a', 'b', 'c', 'd' ];
|
||||
var ys = concatMap(xs, function () {});
|
||||
t.same(ys, [ undefined, undefined, undefined, undefined ]);
|
||||
t.end();
|
||||
});
|
@ -1,14 +0,0 @@
|
||||
.DS_Store
|
||||
.monitor
|
||||
.*.swp
|
||||
.nodemonignore
|
||||
releases
|
||||
*.log
|
||||
*.err
|
||||
fleet.json
|
||||
public/browserify
|
||||
bin/*.json
|
||||
.bin
|
||||
build
|
||||
compile
|
||||
.lock-wscript
|
@ -1,14 +0,0 @@
|
||||
{
|
||||
"launchers": {
|
||||
"node": {
|
||||
"command": "npm test"
|
||||
}
|
||||
},
|
||||
"src_files": [
|
||||
"./**/*.js"
|
||||
],
|
||||
"before_tests": "npm run build",
|
||||
"on_exit": "rm test/static/bundle.js",
|
||||
"test_page": "test/static/index.html",
|
||||
"launch_in_dev": ["node", "phantomjs"]
|
||||
}
|
@ -1,4 +0,0 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- 0.8
|
||||
- 0.9
|
19
samples/client/petstore-security-test/javascript/node_modules/console-browserify/LICENCE
generated
vendored
19
samples/client/petstore-security-test/javascript/node_modules/console-browserify/LICENCE
generated
vendored
@ -1,19 +0,0 @@
|
||||
Copyright (c) 2012 Raynos.
|
||||
|
||||
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.
|
@ -1,33 +0,0 @@
|
||||
# console-browserify
|
||||
|
||||
[![build status][1]][2]
|
||||
|
||||
[![browser support][3]][4]
|
||||
|
||||
|
||||
Emulate console for all the browsers
|
||||
|
||||
## Example
|
||||
|
||||
```js
|
||||
var console = require("console-browserify")
|
||||
|
||||
console.log("hello world!")
|
||||
```
|
||||
|
||||
## Installation
|
||||
|
||||
`npm install console-browserify`
|
||||
|
||||
## Contributors
|
||||
|
||||
- Raynos
|
||||
|
||||
## MIT Licenced
|
||||
|
||||
|
||||
|
||||
[1]: https://secure.travis-ci.org/Raynos/console-browserify.png
|
||||
[2]: http://travis-ci.org/Raynos/console-browserify
|
||||
[3]: http://ci.testling.com/Raynos/console-browserify.png
|
||||
[4]: http://ci.testling.com/Raynos/console-browserify
|
@ -1,86 +0,0 @@
|
||||
/*global window, global*/
|
||||
var util = require("util")
|
||||
var assert = require("assert")
|
||||
var now = require("date-now")
|
||||
|
||||
var slice = Array.prototype.slice
|
||||
var console
|
||||
var times = {}
|
||||
|
||||
if (typeof global !== "undefined" && global.console) {
|
||||
console = global.console
|
||||
} else if (typeof window !== "undefined" && window.console) {
|
||||
console = window.console
|
||||
} else {
|
||||
console = {}
|
||||
}
|
||||
|
||||
var functions = [
|
||||
[log, "log"],
|
||||
[info, "info"],
|
||||
[warn, "warn"],
|
||||
[error, "error"],
|
||||
[time, "time"],
|
||||
[timeEnd, "timeEnd"],
|
||||
[trace, "trace"],
|
||||
[dir, "dir"],
|
||||
[consoleAssert, "assert"]
|
||||
]
|
||||
|
||||
for (var i = 0; i < functions.length; i++) {
|
||||
var tuple = functions[i]
|
||||
var f = tuple[0]
|
||||
var name = tuple[1]
|
||||
|
||||
if (!console[name]) {
|
||||
console[name] = f
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = console
|
||||
|
||||
function log() {}
|
||||
|
||||
function info() {
|
||||
console.log.apply(console, arguments)
|
||||
}
|
||||
|
||||
function warn() {
|
||||
console.log.apply(console, arguments)
|
||||
}
|
||||
|
||||
function error() {
|
||||
console.warn.apply(console, arguments)
|
||||
}
|
||||
|
||||
function time(label) {
|
||||
times[label] = now()
|
||||
}
|
||||
|
||||
function timeEnd(label) {
|
||||
var time = times[label]
|
||||
if (!time) {
|
||||
throw new Error("No such label: " + label)
|
||||
}
|
||||
|
||||
var duration = now() - time
|
||||
console.log(label + ": " + duration + "ms")
|
||||
}
|
||||
|
||||
function trace() {
|
||||
var err = new Error()
|
||||
err.name = "Trace"
|
||||
err.message = util.format.apply(null, arguments)
|
||||
console.error(err.stack)
|
||||
}
|
||||
|
||||
function dir(object) {
|
||||
console.log(util.inspect(object) + "\n")
|
||||
}
|
||||
|
||||
function consoleAssert(expression) {
|
||||
if (!expression) {
|
||||
var arr = slice.call(arguments, 1)
|
||||
assert.ok(false, util.format.apply(null, arr))
|
||||
}
|
||||
}
|
@ -1,113 +0,0 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"console-browserify@1.1.x",
|
||||
"/Users/williamcheng/Code/may2016/swagger-codegen/samples/client/petstore-security-test/javascript/node_modules/jshint"
|
||||
]
|
||||
],
|
||||
"_from": "console-browserify@>=1.1.0 <1.2.0",
|
||||
"_id": "console-browserify@1.1.0",
|
||||
"_inCache": true,
|
||||
"_installable": true,
|
||||
"_location": "/console-browserify",
|
||||
"_npmUser": {
|
||||
"email": "raynos2@gmail.com",
|
||||
"name": "raynos"
|
||||
},
|
||||
"_npmVersion": "1.4.6",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"name": "console-browserify",
|
||||
"raw": "console-browserify@1.1.x",
|
||||
"rawSpec": "1.1.x",
|
||||
"scope": null,
|
||||
"spec": ">=1.1.0 <1.2.0",
|
||||
"type": "range"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/jshint"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/console-browserify/-/console-browserify-1.1.0.tgz",
|
||||
"_shasum": "f0241c45730a9fc6323b206dbf38edc741d0bb10",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "console-browserify@1.1.x",
|
||||
"_where": "/Users/williamcheng/Code/may2016/swagger-codegen/samples/client/petstore-security-test/javascript/node_modules/jshint",
|
||||
"author": {
|
||||
"email": "raynos2@gmail.com",
|
||||
"name": "Raynos"
|
||||
},
|
||||
"bugs": {
|
||||
"email": "raynos2@gmail.com",
|
||||
"url": "https://github.com/Raynos/console-browserify/issues"
|
||||
},
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Raynos"
|
||||
}
|
||||
],
|
||||
"dependencies": {
|
||||
"date-now": "^0.1.4"
|
||||
},
|
||||
"description": "Emulate console for all the browsers",
|
||||
"devDependencies": {
|
||||
"jsonify": "0.0.0",
|
||||
"run-browser": "^1.3.0",
|
||||
"tap-dot": "^0.2.1",
|
||||
"tap-spec": "^0.1.8",
|
||||
"tape": "^2.12.3"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "f0241c45730a9fc6323b206dbf38edc741d0bb10",
|
||||
"tarball": "https://registry.npmjs.org/console-browserify/-/console-browserify-1.1.0.tgz"
|
||||
},
|
||||
"homepage": "https://github.com/Raynos/console-browserify",
|
||||
"keywords": [],
|
||||
"licenses": [
|
||||
{
|
||||
"type": "MIT",
|
||||
"url": "http://github.com/Raynos/console-browserify/raw/master/LICENSE"
|
||||
}
|
||||
],
|
||||
"main": "index",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "raynos",
|
||||
"email": "raynos2@gmail.com"
|
||||
}
|
||||
],
|
||||
"name": "console-browserify",
|
||||
"optionalDependencies": {},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/Raynos/console-browserify.git"
|
||||
},
|
||||
"scripts": {
|
||||
"browser": "run-browser test/index.js",
|
||||
"build": "browserify test/index.js -o test/static/bundle.js",
|
||||
"cover": "istanbul cover --report none --print detail ./test/index.js",
|
||||
"dot": "node ./test/index.js | tap-dot",
|
||||
"phantom": "run-browser test/index.js -b | tap-spec",
|
||||
"start": "node ./index.js",
|
||||
"test": "node ./test/index.js | tap-spec",
|
||||
"testem": "testem",
|
||||
"view-cover": "istanbul report html && google-chrome ./coverage/index.html"
|
||||
},
|
||||
"testling": {
|
||||
"browsers": [
|
||||
"android-browser/4.2..latest",
|
||||
"chrome/22..latest",
|
||||
"chrome/canary",
|
||||
"firefox/16..latest",
|
||||
"firefox/nightly",
|
||||
"ie/8..latest",
|
||||
"ipad/6.0..latest",
|
||||
"iphone/6.0..latest",
|
||||
"opera/12..latest",
|
||||
"opera/next",
|
||||
"safari/5.1..latest"
|
||||
],
|
||||
"files": "test/index.js"
|
||||
},
|
||||
"version": "1.1.0"
|
||||
}
|
@ -1,67 +0,0 @@
|
||||
var console = require("../index")
|
||||
var test = require("tape")
|
||||
|
||||
if (typeof window !== "undefined" && !window.JSON) {
|
||||
window.JSON = require("jsonify")
|
||||
}
|
||||
|
||||
test("console has expected methods", function (assert) {
|
||||
assert.ok(console.log)
|
||||
assert.ok(console.info)
|
||||
assert.ok(console.warn)
|
||||
assert.ok(console.dir)
|
||||
assert.ok(console.time, "time")
|
||||
assert.ok(console.timeEnd, "timeEnd")
|
||||
assert.ok(console.trace, "trace")
|
||||
assert.ok(console.assert)
|
||||
|
||||
assert.end()
|
||||
})
|
||||
|
||||
test("invoke console.log", function (assert) {
|
||||
console.log("test-log")
|
||||
|
||||
assert.end()
|
||||
})
|
||||
|
||||
test("invoke console.info", function (assert) {
|
||||
console.info("test-info")
|
||||
|
||||
assert.end()
|
||||
})
|
||||
|
||||
test("invoke console.warn", function (assert) {
|
||||
console.warn("test-warn")
|
||||
|
||||
assert.end()
|
||||
})
|
||||
|
||||
test("invoke console.time", function (assert) {
|
||||
console.time("label")
|
||||
|
||||
assert.end()
|
||||
})
|
||||
|
||||
test("invoke console.trace", function (assert) {
|
||||
console.trace("test-trace")
|
||||
|
||||
assert.end()
|
||||
})
|
||||
|
||||
test("invoke console.assert", function (assert) {
|
||||
console.assert(true)
|
||||
|
||||
assert.end()
|
||||
})
|
||||
|
||||
test("invoke console.dir", function (assert) {
|
||||
console.dir("test-dir")
|
||||
|
||||
assert.end()
|
||||
})
|
||||
|
||||
test("invoke console.timeEnd", function (assert) {
|
||||
console.timeEnd("label")
|
||||
|
||||
assert.end()
|
||||
})
|
@ -1,12 +0,0 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="x-ua-compatible" content="IE=8" >
|
||||
<title>TAPE Example</title>
|
||||
<script src="/testem.js"></script>
|
||||
<script src="test-adapter.js"></script>
|
||||
<script src="bundle.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
</body>
|
||||
</html>
|
@ -1,53 +0,0 @@
|
||||
(function () {
|
||||
var Testem = window.Testem
|
||||
var regex = /^((?:not )?ok) (\d+) (.+)$/
|
||||
|
||||
Testem.useCustomAdapter(tapAdapter)
|
||||
|
||||
function tapAdapter(socket){
|
||||
var results = {
|
||||
failed: 0
|
||||
, passed: 0
|
||||
, total: 0
|
||||
, tests: []
|
||||
}
|
||||
|
||||
socket.emit('tests-start')
|
||||
|
||||
Testem.handleConsoleMessage = function(msg){
|
||||
var m = msg.match(regex)
|
||||
if (m) {
|
||||
var passed = m[1] === 'ok'
|
||||
var test = {
|
||||
passed: passed ? 1 : 0,
|
||||
failed: passed ? 0 : 1,
|
||||
total: 1,
|
||||
id: m[2],
|
||||
name: m[3],
|
||||
items: []
|
||||
}
|
||||
|
||||
if (passed) {
|
||||
results.passed++
|
||||
} else {
|
||||
console.error("failure", m)
|
||||
|
||||
results.failed++
|
||||
}
|
||||
|
||||
results.total++
|
||||
|
||||
// console.log("emitted test", test)
|
||||
socket.emit('test-result', test)
|
||||
results.tests.push(test)
|
||||
} else if (msg === '# ok' || msg.match(/^# tests \d+/)){
|
||||
// console.log("emitted all test")
|
||||
socket.emit('all-test-results', results)
|
||||
}
|
||||
|
||||
// return false if you want to prevent the console message from
|
||||
// going to the console
|
||||
// return false
|
||||
}
|
||||
}
|
||||
}())
|
1
samples/client/petstore-security-test/javascript/node_modules/cookiejar/.npmignore
generated
vendored
1
samples/client/petstore-security-test/javascript/node_modules/cookiejar/.npmignore
generated
vendored
@ -1 +0,0 @@
|
||||
node_modules
|
9
samples/client/petstore-security-test/javascript/node_modules/cookiejar/LICENSE
generated
vendored
9
samples/client/petstore-security-test/javascript/node_modules/cookiejar/LICENSE
generated
vendored
@ -1,9 +0,0 @@
|
||||
The MIT License (MIT)
|
||||
Copyright (c) 2013 Bradley Meck
|
||||
|
||||
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.
|
||||
|
261
samples/client/petstore-security-test/javascript/node_modules/cookiejar/cookiejar.js
generated
vendored
261
samples/client/petstore-security-test/javascript/node_modules/cookiejar/cookiejar.js
generated
vendored
@ -1,261 +0,0 @@
|
||||
/* jshint node: true */
|
||||
(function () {
|
||||
"use strict";
|
||||
|
||||
function CookieAccessInfo(domain, path, secure, script) {
|
||||
if (this instanceof CookieAccessInfo) {
|
||||
this.domain = domain || undefined;
|
||||
this.path = path || "/";
|
||||
this.secure = !!secure;
|
||||
this.script = !!script;
|
||||
return this;
|
||||
}
|
||||
return new CookieAccessInfo(domain, path, secure, script);
|
||||
}
|
||||
exports.CookieAccessInfo = CookieAccessInfo;
|
||||
|
||||
function Cookie(cookiestr, request_domain, request_path) {
|
||||
if (cookiestr instanceof Cookie) {
|
||||
return cookiestr;
|
||||
}
|
||||
if (this instanceof Cookie) {
|
||||
this.name = null;
|
||||
this.value = null;
|
||||
this.expiration_date = Infinity;
|
||||
this.path = String(request_path || "/");
|
||||
this.explicit_path = false;
|
||||
this.domain = request_domain || null;
|
||||
this.explicit_domain = false;
|
||||
this.secure = false; //how to define default?
|
||||
this.noscript = false; //httponly
|
||||
if (cookiestr) {
|
||||
this.parse(cookiestr, request_domain, request_path);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
return new Cookie(cookiestr, request_domain, request_path);
|
||||
}
|
||||
exports.Cookie = Cookie;
|
||||
|
||||
Cookie.prototype.toString = function toString() {
|
||||
var str = [this.name + "=" + this.value];
|
||||
if (this.expiration_date !== Infinity) {
|
||||
str.push("expires=" + (new Date(this.expiration_date)).toGMTString());
|
||||
}
|
||||
if (this.domain) {
|
||||
str.push("domain=" + this.domain);
|
||||
}
|
||||
if (this.path) {
|
||||
str.push("path=" + this.path);
|
||||
}
|
||||
if (this.secure) {
|
||||
str.push("secure");
|
||||
}
|
||||
if (this.noscript) {
|
||||
str.push("httponly");
|
||||
}
|
||||
return str.join("; ");
|
||||
};
|
||||
|
||||
Cookie.prototype.toValueString = function toValueString() {
|
||||
return this.name + "=" + this.value;
|
||||
};
|
||||
|
||||
var cookie_str_splitter = /[:](?=\s*[a-zA-Z0-9_\-]+\s*[=])/g;
|
||||
Cookie.prototype.parse = function parse(str, request_domain, request_path) {
|
||||
if (this instanceof Cookie) {
|
||||
var parts = str.split(";").filter(function (value) {
|
||||
return !!value;
|
||||
}),
|
||||
pair = parts[0].match(/([^=]+)=([\s\S]*)/),
|
||||
key = pair[1],
|
||||
value = pair[2],
|
||||
i;
|
||||
this.name = key;
|
||||
this.value = value;
|
||||
|
||||
for (i = 1; i < parts.length; i += 1) {
|
||||
pair = parts[i].match(/([^=]+)(?:=([\s\S]*))?/);
|
||||
key = pair[1].trim().toLowerCase();
|
||||
value = pair[2];
|
||||
switch (key) {
|
||||
case "httponly":
|
||||
this.noscript = true;
|
||||
break;
|
||||
case "expires":
|
||||
this.expiration_date = value ?
|
||||
Number(Date.parse(value)) :
|
||||
Infinity;
|
||||
break;
|
||||
case "path":
|
||||
this.path = value ?
|
||||
value.trim() :
|
||||
"";
|
||||
this.explicit_path = true;
|
||||
break;
|
||||
case "domain":
|
||||
this.domain = value ?
|
||||
value.trim() :
|
||||
"";
|
||||
this.explicit_domain = !!this.domain;
|
||||
break;
|
||||
case "secure":
|
||||
this.secure = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!this.explicit_path) {
|
||||
this.path = request_path || "/";
|
||||
}
|
||||
if (!this.explicit_domain) {
|
||||
this.domain = request_domain;
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
return new Cookie().parse(str, request_domain, request_path);
|
||||
};
|
||||
|
||||
Cookie.prototype.matches = function matches(access_info) {
|
||||
if (this.noscript && access_info.script ||
|
||||
this.secure && !access_info.secure ||
|
||||
!this.collidesWith(access_info)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
Cookie.prototype.collidesWith = function collidesWith(access_info) {
|
||||
if ((this.path && !access_info.path) || (this.domain && !access_info.domain)) {
|
||||
return false;
|
||||
}
|
||||
if (this.path && access_info.path.indexOf(this.path) !== 0) {
|
||||
return false;
|
||||
}
|
||||
if (this.explicit_path && access_info.path.indexOf( this.path ) !== 0) {
|
||||
return false;
|
||||
}
|
||||
var access_domain = access_info.domain && access_info.domain.replace(/^[\.]/,'');
|
||||
var cookie_domain = this.domain && this.domain.replace(/^[\.]/,'');
|
||||
if (cookie_domain === access_domain) {
|
||||
return true;
|
||||
}
|
||||
if (cookie_domain) {
|
||||
if (!this.explicit_domain) {
|
||||
return false; // we already checked if the domains were exactly the same
|
||||
}
|
||||
var wildcard = access_domain.indexOf(cookie_domain);
|
||||
if (wildcard === -1 || wildcard !== access_domain.length - cookie_domain.length) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
function CookieJar() {
|
||||
var cookies, cookies_list, collidable_cookie;
|
||||
if (this instanceof CookieJar) {
|
||||
cookies = Object.create(null); //name: [Cookie]
|
||||
|
||||
this.setCookie = function setCookie(cookie, request_domain, request_path) {
|
||||
var remove, i;
|
||||
cookie = new Cookie(cookie, request_domain, request_path);
|
||||
//Delete the cookie if the set is past the current time
|
||||
remove = cookie.expiration_date <= Date.now();
|
||||
if (cookies[cookie.name] !== undefined) {
|
||||
cookies_list = cookies[cookie.name];
|
||||
for (i = 0; i < cookies_list.length; i += 1) {
|
||||
collidable_cookie = cookies_list[i];
|
||||
if (collidable_cookie.collidesWith(cookie)) {
|
||||
if (remove) {
|
||||
cookies_list.splice(i, 1);
|
||||
if (cookies_list.length === 0) {
|
||||
delete cookies[cookie.name];
|
||||
}
|
||||
return false;
|
||||
}
|
||||
cookies_list[i] = cookie;
|
||||
return cookie;
|
||||
}
|
||||
}
|
||||
if (remove) {
|
||||
return false;
|
||||
}
|
||||
cookies_list.push(cookie);
|
||||
return cookie;
|
||||
}
|
||||
if (remove) {
|
||||
return false;
|
||||
}
|
||||
cookies[cookie.name] = [cookie];
|
||||
return cookies[cookie.name];
|
||||
};
|
||||
//returns a cookie
|
||||
this.getCookie = function getCookie(cookie_name, access_info) {
|
||||
var cookie, i;
|
||||
cookies_list = cookies[cookie_name];
|
||||
if (!cookies_list) {
|
||||
return;
|
||||
}
|
||||
for (i = 0; i < cookies_list.length; i += 1) {
|
||||
cookie = cookies_list[i];
|
||||
if (cookie.expiration_date <= Date.now()) {
|
||||
if (cookies_list.length === 0) {
|
||||
delete cookies[cookie.name];
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
if (cookie.matches(access_info)) {
|
||||
return cookie;
|
||||
}
|
||||
}
|
||||
};
|
||||
//returns a list of cookies
|
||||
this.getCookies = function getCookies(access_info) {
|
||||
var matches = [], cookie_name, cookie;
|
||||
for (cookie_name in cookies) {
|
||||
cookie = this.getCookie(cookie_name, access_info);
|
||||
if (cookie) {
|
||||
matches.push(cookie);
|
||||
}
|
||||
}
|
||||
matches.toString = function toString() {
|
||||
return matches.join(":");
|
||||
};
|
||||
matches.toValueString = function toValueString() {
|
||||
return matches.map(function (c) {
|
||||
return c.toValueString();
|
||||
}).join(';');
|
||||
};
|
||||
return matches;
|
||||
};
|
||||
|
||||
return this;
|
||||
}
|
||||
return new CookieJar();
|
||||
}
|
||||
exports.CookieJar = CookieJar;
|
||||
|
||||
//returns list of cookies that were set correctly. Cookies that are expired and removed are not returned.
|
||||
CookieJar.prototype.setCookies = function setCookies(cookies, request_domain, request_path) {
|
||||
cookies = Array.isArray(cookies) ?
|
||||
cookies :
|
||||
cookies.split(cookie_str_splitter);
|
||||
var successful = [],
|
||||
i,
|
||||
cookie;
|
||||
cookies = cookies.map(function(item){
|
||||
return new Cookie(item, request_domain, request_path);
|
||||
});
|
||||
for (i = 0; i < cookies.length; i += 1) {
|
||||
cookie = cookies[i];
|
||||
if (this.setCookie(cookie, request_domain, request_path)) {
|
||||
successful.push(cookie);
|
||||
}
|
||||
}
|
||||
return successful;
|
||||
};
|
||||
}());
|
79
samples/client/petstore-security-test/javascript/node_modules/cookiejar/package.json
generated
vendored
79
samples/client/petstore-security-test/javascript/node_modules/cookiejar/package.json
generated
vendored
@ -1,79 +0,0 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"cookiejar@2.0.6",
|
||||
"/Users/williamcheng/Code/may2016/swagger-codegen/samples/client/petstore-security-test/javascript/node_modules/superagent"
|
||||
]
|
||||
],
|
||||
"_from": "cookiejar@2.0.6",
|
||||
"_id": "cookiejar@2.0.6",
|
||||
"_inCache": true,
|
||||
"_installable": true,
|
||||
"_location": "/cookiejar",
|
||||
"_nodeVersion": "6.0.0-pre",
|
||||
"_npmUser": {
|
||||
"email": "bradley.meck@gmail.com",
|
||||
"name": "bradleymeck"
|
||||
},
|
||||
"_npmVersion": "3.3.12",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"name": "cookiejar",
|
||||
"raw": "cookiejar@2.0.6",
|
||||
"rawSpec": "2.0.6",
|
||||
"scope": null,
|
||||
"spec": "2.0.6",
|
||||
"type": "version"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/superagent"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/cookiejar/-/cookiejar-2.0.6.tgz",
|
||||
"_shasum": "0abf356ad00d1c5a219d88d44518046dd026acfe",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "cookiejar@2.0.6",
|
||||
"_where": "/Users/williamcheng/Code/may2016/swagger-codegen/samples/client/petstore-security-test/javascript/node_modules/superagent",
|
||||
"author": {
|
||||
"name": "bradleymeck"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/bmeck/node-cookiejar/issues"
|
||||
},
|
||||
"dependencies": {},
|
||||
"description": "simple persistent cookiejar system",
|
||||
"devDependencies": {
|
||||
"jshint": "^2.8.0"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "0abf356ad00d1c5a219d88d44518046dd026acfe",
|
||||
"tarball": "http://registry.npmjs.org/cookiejar/-/cookiejar-2.0.6.tgz"
|
||||
},
|
||||
"gitHead": "3c3d43c39dc3c6928354873d43f3ec2895e26937",
|
||||
"homepage": "https://github.com/bmeck/node-cookiejar#readme",
|
||||
"jshintConfig": {
|
||||
"node": true
|
||||
},
|
||||
"license": "MIT",
|
||||
"main": "cookiejar.js",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "andyburke",
|
||||
"email": "aburke@bitflood.org"
|
||||
},
|
||||
{
|
||||
"name": "bradleymeck",
|
||||
"email": "bradley.meck@gmail.com"
|
||||
}
|
||||
],
|
||||
"name": "cookiejar",
|
||||
"optionalDependencies": {},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/bmeck/node-cookiejar.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "node tests/test.js"
|
||||
},
|
||||
"version": "2.0.6"
|
||||
}
|
57
samples/client/petstore-security-test/javascript/node_modules/cookiejar/readme.md
generated
vendored
57
samples/client/petstore-security-test/javascript/node_modules/cookiejar/readme.md
generated
vendored
@ -1,57 +0,0 @@
|
||||
#CookieJar
|
||||
|
||||
Simple robust cookie library
|
||||
|
||||
##Exports
|
||||
|
||||
###CookieAccessInfo(domain,path,secure,script)
|
||||
|
||||
class to determine matching qualities of a cookie
|
||||
|
||||
#####Properties
|
||||
|
||||
* String domain - domain to match
|
||||
* String path - path to match
|
||||
* Boolean secure - access is secure (ssl generally)
|
||||
* Boolean script - access is from a script
|
||||
|
||||
|
||||
###Cookie(cookiestr_or_cookie, request_domain, request_path)
|
||||
|
||||
turns input into a Cookie (singleton if given a Cookie)
|
||||
the `request_domain` argument is used to default the domain if it is not explicit in the cookie string
|
||||
the `request_path` argument is used to set the path if it is not explicit in a cookie String.
|
||||
|
||||
explicit domains/paths will cascade, implied domains/paths must *exactly* match (see http://en.wikipedia.org/wiki/HTTP_cookie#Domain_and_Pat)
|
||||
|
||||
#####Properties
|
||||
|
||||
* String name - name of the cookie
|
||||
* String value - string associated with the cookie
|
||||
* String domain - domain to match (on a cookie a '.' at the start means a wildcard matching anything ending in the rest)
|
||||
* Boolean explicit_domain - if the domain was explicitly set via the cookie string
|
||||
* String path - base path to match (matches any path starting with this '/' is root)
|
||||
* Boolean explicit_path - if the path was explicitly set via the cookie string
|
||||
* Boolean noscript - if it should be kept from scripts
|
||||
* Boolean secure - should it only be transmitted over secure means
|
||||
* Number expiration_date - number of millis since 1970 at which this should be removed
|
||||
|
||||
#####Methods
|
||||
|
||||
* String toString() - the __set-cookie:__ string for this cookie
|
||||
* String toValueString() - the __cookie:__ string for this cookie
|
||||
* Cookie parse(cookiestr, request_domain, request_path) - parses the string onto this cookie or a new one if called directly
|
||||
* Boolean matches(access_info) - returns true if the access_info allows retrieval of this cookie
|
||||
* Boolean collidesWith(cookie) - returns true if the cookies cannot exist in the same space (domain and path match)
|
||||
|
||||
|
||||
###CookieJar()
|
||||
|
||||
class to hold numerous cookies from multiple domains correctly
|
||||
|
||||
#####Methods
|
||||
|
||||
* Cookie setCookie(cookie, request_domain, request_path) - add a cookie to the jar
|
||||
* Cookie[] setCookies(cookiestr_or_list, request_domain, request_path) - add a large number of cookies to the jar
|
||||
* Cookie getCookie(cookie_name,access_info) - get a cookie with the name and access_info matching
|
||||
* Cookie[] getCookies(access_info) - grab all cookies matching this access_info
|
82
samples/client/petstore-security-test/javascript/node_modules/cookiejar/tests/test.js
generated
vendored
82
samples/client/petstore-security-test/javascript/node_modules/cookiejar/tests/test.js
generated
vendored
@ -1,82 +0,0 @@
|
||||
#!/usr/bin/env node
|
||||
var Cookie=require("../cookiejar"),
|
||||
CookieAccessInfo = Cookie.CookieAccessInfo,
|
||||
CookieJar = Cookie.CookieJar,
|
||||
Cookie = Cookie.Cookie;
|
||||
|
||||
var assert = require('assert');
|
||||
|
||||
// Test Cookie
|
||||
var cookie = new Cookie("a=1;domain=.test.com;path=/");
|
||||
assert.equal(cookie.name, "a");
|
||||
assert.equal(cookie.value, "1");
|
||||
assert.equal(cookie.domain, ".test.com");
|
||||
assert.equal(cookie.path, "/");
|
||||
assert.equal(cookie.secure, false);
|
||||
assert.equal(cookie.expiration_date, Infinity);
|
||||
|
||||
assert.deepEqual(cookie, new Cookie("a=1;domain=.test.com;path=/"));
|
||||
assert.ok(cookie.collidesWith(new Cookie("a=1;domain=.test.com;path=/")));
|
||||
|
||||
var cookie = new Cookie("a=1;path=/", ".test.com");
|
||||
assert.equal(cookie.domain, ".test.com");
|
||||
|
||||
|
||||
// Test CookieJar
|
||||
var test_jar = CookieJar();
|
||||
test_jar.setCookies(
|
||||
"a=1;domain=.test.com;path=/"
|
||||
+":b=2;domain=test.com;path=/"
|
||||
+":c=3;domain=test.com;path=/;expires=January 1, 1970");
|
||||
var cookies=test_jar.getCookies(CookieAccessInfo("test.com","/"))
|
||||
assert.equal(cookies.length, 2, "Expires on setCookies fail\n" + cookies.toString());
|
||||
assert.equal(cookies.toValueString(), 'a=1;b=2', "Cannot get value string of multiple cookies");
|
||||
|
||||
cookies=test_jar.getCookies(CookieAccessInfo("www.test.com","/"))
|
||||
assert.equal(cookies.length, 2, "Wildcard domain fail\n" + cookies.toString());
|
||||
|
||||
test_jar.setCookies("b=2;domain=test.com;path=/;expires=January 1, 1970");
|
||||
cookies=test_jar.getCookies(CookieAccessInfo("test.com","/"))
|
||||
assert.equal(cookies.length, 1, "Delete cookie fail\n" + cookies.toString());
|
||||
assert.equal(String(test_jar.getCookies(CookieAccessInfo("test.com","/"))), "a=1; domain=.test.com; path=/");
|
||||
|
||||
cookie=Cookie("a=1;domain=test.com;path=/;HttpOnly");
|
||||
assert.ok(cookie.noscript, "HttpOnly flag parsing failed\n" + cookie.toString());
|
||||
|
||||
var test_jar = CookieJar();
|
||||
test_jar.setCookies([
|
||||
"a=1;domain=.test.com;path=/"
|
||||
, "a=1;domain=.test.com;path=/"
|
||||
, "a=2;domain=.test.com;path=/"
|
||||
, "b=3;domain=.test.com;path=/"]);
|
||||
var cookies=test_jar.getCookies(CookieAccessInfo("test.com","/"))
|
||||
assert.equal(cookies.length, 2);
|
||||
assert.equal(cookies[0].value, 2);
|
||||
|
||||
// Test Ignore Trailing Semicolons (Github Issue #6)
|
||||
var cookie = new Cookie("a=1;domain=.test.com;path=/;;;;");
|
||||
assert.equal(cookie.name, "a");
|
||||
assert.equal(cookie.value, "1");
|
||||
assert.equal(cookie.domain, ".test.com");
|
||||
assert.equal(cookie.path, "/");
|
||||
assert.deepEqual(cookie, new Cookie("a=1;domain=.test.com;path=/"));
|
||||
|
||||
// Test request_path and request_domain
|
||||
test_jar.setCookie(new Cookie("sub=4;path=/", "test.com"));
|
||||
var cookie = test_jar.getCookie("sub", CookieAccessInfo("sub.test.com", "/"));
|
||||
assert.equal(cookie, undefined);
|
||||
|
||||
var cookie = test_jar.getCookie("sub", CookieAccessInfo("test.com", "/"));
|
||||
assert.equal(cookie.name, "sub");
|
||||
assert.equal(cookie.domain, "test.com");
|
||||
|
||||
test_jar.setCookie(new Cookie("sub=4;path=/accounts", "test.com", "/accounts"));
|
||||
var cookie = test_jar.getCookie("sub", CookieAccessInfo("test.com", "/foo"));
|
||||
assert.equal(cookie, undefined);
|
||||
|
||||
var cookie = test_jar.getCookie("sub", CookieAccessInfo("test.com", "/accounts"));
|
||||
assert.equal(cookie.path, "/accounts");
|
||||
|
||||
test_jar.setCookie(new Cookie("sub=5;path=/", "test.com", "/accounts"));
|
||||
var cookies = test_jar.getCookies(CookieAccessInfo("test.com"));
|
||||
assert.equal(cookies.length, 3);
|
19
samples/client/petstore-security-test/javascript/node_modules/core-util-is/LICENSE
generated
vendored
19
samples/client/petstore-security-test/javascript/node_modules/core-util-is/LICENSE
generated
vendored
@ -1,19 +0,0 @@
|
||||
Copyright Node.js contributors. All rights reserved.
|
||||
|
||||
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.
|
3
samples/client/petstore-security-test/javascript/node_modules/core-util-is/README.md
generated
vendored
3
samples/client/petstore-security-test/javascript/node_modules/core-util-is/README.md
generated
vendored
@ -1,3 +0,0 @@
|
||||
# core-util-is
|
||||
|
||||
The `util.is*` functions introduced in Node v0.12.
|
604
samples/client/petstore-security-test/javascript/node_modules/core-util-is/float.patch
generated
vendored
604
samples/client/petstore-security-test/javascript/node_modules/core-util-is/float.patch
generated
vendored
@ -1,604 +0,0 @@
|
||||
diff --git a/lib/util.js b/lib/util.js
|
||||
index a03e874..9074e8e 100644
|
||||
--- a/lib/util.js
|
||||
+++ b/lib/util.js
|
||||
@@ -19,430 +19,6 @@
|
||||
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||||
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
-var formatRegExp = /%[sdj%]/g;
|
||||
-exports.format = function(f) {
|
||||
- if (!isString(f)) {
|
||||
- var objects = [];
|
||||
- for (var i = 0; i < arguments.length; i++) {
|
||||
- objects.push(inspect(arguments[i]));
|
||||
- }
|
||||
- return objects.join(' ');
|
||||
- }
|
||||
-
|
||||
- var i = 1;
|
||||
- var args = arguments;
|
||||
- var len = args.length;
|
||||
- var str = String(f).replace(formatRegExp, function(x) {
|
||||
- if (x === '%%') return '%';
|
||||
- if (i >= len) return x;
|
||||
- switch (x) {
|
||||
- case '%s': return String(args[i++]);
|
||||
- case '%d': return Number(args[i++]);
|
||||
- case '%j':
|
||||
- try {
|
||||
- return JSON.stringify(args[i++]);
|
||||
- } catch (_) {
|
||||
- return '[Circular]';
|
||||
- }
|
||||
- default:
|
||||
- return x;
|
||||
- }
|
||||
- });
|
||||
- for (var x = args[i]; i < len; x = args[++i]) {
|
||||
- if (isNull(x) || !isObject(x)) {
|
||||
- str += ' ' + x;
|
||||
- } else {
|
||||
- str += ' ' + inspect(x);
|
||||
- }
|
||||
- }
|
||||
- return str;
|
||||
-};
|
||||
-
|
||||
-
|
||||
-// Mark that a method should not be used.
|
||||
-// Returns a modified function which warns once by default.
|
||||
-// If --no-deprecation is set, then it is a no-op.
|
||||
-exports.deprecate = function(fn, msg) {
|
||||
- // Allow for deprecating things in the process of starting up.
|
||||
- if (isUndefined(global.process)) {
|
||||
- return function() {
|
||||
- return exports.deprecate(fn, msg).apply(this, arguments);
|
||||
- };
|
||||
- }
|
||||
-
|
||||
- if (process.noDeprecation === true) {
|
||||
- return fn;
|
||||
- }
|
||||
-
|
||||
- var warned = false;
|
||||
- function deprecated() {
|
||||
- if (!warned) {
|
||||
- if (process.throwDeprecation) {
|
||||
- throw new Error(msg);
|
||||
- } else if (process.traceDeprecation) {
|
||||
- console.trace(msg);
|
||||
- } else {
|
||||
- console.error(msg);
|
||||
- }
|
||||
- warned = true;
|
||||
- }
|
||||
- return fn.apply(this, arguments);
|
||||
- }
|
||||
-
|
||||
- return deprecated;
|
||||
-};
|
||||
-
|
||||
-
|
||||
-var debugs = {};
|
||||
-var debugEnviron;
|
||||
-exports.debuglog = function(set) {
|
||||
- if (isUndefined(debugEnviron))
|
||||
- debugEnviron = process.env.NODE_DEBUG || '';
|
||||
- set = set.toUpperCase();
|
||||
- if (!debugs[set]) {
|
||||
- if (new RegExp('\\b' + set + '\\b', 'i').test(debugEnviron)) {
|
||||
- var pid = process.pid;
|
||||
- debugs[set] = function() {
|
||||
- var msg = exports.format.apply(exports, arguments);
|
||||
- console.error('%s %d: %s', set, pid, msg);
|
||||
- };
|
||||
- } else {
|
||||
- debugs[set] = function() {};
|
||||
- }
|
||||
- }
|
||||
- return debugs[set];
|
||||
-};
|
||||
-
|
||||
-
|
||||
-/**
|
||||
- * Echos the value of a value. Trys to print the value out
|
||||
- * in the best way possible given the different types.
|
||||
- *
|
||||
- * @param {Object} obj The object to print out.
|
||||
- * @param {Object} opts Optional options object that alters the output.
|
||||
- */
|
||||
-/* legacy: obj, showHidden, depth, colors*/
|
||||
-function inspect(obj, opts) {
|
||||
- // default options
|
||||
- var ctx = {
|
||||
- seen: [],
|
||||
- stylize: stylizeNoColor
|
||||
- };
|
||||
- // legacy...
|
||||
- if (arguments.length >= 3) ctx.depth = arguments[2];
|
||||
- if (arguments.length >= 4) ctx.colors = arguments[3];
|
||||
- if (isBoolean(opts)) {
|
||||
- // legacy...
|
||||
- ctx.showHidden = opts;
|
||||
- } else if (opts) {
|
||||
- // got an "options" object
|
||||
- exports._extend(ctx, opts);
|
||||
- }
|
||||
- // set default options
|
||||
- if (isUndefined(ctx.showHidden)) ctx.showHidden = false;
|
||||
- if (isUndefined(ctx.depth)) ctx.depth = 2;
|
||||
- if (isUndefined(ctx.colors)) ctx.colors = false;
|
||||
- if (isUndefined(ctx.customInspect)) ctx.customInspect = true;
|
||||
- if (ctx.colors) ctx.stylize = stylizeWithColor;
|
||||
- return formatValue(ctx, obj, ctx.depth);
|
||||
-}
|
||||
-exports.inspect = inspect;
|
||||
-
|
||||
-
|
||||
-// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics
|
||||
-inspect.colors = {
|
||||
- 'bold' : [1, 22],
|
||||
- 'italic' : [3, 23],
|
||||
- 'underline' : [4, 24],
|
||||
- 'inverse' : [7, 27],
|
||||
- 'white' : [37, 39],
|
||||
- 'grey' : [90, 39],
|
||||
- 'black' : [30, 39],
|
||||
- 'blue' : [34, 39],
|
||||
- 'cyan' : [36, 39],
|
||||
- 'green' : [32, 39],
|
||||
- 'magenta' : [35, 39],
|
||||
- 'red' : [31, 39],
|
||||
- 'yellow' : [33, 39]
|
||||
-};
|
||||
-
|
||||
-// Don't use 'blue' not visible on cmd.exe
|
||||
-inspect.styles = {
|
||||
- 'special': 'cyan',
|
||||
- 'number': 'yellow',
|
||||
- 'boolean': 'yellow',
|
||||
- 'undefined': 'grey',
|
||||
- 'null': 'bold',
|
||||
- 'string': 'green',
|
||||
- 'date': 'magenta',
|
||||
- // "name": intentionally not styling
|
||||
- 'regexp': 'red'
|
||||
-};
|
||||
-
|
||||
-
|
||||
-function stylizeWithColor(str, styleType) {
|
||||
- var style = inspect.styles[styleType];
|
||||
-
|
||||
- if (style) {
|
||||
- return '\u001b[' + inspect.colors[style][0] + 'm' + str +
|
||||
- '\u001b[' + inspect.colors[style][1] + 'm';
|
||||
- } else {
|
||||
- return str;
|
||||
- }
|
||||
-}
|
||||
-
|
||||
-
|
||||
-function stylizeNoColor(str, styleType) {
|
||||
- return str;
|
||||
-}
|
||||
-
|
||||
-
|
||||
-function arrayToHash(array) {
|
||||
- var hash = {};
|
||||
-
|
||||
- array.forEach(function(val, idx) {
|
||||
- hash[val] = true;
|
||||
- });
|
||||
-
|
||||
- return hash;
|
||||
-}
|
||||
-
|
||||
-
|
||||
-function formatValue(ctx, value, recurseTimes) {
|
||||
- // Provide a hook for user-specified inspect functions.
|
||||
- // Check that value is an object with an inspect function on it
|
||||
- if (ctx.customInspect &&
|
||||
- value &&
|
||||
- isFunction(value.inspect) &&
|
||||
- // Filter out the util module, it's inspect function is special
|
||||
- value.inspect !== exports.inspect &&
|
||||
- // Also filter out any prototype objects using the circular check.
|
||||
- !(value.constructor && value.constructor.prototype === value)) {
|
||||
- var ret = value.inspect(recurseTimes, ctx);
|
||||
- if (!isString(ret)) {
|
||||
- ret = formatValue(ctx, ret, recurseTimes);
|
||||
- }
|
||||
- return ret;
|
||||
- }
|
||||
-
|
||||
- // Primitive types cannot have properties
|
||||
- var primitive = formatPrimitive(ctx, value);
|
||||
- if (primitive) {
|
||||
- return primitive;
|
||||
- }
|
||||
-
|
||||
- // Look up the keys of the object.
|
||||
- var keys = Object.keys(value);
|
||||
- var visibleKeys = arrayToHash(keys);
|
||||
-
|
||||
- if (ctx.showHidden) {
|
||||
- keys = Object.getOwnPropertyNames(value);
|
||||
- }
|
||||
-
|
||||
- // Some type of object without properties can be shortcutted.
|
||||
- if (keys.length === 0) {
|
||||
- if (isFunction(value)) {
|
||||
- var name = value.name ? ': ' + value.name : '';
|
||||
- return ctx.stylize('[Function' + name + ']', 'special');
|
||||
- }
|
||||
- if (isRegExp(value)) {
|
||||
- return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
|
||||
- }
|
||||
- if (isDate(value)) {
|
||||
- return ctx.stylize(Date.prototype.toString.call(value), 'date');
|
||||
- }
|
||||
- if (isError(value)) {
|
||||
- return formatError(value);
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- var base = '', array = false, braces = ['{', '}'];
|
||||
-
|
||||
- // Make Array say that they are Array
|
||||
- if (isArray(value)) {
|
||||
- array = true;
|
||||
- braces = ['[', ']'];
|
||||
- }
|
||||
-
|
||||
- // Make functions say that they are functions
|
||||
- if (isFunction(value)) {
|
||||
- var n = value.name ? ': ' + value.name : '';
|
||||
- base = ' [Function' + n + ']';
|
||||
- }
|
||||
-
|
||||
- // Make RegExps say that they are RegExps
|
||||
- if (isRegExp(value)) {
|
||||
- base = ' ' + RegExp.prototype.toString.call(value);
|
||||
- }
|
||||
-
|
||||
- // Make dates with properties first say the date
|
||||
- if (isDate(value)) {
|
||||
- base = ' ' + Date.prototype.toUTCString.call(value);
|
||||
- }
|
||||
-
|
||||
- // Make error with message first say the error
|
||||
- if (isError(value)) {
|
||||
- base = ' ' + formatError(value);
|
||||
- }
|
||||
-
|
||||
- if (keys.length === 0 && (!array || value.length == 0)) {
|
||||
- return braces[0] + base + braces[1];
|
||||
- }
|
||||
-
|
||||
- if (recurseTimes < 0) {
|
||||
- if (isRegExp(value)) {
|
||||
- return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
|
||||
- } else {
|
||||
- return ctx.stylize('[Object]', 'special');
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- ctx.seen.push(value);
|
||||
-
|
||||
- var output;
|
||||
- if (array) {
|
||||
- output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);
|
||||
- } else {
|
||||
- output = keys.map(function(key) {
|
||||
- return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);
|
||||
- });
|
||||
- }
|
||||
-
|
||||
- ctx.seen.pop();
|
||||
-
|
||||
- return reduceToSingleString(output, base, braces);
|
||||
-}
|
||||
-
|
||||
-
|
||||
-function formatPrimitive(ctx, value) {
|
||||
- if (isUndefined(value))
|
||||
- return ctx.stylize('undefined', 'undefined');
|
||||
- if (isString(value)) {
|
||||
- var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '')
|
||||
- .replace(/'/g, "\\'")
|
||||
- .replace(/\\"/g, '"') + '\'';
|
||||
- return ctx.stylize(simple, 'string');
|
||||
- }
|
||||
- if (isNumber(value)) {
|
||||
- // Format -0 as '-0'. Strict equality won't distinguish 0 from -0,
|
||||
- // so instead we use the fact that 1 / -0 < 0 whereas 1 / 0 > 0 .
|
||||
- if (value === 0 && 1 / value < 0)
|
||||
- return ctx.stylize('-0', 'number');
|
||||
- return ctx.stylize('' + value, 'number');
|
||||
- }
|
||||
- if (isBoolean(value))
|
||||
- return ctx.stylize('' + value, 'boolean');
|
||||
- // For some reason typeof null is "object", so special case here.
|
||||
- if (isNull(value))
|
||||
- return ctx.stylize('null', 'null');
|
||||
-}
|
||||
-
|
||||
-
|
||||
-function formatError(value) {
|
||||
- return '[' + Error.prototype.toString.call(value) + ']';
|
||||
-}
|
||||
-
|
||||
-
|
||||
-function formatArray(ctx, value, recurseTimes, visibleKeys, keys) {
|
||||
- var output = [];
|
||||
- for (var i = 0, l = value.length; i < l; ++i) {
|
||||
- if (hasOwnProperty(value, String(i))) {
|
||||
- output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
|
||||
- String(i), true));
|
||||
- } else {
|
||||
- output.push('');
|
||||
- }
|
||||
- }
|
||||
- keys.forEach(function(key) {
|
||||
- if (!key.match(/^\d+$/)) {
|
||||
- output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
|
||||
- key, true));
|
||||
- }
|
||||
- });
|
||||
- return output;
|
||||
-}
|
||||
-
|
||||
-
|
||||
-function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {
|
||||
- var name, str, desc;
|
||||
- desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] };
|
||||
- if (desc.get) {
|
||||
- if (desc.set) {
|
||||
- str = ctx.stylize('[Getter/Setter]', 'special');
|
||||
- } else {
|
||||
- str = ctx.stylize('[Getter]', 'special');
|
||||
- }
|
||||
- } else {
|
||||
- if (desc.set) {
|
||||
- str = ctx.stylize('[Setter]', 'special');
|
||||
- }
|
||||
- }
|
||||
- if (!hasOwnProperty(visibleKeys, key)) {
|
||||
- name = '[' + key + ']';
|
||||
- }
|
||||
- if (!str) {
|
||||
- if (ctx.seen.indexOf(desc.value) < 0) {
|
||||
- if (isNull(recurseTimes)) {
|
||||
- str = formatValue(ctx, desc.value, null);
|
||||
- } else {
|
||||
- str = formatValue(ctx, desc.value, recurseTimes - 1);
|
||||
- }
|
||||
- if (str.indexOf('\n') > -1) {
|
||||
- if (array) {
|
||||
- str = str.split('\n').map(function(line) {
|
||||
- return ' ' + line;
|
||||
- }).join('\n').substr(2);
|
||||
- } else {
|
||||
- str = '\n' + str.split('\n').map(function(line) {
|
||||
- return ' ' + line;
|
||||
- }).join('\n');
|
||||
- }
|
||||
- }
|
||||
- } else {
|
||||
- str = ctx.stylize('[Circular]', 'special');
|
||||
- }
|
||||
- }
|
||||
- if (isUndefined(name)) {
|
||||
- if (array && key.match(/^\d+$/)) {
|
||||
- return str;
|
||||
- }
|
||||
- name = JSON.stringify('' + key);
|
||||
- if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) {
|
||||
- name = name.substr(1, name.length - 2);
|
||||
- name = ctx.stylize(name, 'name');
|
||||
- } else {
|
||||
- name = name.replace(/'/g, "\\'")
|
||||
- .replace(/\\"/g, '"')
|
||||
- .replace(/(^"|"$)/g, "'");
|
||||
- name = ctx.stylize(name, 'string');
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- return name + ': ' + str;
|
||||
-}
|
||||
-
|
||||
-
|
||||
-function reduceToSingleString(output, base, braces) {
|
||||
- var numLinesEst = 0;
|
||||
- var length = output.reduce(function(prev, cur) {
|
||||
- numLinesEst++;
|
||||
- if (cur.indexOf('\n') >= 0) numLinesEst++;
|
||||
- return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1;
|
||||
- }, 0);
|
||||
-
|
||||
- if (length > 60) {
|
||||
- return braces[0] +
|
||||
- (base === '' ? '' : base + '\n ') +
|
||||
- ' ' +
|
||||
- output.join(',\n ') +
|
||||
- ' ' +
|
||||
- braces[1];
|
||||
- }
|
||||
-
|
||||
- return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];
|
||||
-}
|
||||
-
|
||||
-
|
||||
// NOTE: These type checking functions intentionally don't use `instanceof`
|
||||
// because it is fragile and can be easily faked with `Object.create()`.
|
||||
function isArray(ar) {
|
||||
@@ -522,166 +98,10 @@ function isPrimitive(arg) {
|
||||
exports.isPrimitive = isPrimitive;
|
||||
|
||||
function isBuffer(arg) {
|
||||
- return arg instanceof Buffer;
|
||||
+ return Buffer.isBuffer(arg);
|
||||
}
|
||||
exports.isBuffer = isBuffer;
|
||||
|
||||
function objectToString(o) {
|
||||
return Object.prototype.toString.call(o);
|
||||
-}
|
||||
-
|
||||
-
|
||||
-function pad(n) {
|
||||
- return n < 10 ? '0' + n.toString(10) : n.toString(10);
|
||||
-}
|
||||
-
|
||||
-
|
||||
-var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep',
|
||||
- 'Oct', 'Nov', 'Dec'];
|
||||
-
|
||||
-// 26 Feb 16:19:34
|
||||
-function timestamp() {
|
||||
- var d = new Date();
|
||||
- var time = [pad(d.getHours()),
|
||||
- pad(d.getMinutes()),
|
||||
- pad(d.getSeconds())].join(':');
|
||||
- return [d.getDate(), months[d.getMonth()], time].join(' ');
|
||||
-}
|
||||
-
|
||||
-
|
||||
-// log is just a thin wrapper to console.log that prepends a timestamp
|
||||
-exports.log = function() {
|
||||
- console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments));
|
||||
-};
|
||||
-
|
||||
-
|
||||
-/**
|
||||
- * Inherit the prototype methods from one constructor into another.
|
||||
- *
|
||||
- * The Function.prototype.inherits from lang.js rewritten as a standalone
|
||||
- * function (not on Function.prototype). NOTE: If this file is to be loaded
|
||||
- * during bootstrapping this function needs to be rewritten using some native
|
||||
- * functions as prototype setup using normal JavaScript does not work as
|
||||
- * expected during bootstrapping (see mirror.js in r114903).
|
||||
- *
|
||||
- * @param {function} ctor Constructor function which needs to inherit the
|
||||
- * prototype.
|
||||
- * @param {function} superCtor Constructor function to inherit prototype from.
|
||||
- */
|
||||
-exports.inherits = function(ctor, superCtor) {
|
||||
- ctor.super_ = superCtor;
|
||||
- ctor.prototype = Object.create(superCtor.prototype, {
|
||||
- constructor: {
|
||||
- value: ctor,
|
||||
- enumerable: false,
|
||||
- writable: true,
|
||||
- configurable: true
|
||||
- }
|
||||
- });
|
||||
-};
|
||||
-
|
||||
-exports._extend = function(origin, add) {
|
||||
- // Don't do anything if add isn't an object
|
||||
- if (!add || !isObject(add)) return origin;
|
||||
-
|
||||
- var keys = Object.keys(add);
|
||||
- var i = keys.length;
|
||||
- while (i--) {
|
||||
- origin[keys[i]] = add[keys[i]];
|
||||
- }
|
||||
- return origin;
|
||||
-};
|
||||
-
|
||||
-function hasOwnProperty(obj, prop) {
|
||||
- return Object.prototype.hasOwnProperty.call(obj, prop);
|
||||
-}
|
||||
-
|
||||
-
|
||||
-// Deprecated old stuff.
|
||||
-
|
||||
-exports.p = exports.deprecate(function() {
|
||||
- for (var i = 0, len = arguments.length; i < len; ++i) {
|
||||
- console.error(exports.inspect(arguments[i]));
|
||||
- }
|
||||
-}, 'util.p: Use console.error() instead');
|
||||
-
|
||||
-
|
||||
-exports.exec = exports.deprecate(function() {
|
||||
- return require('child_process').exec.apply(this, arguments);
|
||||
-}, 'util.exec is now called `child_process.exec`.');
|
||||
-
|
||||
-
|
||||
-exports.print = exports.deprecate(function() {
|
||||
- for (var i = 0, len = arguments.length; i < len; ++i) {
|
||||
- process.stdout.write(String(arguments[i]));
|
||||
- }
|
||||
-}, 'util.print: Use console.log instead');
|
||||
-
|
||||
-
|
||||
-exports.puts = exports.deprecate(function() {
|
||||
- for (var i = 0, len = arguments.length; i < len; ++i) {
|
||||
- process.stdout.write(arguments[i] + '\n');
|
||||
- }
|
||||
-}, 'util.puts: Use console.log instead');
|
||||
-
|
||||
-
|
||||
-exports.debug = exports.deprecate(function(x) {
|
||||
- process.stderr.write('DEBUG: ' + x + '\n');
|
||||
-}, 'util.debug: Use console.error instead');
|
||||
-
|
||||
-
|
||||
-exports.error = exports.deprecate(function(x) {
|
||||
- for (var i = 0, len = arguments.length; i < len; ++i) {
|
||||
- process.stderr.write(arguments[i] + '\n');
|
||||
- }
|
||||
-}, 'util.error: Use console.error instead');
|
||||
-
|
||||
-
|
||||
-exports.pump = exports.deprecate(function(readStream, writeStream, callback) {
|
||||
- var callbackCalled = false;
|
||||
-
|
||||
- function call(a, b, c) {
|
||||
- if (callback && !callbackCalled) {
|
||||
- callback(a, b, c);
|
||||
- callbackCalled = true;
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- readStream.addListener('data', function(chunk) {
|
||||
- if (writeStream.write(chunk) === false) readStream.pause();
|
||||
- });
|
||||
-
|
||||
- writeStream.addListener('drain', function() {
|
||||
- readStream.resume();
|
||||
- });
|
||||
-
|
||||
- readStream.addListener('end', function() {
|
||||
- writeStream.end();
|
||||
- });
|
||||
-
|
||||
- readStream.addListener('close', function() {
|
||||
- call();
|
||||
- });
|
||||
-
|
||||
- readStream.addListener('error', function(err) {
|
||||
- writeStream.end();
|
||||
- call(err);
|
||||
- });
|
||||
-
|
||||
- writeStream.addListener('error', function(err) {
|
||||
- readStream.destroy();
|
||||
- call(err);
|
||||
- });
|
||||
-}, 'util.pump(): Use readableStream.pipe() instead');
|
||||
-
|
||||
-
|
||||
-var uv;
|
||||
-exports._errnoException = function(err, syscall) {
|
||||
- if (isUndefined(uv)) uv = process.binding('uv');
|
||||
- var errname = uv.errname(err);
|
||||
- var e = new Error(syscall + ' ' + errname);
|
||||
- e.code = errname;
|
||||
- e.errno = errname;
|
||||
- e.syscall = syscall;
|
||||
- return e;
|
||||
-};
|
||||
+}
|
107
samples/client/petstore-security-test/javascript/node_modules/core-util-is/lib/util.js
generated
vendored
107
samples/client/petstore-security-test/javascript/node_modules/core-util-is/lib/util.js
generated
vendored
@ -1,107 +0,0 @@
|
||||
// Copyright Joyent, Inc. and other Node contributors.
|
||||
//
|
||||
// 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.
|
||||
|
||||
// NOTE: These type checking functions intentionally don't use `instanceof`
|
||||
// because it is fragile and can be easily faked with `Object.create()`.
|
||||
|
||||
function isArray(arg) {
|
||||
if (Array.isArray) {
|
||||
return Array.isArray(arg);
|
||||
}
|
||||
return objectToString(arg) === '[object Array]';
|
||||
}
|
||||
exports.isArray = isArray;
|
||||
|
||||
function isBoolean(arg) {
|
||||
return typeof arg === 'boolean';
|
||||
}
|
||||
exports.isBoolean = isBoolean;
|
||||
|
||||
function isNull(arg) {
|
||||
return arg === null;
|
||||
}
|
||||
exports.isNull = isNull;
|
||||
|
||||
function isNullOrUndefined(arg) {
|
||||
return arg == null;
|
||||
}
|
||||
exports.isNullOrUndefined = isNullOrUndefined;
|
||||
|
||||
function isNumber(arg) {
|
||||
return typeof arg === 'number';
|
||||
}
|
||||
exports.isNumber = isNumber;
|
||||
|
||||
function isString(arg) {
|
||||
return typeof arg === 'string';
|
||||
}
|
||||
exports.isString = isString;
|
||||
|
||||
function isSymbol(arg) {
|
||||
return typeof arg === 'symbol';
|
||||
}
|
||||
exports.isSymbol = isSymbol;
|
||||
|
||||
function isUndefined(arg) {
|
||||
return arg === void 0;
|
||||
}
|
||||
exports.isUndefined = isUndefined;
|
||||
|
||||
function isRegExp(re) {
|
||||
return objectToString(re) === '[object RegExp]';
|
||||
}
|
||||
exports.isRegExp = isRegExp;
|
||||
|
||||
function isObject(arg) {
|
||||
return typeof arg === 'object' && arg !== null;
|
||||
}
|
||||
exports.isObject = isObject;
|
||||
|
||||
function isDate(d) {
|
||||
return objectToString(d) === '[object Date]';
|
||||
}
|
||||
exports.isDate = isDate;
|
||||
|
||||
function isError(e) {
|
||||
return (objectToString(e) === '[object Error]' || e instanceof Error);
|
||||
}
|
||||
exports.isError = isError;
|
||||
|
||||
function isFunction(arg) {
|
||||
return typeof arg === 'function';
|
||||
}
|
||||
exports.isFunction = isFunction;
|
||||
|
||||
function isPrimitive(arg) {
|
||||
return arg === null ||
|
||||
typeof arg === 'boolean' ||
|
||||
typeof arg === 'number' ||
|
||||
typeof arg === 'string' ||
|
||||
typeof arg === 'symbol' || // ES6 symbol
|
||||
typeof arg === 'undefined';
|
||||
}
|
||||
exports.isPrimitive = isPrimitive;
|
||||
|
||||
exports.isBuffer = Buffer.isBuffer;
|
||||
|
||||
function objectToString(o) {
|
||||
return Object.prototype.toString.call(o);
|
||||
}
|
85
samples/client/petstore-security-test/javascript/node_modules/core-util-is/package.json
generated
vendored
85
samples/client/petstore-security-test/javascript/node_modules/core-util-is/package.json
generated
vendored
@ -1,85 +0,0 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"core-util-is@~1.0.0",
|
||||
"/Users/williamcheng/Code/may2016/swagger-codegen/samples/client/petstore-security-test/javascript/node_modules/readable-stream"
|
||||
]
|
||||
],
|
||||
"_from": "core-util-is@>=1.0.0 <1.1.0",
|
||||
"_id": "core-util-is@1.0.2",
|
||||
"_inCache": true,
|
||||
"_installable": true,
|
||||
"_location": "/core-util-is",
|
||||
"_nodeVersion": "4.0.0",
|
||||
"_npmUser": {
|
||||
"email": "i@izs.me",
|
||||
"name": "isaacs"
|
||||
},
|
||||
"_npmVersion": "3.3.2",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"name": "core-util-is",
|
||||
"raw": "core-util-is@~1.0.0",
|
||||
"rawSpec": "~1.0.0",
|
||||
"scope": null,
|
||||
"spec": ">=1.0.0 <1.1.0",
|
||||
"type": "range"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/readable-stream"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz",
|
||||
"_shasum": "b5fd54220aa2bc5ab57aab7140c940754503c1a7",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "core-util-is@~1.0.0",
|
||||
"_where": "/Users/williamcheng/Code/may2016/swagger-codegen/samples/client/petstore-security-test/javascript/node_modules/readable-stream",
|
||||
"author": {
|
||||
"email": "i@izs.me",
|
||||
"name": "Isaac Z. Schlueter",
|
||||
"url": "http://blog.izs.me/"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/isaacs/core-util-is/issues"
|
||||
},
|
||||
"dependencies": {},
|
||||
"description": "The `util.is*` functions introduced in Node v0.12.",
|
||||
"devDependencies": {
|
||||
"tap": "^2.3.0"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "b5fd54220aa2bc5ab57aab7140c940754503c1a7",
|
||||
"tarball": "http://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz"
|
||||
},
|
||||
"gitHead": "a177da234df5638b363ddc15fa324619a38577c8",
|
||||
"homepage": "https://github.com/isaacs/core-util-is#readme",
|
||||
"keywords": [
|
||||
"isArray",
|
||||
"isBuffer",
|
||||
"isNumber",
|
||||
"isRegExp",
|
||||
"isString",
|
||||
"isThat",
|
||||
"isThis",
|
||||
"polyfill",
|
||||
"util"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "lib/util.js",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "isaacs",
|
||||
"email": "i@izs.me"
|
||||
}
|
||||
],
|
||||
"name": "core-util-is",
|
||||
"optionalDependencies": {},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/isaacs/core-util-is.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "tap test.js"
|
||||
},
|
||||
"version": "1.0.2"
|
||||
}
|
68
samples/client/petstore-security-test/javascript/node_modules/core-util-is/test.js
generated
vendored
68
samples/client/petstore-security-test/javascript/node_modules/core-util-is/test.js
generated
vendored
@ -1,68 +0,0 @@
|
||||
var assert = require('tap');
|
||||
|
||||
var t = require('./lib/util');
|
||||
|
||||
assert.equal(t.isArray([]), true);
|
||||
assert.equal(t.isArray({}), false);
|
||||
|
||||
assert.equal(t.isBoolean(null), false);
|
||||
assert.equal(t.isBoolean(true), true);
|
||||
assert.equal(t.isBoolean(false), true);
|
||||
|
||||
assert.equal(t.isNull(null), true);
|
||||
assert.equal(t.isNull(undefined), false);
|
||||
assert.equal(t.isNull(false), false);
|
||||
assert.equal(t.isNull(), false);
|
||||
|
||||
assert.equal(t.isNullOrUndefined(null), true);
|
||||
assert.equal(t.isNullOrUndefined(undefined), true);
|
||||
assert.equal(t.isNullOrUndefined(false), false);
|
||||
assert.equal(t.isNullOrUndefined(), true);
|
||||
|
||||
assert.equal(t.isNumber(null), false);
|
||||
assert.equal(t.isNumber('1'), false);
|
||||
assert.equal(t.isNumber(1), true);
|
||||
|
||||
assert.equal(t.isString(null), false);
|
||||
assert.equal(t.isString('1'), true);
|
||||
assert.equal(t.isString(1), false);
|
||||
|
||||
assert.equal(t.isSymbol(null), false);
|
||||
assert.equal(t.isSymbol('1'), false);
|
||||
assert.equal(t.isSymbol(1), false);
|
||||
assert.equal(t.isSymbol(Symbol()), true);
|
||||
|
||||
assert.equal(t.isUndefined(null), false);
|
||||
assert.equal(t.isUndefined(undefined), true);
|
||||
assert.equal(t.isUndefined(false), false);
|
||||
assert.equal(t.isUndefined(), true);
|
||||
|
||||
assert.equal(t.isRegExp(null), false);
|
||||
assert.equal(t.isRegExp('1'), false);
|
||||
assert.equal(t.isRegExp(new RegExp()), true);
|
||||
|
||||
assert.equal(t.isObject({}), true);
|
||||
assert.equal(t.isObject([]), true);
|
||||
assert.equal(t.isObject(new RegExp()), true);
|
||||
assert.equal(t.isObject(new Date()), true);
|
||||
|
||||
assert.equal(t.isDate(null), false);
|
||||
assert.equal(t.isDate('1'), false);
|
||||
assert.equal(t.isDate(new Date()), true);
|
||||
|
||||
assert.equal(t.isError(null), false);
|
||||
assert.equal(t.isError({ err: true }), false);
|
||||
assert.equal(t.isError(new Error()), true);
|
||||
|
||||
assert.equal(t.isFunction(null), false);
|
||||
assert.equal(t.isFunction({ }), false);
|
||||
assert.equal(t.isFunction(function() {}), true);
|
||||
|
||||
assert.equal(t.isPrimitive(null), true);
|
||||
assert.equal(t.isPrimitive(''), true);
|
||||
assert.equal(t.isPrimitive(0), true);
|
||||
assert.equal(t.isPrimitive(new Date()), false);
|
||||
|
||||
assert.equal(t.isBuffer(null), false);
|
||||
assert.equal(t.isBuffer({}), false);
|
||||
assert.equal(t.isBuffer(new Buffer(0)), true);
|
14
samples/client/petstore-security-test/javascript/node_modules/date-now/.npmignore
generated
vendored
14
samples/client/petstore-security-test/javascript/node_modules/date-now/.npmignore
generated
vendored
@ -1,14 +0,0 @@
|
||||
.DS_Store
|
||||
.monitor
|
||||
.*.swp
|
||||
.nodemonignore
|
||||
releases
|
||||
*.log
|
||||
*.err
|
||||
fleet.json
|
||||
public/browserify
|
||||
bin/*.json
|
||||
.bin
|
||||
build
|
||||
compile
|
||||
.lock-wscript
|
14
samples/client/petstore-security-test/javascript/node_modules/date-now/.testem.json
generated
vendored
14
samples/client/petstore-security-test/javascript/node_modules/date-now/.testem.json
generated
vendored
@ -1,14 +0,0 @@
|
||||
{
|
||||
"launchers": {
|
||||
"node": {
|
||||
"command": "npm test"
|
||||
}
|
||||
},
|
||||
"src_files": [
|
||||
"./**/*.js"
|
||||
],
|
||||
"before_tests": "npm run build",
|
||||
"on_exit": "rm test/static/bundle.js",
|
||||
"test_page": "test/static/index.html",
|
||||
"launch_in_dev": ["node", "phantomjs"]
|
||||
}
|
4
samples/client/petstore-security-test/javascript/node_modules/date-now/.travis.yml
generated
vendored
4
samples/client/petstore-security-test/javascript/node_modules/date-now/.travis.yml
generated
vendored
@ -1,4 +0,0 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- 0.8
|
||||
- 0.9
|
19
samples/client/petstore-security-test/javascript/node_modules/date-now/LICENCE
generated
vendored
19
samples/client/petstore-security-test/javascript/node_modules/date-now/LICENCE
generated
vendored
@ -1,19 +0,0 @@
|
||||
Copyright (c) 2012 Colingo.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
45
samples/client/petstore-security-test/javascript/node_modules/date-now/README.md
generated
vendored
45
samples/client/petstore-security-test/javascript/node_modules/date-now/README.md
generated
vendored
@ -1,45 +0,0 @@
|
||||
# date-now
|
||||
|
||||
[![build status][1]][2]
|
||||
|
||||
[![browser support][3]][4]
|
||||
|
||||
A requirable version of Date.now()
|
||||
|
||||
Use-case is to be able to mock out Date.now() using require interception.
|
||||
|
||||
## Example
|
||||
|
||||
```js
|
||||
var now = require("date-now")
|
||||
|
||||
var ts = now()
|
||||
var ts2 = Date.now()
|
||||
assert.equal(ts, ts2)
|
||||
```
|
||||
|
||||
## example of seed
|
||||
|
||||
```
|
||||
var now = require("date-now/seed")(timeStampFromServer)
|
||||
|
||||
// ts is in "sync" with the seed value from the server
|
||||
// useful if your users have their local time being a few minutes
|
||||
// out of your server time.
|
||||
var ts = now()
|
||||
```
|
||||
|
||||
## Installation
|
||||
|
||||
`npm install date-now`
|
||||
|
||||
## Contributors
|
||||
|
||||
- Raynos
|
||||
|
||||
## MIT Licenced
|
||||
|
||||
[1]: https://secure.travis-ci.org/Colingo/date-now.png
|
||||
[2]: http://travis-ci.org/Colingo/date-now
|
||||
[3]: http://ci.testling.com/Colingo/date-now.png
|
||||
[4]: http://ci.testling.com/Colingo/date-now
|
5
samples/client/petstore-security-test/javascript/node_modules/date-now/index.js
generated
vendored
5
samples/client/petstore-security-test/javascript/node_modules/date-now/index.js
generated
vendored
@ -1,5 +0,0 @@
|
||||
module.exports = now
|
||||
|
||||
function now() {
|
||||
return new Date().getTime()
|
||||
}
|
114
samples/client/petstore-security-test/javascript/node_modules/date-now/package.json
generated
vendored
114
samples/client/petstore-security-test/javascript/node_modules/date-now/package.json
generated
vendored
@ -1,114 +0,0 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"date-now@^0.1.4",
|
||||
"/Users/williamcheng/Code/may2016/swagger-codegen/samples/client/petstore-security-test/javascript/node_modules/console-browserify"
|
||||
]
|
||||
],
|
||||
"_from": "date-now@>=0.1.4 <0.2.0",
|
||||
"_id": "date-now@0.1.4",
|
||||
"_inCache": true,
|
||||
"_installable": true,
|
||||
"_location": "/date-now",
|
||||
"_npmUser": {
|
||||
"email": "raynos2@gmail.com",
|
||||
"name": "raynos"
|
||||
},
|
||||
"_npmVersion": "1.2.3",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"name": "date-now",
|
||||
"raw": "date-now@^0.1.4",
|
||||
"rawSpec": "^0.1.4",
|
||||
"scope": null,
|
||||
"spec": ">=0.1.4 <0.2.0",
|
||||
"type": "range"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/console-browserify"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/date-now/-/date-now-0.1.4.tgz",
|
||||
"_shasum": "eaf439fd4d4848ad74e5cc7dbef200672b9e345b",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "date-now@^0.1.4",
|
||||
"_where": "/Users/williamcheng/Code/may2016/swagger-codegen/samples/client/petstore-security-test/javascript/node_modules/console-browserify",
|
||||
"author": {
|
||||
"email": "raynos2@gmail.com",
|
||||
"name": "Raynos"
|
||||
},
|
||||
"bugs": {
|
||||
"email": "raynos2@gmail.com",
|
||||
"url": "https://github.com/Colingo/date-now/issues"
|
||||
},
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Artem Shoobovych"
|
||||
}
|
||||
],
|
||||
"dependencies": {},
|
||||
"description": "A requirable version of Date.now()",
|
||||
"devDependencies": {
|
||||
"browserify": "https://github.com/raynos/node-browserify/tarball/master",
|
||||
"tape": "~0.2.2",
|
||||
"testem": "~0.2.52"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "eaf439fd4d4848ad74e5cc7dbef200672b9e345b",
|
||||
"tarball": "https://registry.npmjs.org/date-now/-/date-now-0.1.4.tgz"
|
||||
},
|
||||
"homepage": "https://github.com/Colingo/date-now",
|
||||
"keywords": [],
|
||||
"licenses": [
|
||||
{
|
||||
"type": "MIT",
|
||||
"url": "http://github.com/Colingo/date-now/raw/master/LICENSE"
|
||||
}
|
||||
],
|
||||
"main": "index",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "raynos",
|
||||
"email": "raynos2@gmail.com"
|
||||
}
|
||||
],
|
||||
"name": "date-now",
|
||||
"optionalDependencies": {},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/Colingo/date-now.git"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "browserify test/index.js -o test/static/bundle.js",
|
||||
"test": "node ./test",
|
||||
"testem": "testem"
|
||||
},
|
||||
"testling": {
|
||||
"browsers": {
|
||||
"chrome": [
|
||||
"22",
|
||||
"23",
|
||||
"canary"
|
||||
],
|
||||
"firefox": [
|
||||
"16",
|
||||
"17",
|
||||
"nightly"
|
||||
],
|
||||
"ie": [
|
||||
"10",
|
||||
"8",
|
||||
"9"
|
||||
],
|
||||
"opera": [
|
||||
"12",
|
||||
"next"
|
||||
],
|
||||
"safari": [
|
||||
"5.1"
|
||||
]
|
||||
},
|
||||
"files": "test/*.js"
|
||||
},
|
||||
"version": "0.1.4"
|
||||
}
|
16
samples/client/petstore-security-test/javascript/node_modules/date-now/seed.js
generated
vendored
16
samples/client/petstore-security-test/javascript/node_modules/date-now/seed.js
generated
vendored
@ -1,16 +0,0 @@
|
||||
var now = require("./index")
|
||||
|
||||
module.exports = seeded
|
||||
|
||||
/* Returns a Date.now() like function that's in sync with
|
||||
the seed value
|
||||
*/
|
||||
function seeded(seed) {
|
||||
var current = now()
|
||||
|
||||
return time
|
||||
|
||||
function time() {
|
||||
return seed + (now() - current)
|
||||
}
|
||||
}
|
28
samples/client/petstore-security-test/javascript/node_modules/date-now/test/index.js
generated
vendored
28
samples/client/petstore-security-test/javascript/node_modules/date-now/test/index.js
generated
vendored
@ -1,28 +0,0 @@
|
||||
var test = require("tape")
|
||||
var setTimeout = require("timers").setTimeout
|
||||
|
||||
var now = require("../index")
|
||||
var seeded = require("../seed")
|
||||
|
||||
test("date", function (assert) {
|
||||
var ts = now()
|
||||
var ts2 = Date.now()
|
||||
assert.equal(ts, ts2)
|
||||
assert.end()
|
||||
})
|
||||
|
||||
test("seeded", function (assert) {
|
||||
var time = seeded(40)
|
||||
var ts = time()
|
||||
|
||||
within(assert, time(), 40, 5)
|
||||
setTimeout(function () {
|
||||
within(assert, time(), 90, 10)
|
||||
assert.end()
|
||||
}, 50)
|
||||
})
|
||||
|
||||
function within(assert, a, b, offset) {
|
||||
assert.ok(a + offset > b)
|
||||
assert.ok(a - offset < b)
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<title>TAPE Example</title>
|
||||
<script src="/testem.js"></script>
|
||||
<script src="bundle.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
</body>
|
||||
</html>
|
3
samples/client/petstore-security-test/javascript/node_modules/debug/.jshintrc
generated
vendored
3
samples/client/petstore-security-test/javascript/node_modules/debug/.jshintrc
generated
vendored
@ -1,3 +0,0 @@
|
||||
{
|
||||
"laxbreak": true
|
||||
}
|
6
samples/client/petstore-security-test/javascript/node_modules/debug/.npmignore
generated
vendored
6
samples/client/petstore-security-test/javascript/node_modules/debug/.npmignore
generated
vendored
@ -1,6 +0,0 @@
|
||||
support
|
||||
test
|
||||
examples
|
||||
example
|
||||
*.sock
|
||||
dist
|
195
samples/client/petstore-security-test/javascript/node_modules/debug/History.md
generated
vendored
195
samples/client/petstore-security-test/javascript/node_modules/debug/History.md
generated
vendored
@ -1,195 +0,0 @@
|
||||
|
||||
2.2.0 / 2015-05-09
|
||||
==================
|
||||
|
||||
* package: update "ms" to v0.7.1 (#202, @dougwilson)
|
||||
* README: add logging to file example (#193, @DanielOchoa)
|
||||
* README: fixed a typo (#191, @amir-s)
|
||||
* browser: expose `storage` (#190, @stephenmathieson)
|
||||
* Makefile: add a `distclean` target (#189, @stephenmathieson)
|
||||
|
||||
2.1.3 / 2015-03-13
|
||||
==================
|
||||
|
||||
* Updated stdout/stderr example (#186)
|
||||
* Updated example/stdout.js to match debug current behaviour
|
||||
* Renamed example/stderr.js to stdout.js
|
||||
* Update Readme.md (#184)
|
||||
* replace high intensity foreground color for bold (#182, #183)
|
||||
|
||||
2.1.2 / 2015-03-01
|
||||
==================
|
||||
|
||||
* dist: recompile
|
||||
* update "ms" to v0.7.0
|
||||
* package: update "browserify" to v9.0.3
|
||||
* component: fix "ms.js" repo location
|
||||
* changed bower package name
|
||||
* updated documentation about using debug in a browser
|
||||
* fix: security error on safari (#167, #168, @yields)
|
||||
|
||||
2.1.1 / 2014-12-29
|
||||
==================
|
||||
|
||||
* browser: use `typeof` to check for `console` existence
|
||||
* browser: check for `console.log` truthiness (fix IE 8/9)
|
||||
* browser: add support for Chrome apps
|
||||
* Readme: added Windows usage remarks
|
||||
* Add `bower.json` to properly support bower install
|
||||
|
||||
2.1.0 / 2014-10-15
|
||||
==================
|
||||
|
||||
* node: implement `DEBUG_FD` env variable support
|
||||
* package: update "browserify" to v6.1.0
|
||||
* package: add "license" field to package.json (#135, @panuhorsmalahti)
|
||||
|
||||
2.0.0 / 2014-09-01
|
||||
==================
|
||||
|
||||
* package: update "browserify" to v5.11.0
|
||||
* node: use stderr rather than stdout for logging (#29, @stephenmathieson)
|
||||
|
||||
1.0.4 / 2014-07-15
|
||||
==================
|
||||
|
||||
* dist: recompile
|
||||
* example: remove `console.info()` log usage
|
||||
* example: add "Content-Type" UTF-8 header to browser example
|
||||
* browser: place %c marker after the space character
|
||||
* browser: reset the "content" color via `color: inherit`
|
||||
* browser: add colors support for Firefox >= v31
|
||||
* debug: prefer an instance `log()` function over the global one (#119)
|
||||
* Readme: update documentation about styled console logs for FF v31 (#116, @wryk)
|
||||
|
||||
1.0.3 / 2014-07-09
|
||||
==================
|
||||
|
||||
* Add support for multiple wildcards in namespaces (#122, @seegno)
|
||||
* browser: fix lint
|
||||
|
||||
1.0.2 / 2014-06-10
|
||||
==================
|
||||
|
||||
* browser: update color palette (#113, @gscottolson)
|
||||
* common: make console logging function configurable (#108, @timoxley)
|
||||
* node: fix %o colors on old node <= 0.8.x
|
||||
* Makefile: find node path using shell/which (#109, @timoxley)
|
||||
|
||||
1.0.1 / 2014-06-06
|
||||
==================
|
||||
|
||||
* browser: use `removeItem()` to clear localStorage
|
||||
* browser, node: don't set DEBUG if namespaces is undefined (#107, @leedm777)
|
||||
* package: add "contributors" section
|
||||
* node: fix comment typo
|
||||
* README: list authors
|
||||
|
||||
1.0.0 / 2014-06-04
|
||||
==================
|
||||
|
||||
* make ms diff be global, not be scope
|
||||
* debug: ignore empty strings in enable()
|
||||
* node: make DEBUG_COLORS able to disable coloring
|
||||
* *: export the `colors` array
|
||||
* npmignore: don't publish the `dist` dir
|
||||
* Makefile: refactor to use browserify
|
||||
* package: add "browserify" as a dev dependency
|
||||
* Readme: add Web Inspector Colors section
|
||||
* node: reset terminal color for the debug content
|
||||
* node: map "%o" to `util.inspect()`
|
||||
* browser: map "%j" to `JSON.stringify()`
|
||||
* debug: add custom "formatters"
|
||||
* debug: use "ms" module for humanizing the diff
|
||||
* Readme: add "bash" syntax highlighting
|
||||
* browser: add Firebug color support
|
||||
* browser: add colors for WebKit browsers
|
||||
* node: apply log to `console`
|
||||
* rewrite: abstract common logic for Node & browsers
|
||||
* add .jshintrc file
|
||||
|
||||
0.8.1 / 2014-04-14
|
||||
==================
|
||||
|
||||
* package: re-add the "component" section
|
||||
|
||||
0.8.0 / 2014-03-30
|
||||
==================
|
||||
|
||||
* add `enable()` method for nodejs. Closes #27
|
||||
* change from stderr to stdout
|
||||
* remove unnecessary index.js file
|
||||
|
||||
0.7.4 / 2013-11-13
|
||||
==================
|
||||
|
||||
* remove "browserify" key from package.json (fixes something in browserify)
|
||||
|
||||
0.7.3 / 2013-10-30
|
||||
==================
|
||||
|
||||
* fix: catch localStorage security error when cookies are blocked (Chrome)
|
||||
* add debug(err) support. Closes #46
|
||||
* add .browser prop to package.json. Closes #42
|
||||
|
||||
0.7.2 / 2013-02-06
|
||||
==================
|
||||
|
||||
* fix package.json
|
||||
* fix: Mobile Safari (private mode) is broken with debug
|
||||
* fix: Use unicode to send escape character to shell instead of octal to work with strict mode javascript
|
||||
|
||||
0.7.1 / 2013-02-05
|
||||
==================
|
||||
|
||||
* add repository URL to package.json
|
||||
* add DEBUG_COLORED to force colored output
|
||||
* add browserify support
|
||||
* fix component. Closes #24
|
||||
|
||||
0.7.0 / 2012-05-04
|
||||
==================
|
||||
|
||||
* Added .component to package.json
|
||||
* Added debug.component.js build
|
||||
|
||||
0.6.0 / 2012-03-16
|
||||
==================
|
||||
|
||||
* Added support for "-" prefix in DEBUG [Vinay Pulim]
|
||||
* Added `.enabled` flag to the node version [TooTallNate]
|
||||
|
||||
0.5.0 / 2012-02-02
|
||||
==================
|
||||
|
||||
* Added: humanize diffs. Closes #8
|
||||
* Added `debug.disable()` to the CS variant
|
||||
* Removed padding. Closes #10
|
||||
* Fixed: persist client-side variant again. Closes #9
|
||||
|
||||
0.4.0 / 2012-02-01
|
||||
==================
|
||||
|
||||
* Added browser variant support for older browsers [TooTallNate]
|
||||
* Added `debug.enable('project:*')` to browser variant [TooTallNate]
|
||||
* Added padding to diff (moved it to the right)
|
||||
|
||||
0.3.0 / 2012-01-26
|
||||
==================
|
||||
|
||||
* Added millisecond diff when isatty, otherwise UTC string
|
||||
|
||||
0.2.0 / 2012-01-22
|
||||
==================
|
||||
|
||||
* Added wildcard support
|
||||
|
||||
0.1.0 / 2011-12-02
|
||||
==================
|
||||
|
||||
* Added: remove colors unless stderr isatty [TooTallNate]
|
||||
|
||||
0.0.1 / 2010-01-03
|
||||
==================
|
||||
|
||||
* Initial release
|
36
samples/client/petstore-security-test/javascript/node_modules/debug/Makefile
generated
vendored
36
samples/client/petstore-security-test/javascript/node_modules/debug/Makefile
generated
vendored
@ -1,36 +0,0 @@
|
||||
|
||||
# get Makefile directory name: http://stackoverflow.com/a/5982798/376773
|
||||
THIS_MAKEFILE_PATH:=$(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST))
|
||||
THIS_DIR:=$(shell cd $(dir $(THIS_MAKEFILE_PATH));pwd)
|
||||
|
||||
# BIN directory
|
||||
BIN := $(THIS_DIR)/node_modules/.bin
|
||||
|
||||
# applications
|
||||
NODE ?= $(shell which node)
|
||||
NPM ?= $(NODE) $(shell which npm)
|
||||
BROWSERIFY ?= $(NODE) $(BIN)/browserify
|
||||
|
||||
all: dist/debug.js
|
||||
|
||||
install: node_modules
|
||||
|
||||
clean:
|
||||
@rm -rf dist
|
||||
|
||||
dist:
|
||||
@mkdir -p $@
|
||||
|
||||
dist/debug.js: node_modules browser.js debug.js dist
|
||||
@$(BROWSERIFY) \
|
||||
--standalone debug \
|
||||
. > $@
|
||||
|
||||
distclean: clean
|
||||
@rm -rf node_modules
|
||||
|
||||
node_modules: package.json
|
||||
@NODE_ENV= $(NPM) install
|
||||
@touch node_modules
|
||||
|
||||
.PHONY: all install clean distclean
|
188
samples/client/petstore-security-test/javascript/node_modules/debug/Readme.md
generated
vendored
188
samples/client/petstore-security-test/javascript/node_modules/debug/Readme.md
generated
vendored
@ -1,188 +0,0 @@
|
||||
# debug
|
||||
|
||||
tiny node.js debugging utility modelled after node core's debugging technique.
|
||||
|
||||
## Installation
|
||||
|
||||
```bash
|
||||
$ npm install debug
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
With `debug` you simply invoke the exported function to generate your debug function, passing it a name which will determine if a noop function is returned, or a decorated `console.error`, so all of the `console` format string goodies you're used to work fine. A unique color is selected per-function for visibility.
|
||||
|
||||
Example _app.js_:
|
||||
|
||||
```js
|
||||
var debug = require('debug')('http')
|
||||
, http = require('http')
|
||||
, name = 'My App';
|
||||
|
||||
// fake app
|
||||
|
||||
debug('booting %s', name);
|
||||
|
||||
http.createServer(function(req, res){
|
||||
debug(req.method + ' ' + req.url);
|
||||
res.end('hello\n');
|
||||
}).listen(3000, function(){
|
||||
debug('listening');
|
||||
});
|
||||
|
||||
// fake worker of some kind
|
||||
|
||||
require('./worker');
|
||||
```
|
||||
|
||||
Example _worker.js_:
|
||||
|
||||
```js
|
||||
var debug = require('debug')('worker');
|
||||
|
||||
setInterval(function(){
|
||||
debug('doing some work');
|
||||
}, 1000);
|
||||
```
|
||||
|
||||
The __DEBUG__ environment variable is then used to enable these based on space or comma-delimited names. Here are some examples:
|
||||
|
||||
![debug http and worker](http://f.cl.ly/items/18471z1H402O24072r1J/Screenshot.png)
|
||||
|
||||
![debug worker](http://f.cl.ly/items/1X413v1a3M0d3C2c1E0i/Screenshot.png)
|
||||
|
||||
#### Windows note
|
||||
|
||||
On Windows the environment variable is set using the `set` command.
|
||||
|
||||
```cmd
|
||||
set DEBUG=*,-not_this
|
||||
```
|
||||
|
||||
Then, run the program to be debugged as usual.
|
||||
|
||||
## Millisecond diff
|
||||
|
||||
When actively developing an application it can be useful to see when the time spent between one `debug()` call and the next. Suppose for example you invoke `debug()` before requesting a resource, and after as well, the "+NNNms" will show you how much time was spent between calls.
|
||||
|
||||
![](http://f.cl.ly/items/2i3h1d3t121M2Z1A3Q0N/Screenshot.png)
|
||||
|
||||
When stdout is not a TTY, `Date#toUTCString()` is used, making it more useful for logging the debug information as shown below:
|
||||
|
||||
![](http://f.cl.ly/items/112H3i0e0o0P0a2Q2r11/Screenshot.png)
|
||||
|
||||
## Conventions
|
||||
|
||||
If you're using this in one or more of your libraries, you _should_ use the name of your library so that developers may toggle debugging as desired without guessing names. If you have more than one debuggers you _should_ prefix them with your library name and use ":" to separate features. For example "bodyParser" from Connect would then be "connect:bodyParser".
|
||||
|
||||
## Wildcards
|
||||
|
||||
The `*` character may be used as a wildcard. Suppose for example your library has debuggers named "connect:bodyParser", "connect:compress", "connect:session", instead of listing all three with `DEBUG=connect:bodyParser,connect:compress,connect:session`, you may simply do `DEBUG=connect:*`, or to run everything using this module simply use `DEBUG=*`.
|
||||
|
||||
You can also exclude specific debuggers by prefixing them with a "-" character. For example, `DEBUG=*,-connect:*` would include all debuggers except those starting with "connect:".
|
||||
|
||||
## Browser support
|
||||
|
||||
Debug works in the browser as well, currently persisted by `localStorage`. Consider the situation shown below where you have `worker:a` and `worker:b`, and wish to debug both. Somewhere in the code on your page, include:
|
||||
|
||||
```js
|
||||
window.myDebug = require("debug");
|
||||
```
|
||||
|
||||
("debug" is a global object in the browser so we give this object a different name.) When your page is open in the browser, type the following in the console:
|
||||
|
||||
```js
|
||||
myDebug.enable("worker:*")
|
||||
```
|
||||
|
||||
Refresh the page. Debug output will continue to be sent to the console until it is disabled by typing `myDebug.disable()` in the console.
|
||||
|
||||
```js
|
||||
a = debug('worker:a');
|
||||
b = debug('worker:b');
|
||||
|
||||
setInterval(function(){
|
||||
a('doing some work');
|
||||
}, 1000);
|
||||
|
||||
setInterval(function(){
|
||||
b('doing some work');
|
||||
}, 1200);
|
||||
```
|
||||
|
||||
#### Web Inspector Colors
|
||||
|
||||
Colors are also enabled on "Web Inspectors" that understand the `%c` formatting
|
||||
option. These are WebKit web inspectors, Firefox ([since version
|
||||
31](https://hacks.mozilla.org/2014/05/editable-box-model-multiple-selection-sublime-text-keys-much-more-firefox-developer-tools-episode-31/))
|
||||
and the Firebug plugin for Firefox (any version).
|
||||
|
||||
Colored output looks something like:
|
||||
|
||||
![](https://cloud.githubusercontent.com/assets/71256/3139768/b98c5fd8-e8ef-11e3-862a-f7253b6f47c6.png)
|
||||
|
||||
### stderr vs stdout
|
||||
|
||||
You can set an alternative logging method per-namespace by overriding the `log` method on a per-namespace or globally:
|
||||
|
||||
Example _stdout.js_:
|
||||
|
||||
```js
|
||||
var debug = require('debug');
|
||||
var error = debug('app:error');
|
||||
|
||||
// by default stderr is used
|
||||
error('goes to stderr!');
|
||||
|
||||
var log = debug('app:log');
|
||||
// set this namespace to log via console.log
|
||||
log.log = console.log.bind(console); // don't forget to bind to console!
|
||||
log('goes to stdout');
|
||||
error('still goes to stderr!');
|
||||
|
||||
// set all output to go via console.info
|
||||
// overrides all per-namespace log settings
|
||||
debug.log = console.info.bind(console);
|
||||
error('now goes to stdout via console.info');
|
||||
log('still goes to stdout, but via console.info now');
|
||||
```
|
||||
|
||||
### Save debug output to a file
|
||||
|
||||
You can save all debug statements to a file by piping them.
|
||||
|
||||
Example:
|
||||
|
||||
```bash
|
||||
$ DEBUG_FD=3 node your-app.js 3> whatever.log
|
||||
```
|
||||
|
||||
## Authors
|
||||
|
||||
- TJ Holowaychuk
|
||||
- Nathan Rajlich
|
||||
|
||||
## License
|
||||
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2014 TJ Holowaychuk <tj@vision-media.ca>
|
||||
|
||||
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
samples/client/petstore-security-test/javascript/node_modules/debug/bower.json
generated
vendored
28
samples/client/petstore-security-test/javascript/node_modules/debug/bower.json
generated
vendored
@ -1,28 +0,0 @@
|
||||
{
|
||||
"name": "visionmedia-debug",
|
||||
"main": "dist/debug.js",
|
||||
"version": "2.2.0",
|
||||
"homepage": "https://github.com/visionmedia/debug",
|
||||
"authors": [
|
||||
"TJ Holowaychuk <tj@vision-media.ca>"
|
||||
],
|
||||
"description": "visionmedia-debug",
|
||||
"moduleType": [
|
||||
"amd",
|
||||
"es6",
|
||||
"globals",
|
||||
"node"
|
||||
],
|
||||
"keywords": [
|
||||
"visionmedia",
|
||||
"debug"
|
||||
],
|
||||
"license": "MIT",
|
||||
"ignore": [
|
||||
"**/.*",
|
||||
"node_modules",
|
||||
"bower_components",
|
||||
"test",
|
||||
"tests"
|
||||
]
|
||||
}
|
168
samples/client/petstore-security-test/javascript/node_modules/debug/browser.js
generated
vendored
168
samples/client/petstore-security-test/javascript/node_modules/debug/browser.js
generated
vendored
@ -1,168 +0,0 @@
|
||||
|
||||
/**
|
||||
* This is the web browser implementation of `debug()`.
|
||||
*
|
||||
* Expose `debug()` as the module.
|
||||
*/
|
||||
|
||||
exports = module.exports = require('./debug');
|
||||
exports.log = log;
|
||||
exports.formatArgs = formatArgs;
|
||||
exports.save = save;
|
||||
exports.load = load;
|
||||
exports.useColors = useColors;
|
||||
exports.storage = 'undefined' != typeof chrome
|
||||
&& 'undefined' != typeof chrome.storage
|
||||
? chrome.storage.local
|
||||
: localstorage();
|
||||
|
||||
/**
|
||||
* Colors.
|
||||
*/
|
||||
|
||||
exports.colors = [
|
||||
'lightseagreen',
|
||||
'forestgreen',
|
||||
'goldenrod',
|
||||
'dodgerblue',
|
||||
'darkorchid',
|
||||
'crimson'
|
||||
];
|
||||
|
||||
/**
|
||||
* Currently only WebKit-based Web Inspectors, Firefox >= v31,
|
||||
* and the Firebug extension (any Firefox version) are known
|
||||
* to support "%c" CSS customizations.
|
||||
*
|
||||
* TODO: add a `localStorage` variable to explicitly enable/disable colors
|
||||
*/
|
||||
|
||||
function useColors() {
|
||||
// is webkit? http://stackoverflow.com/a/16459606/376773
|
||||
return ('WebkitAppearance' in document.documentElement.style) ||
|
||||
// is firebug? http://stackoverflow.com/a/398120/376773
|
||||
(window.console && (console.firebug || (console.exception && console.table))) ||
|
||||
// is firefox >= v31?
|
||||
// https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
|
||||
(navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31);
|
||||
}
|
||||
|
||||
/**
|
||||
* Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
|
||||
*/
|
||||
|
||||
exports.formatters.j = function(v) {
|
||||
return JSON.stringify(v);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Colorize log arguments if enabled.
|
||||
*
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function formatArgs() {
|
||||
var args = arguments;
|
||||
var useColors = this.useColors;
|
||||
|
||||
args[0] = (useColors ? '%c' : '')
|
||||
+ this.namespace
|
||||
+ (useColors ? ' %c' : ' ')
|
||||
+ args[0]
|
||||
+ (useColors ? '%c ' : ' ')
|
||||
+ '+' + exports.humanize(this.diff);
|
||||
|
||||
if (!useColors) return args;
|
||||
|
||||
var c = 'color: ' + this.color;
|
||||
args = [args[0], c, 'color: inherit'].concat(Array.prototype.slice.call(args, 1));
|
||||
|
||||
// the final "%c" is somewhat tricky, because there could be other
|
||||
// arguments passed either before or after the %c, so we need to
|
||||
// figure out the correct index to insert the CSS into
|
||||
var index = 0;
|
||||
var lastC = 0;
|
||||
args[0].replace(/%[a-z%]/g, function(match) {
|
||||
if ('%%' === match) return;
|
||||
index++;
|
||||
if ('%c' === match) {
|
||||
// we only are interested in the *last* %c
|
||||
// (the user may have provided their own)
|
||||
lastC = index;
|
||||
}
|
||||
});
|
||||
|
||||
args.splice(lastC, 0, c);
|
||||
return args;
|
||||
}
|
||||
|
||||
/**
|
||||
* Invokes `console.log()` when available.
|
||||
* No-op when `console.log` is not a "function".
|
||||
*
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function log() {
|
||||
// this hackery is required for IE8/9, where
|
||||
// the `console.log` function doesn't have 'apply'
|
||||
return 'object' === typeof console
|
||||
&& console.log
|
||||
&& Function.prototype.apply.call(console.log, console, arguments);
|
||||
}
|
||||
|
||||
/**
|
||||
* Save `namespaces`.
|
||||
*
|
||||
* @param {String} namespaces
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function save(namespaces) {
|
||||
try {
|
||||
if (null == namespaces) {
|
||||
exports.storage.removeItem('debug');
|
||||
} else {
|
||||
exports.storage.debug = namespaces;
|
||||
}
|
||||
} catch(e) {}
|
||||
}
|
||||
|
||||
/**
|
||||
* Load `namespaces`.
|
||||
*
|
||||
* @return {String} returns the previously persisted debug modes
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function load() {
|
||||
var r;
|
||||
try {
|
||||
r = exports.storage.debug;
|
||||
} catch(e) {}
|
||||
return r;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable namespaces listed in `localStorage.debug` initially.
|
||||
*/
|
||||
|
||||
exports.enable(load());
|
||||
|
||||
/**
|
||||
* Localstorage attempts to return the localstorage.
|
||||
*
|
||||
* This is necessary because safari throws
|
||||
* when a user disables cookies/localstorage
|
||||
* and you attempt to access it.
|
||||
*
|
||||
* @return {LocalStorage}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function localstorage(){
|
||||
try {
|
||||
return window.localStorage;
|
||||
} catch (e) {}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user