mirror of
https://github.com/titanscouting/tra-analysis.git
synced 2025-09-27 07:20:19 +00:00
push all website files
This commit is contained in:
222
website/node_modules/npm/node_modules/query-string/index.js
generated
vendored
Normal file
222
website/node_modules/npm/node_modules/query-string/index.js
generated
vendored
Normal file
@@ -0,0 +1,222 @@
|
||||
'use strict';
|
||||
const strictUriEncode = require('strict-uri-encode');
|
||||
const decodeComponent = require('decode-uri-component');
|
||||
|
||||
function encoderForArrayFormat(options) {
|
||||
switch (options.arrayFormat) {
|
||||
case 'index':
|
||||
return (key, value, index) => {
|
||||
return value === null ? [
|
||||
encode(key, options),
|
||||
'[',
|
||||
index,
|
||||
']'
|
||||
].join('') : [
|
||||
encode(key, options),
|
||||
'[',
|
||||
encode(index, options),
|
||||
']=',
|
||||
encode(value, options)
|
||||
].join('');
|
||||
};
|
||||
case 'bracket':
|
||||
return (key, value) => {
|
||||
return value === null ? [encode(key, options), '[]'].join('') : [
|
||||
encode(key, options),
|
||||
'[]=',
|
||||
encode(value, options)
|
||||
].join('');
|
||||
};
|
||||
default:
|
||||
return (key, value) => {
|
||||
return value === null ? encode(key, options) : [
|
||||
encode(key, options),
|
||||
'=',
|
||||
encode(value, options)
|
||||
].join('');
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
function parserForArrayFormat(options) {
|
||||
let result;
|
||||
|
||||
switch (options.arrayFormat) {
|
||||
case 'index':
|
||||
return (key, value, accumulator) => {
|
||||
result = /\[(\d*)\]$/.exec(key);
|
||||
|
||||
key = key.replace(/\[\d*\]$/, '');
|
||||
|
||||
if (!result) {
|
||||
accumulator[key] = value;
|
||||
return;
|
||||
}
|
||||
|
||||
if (accumulator[key] === undefined) {
|
||||
accumulator[key] = {};
|
||||
}
|
||||
|
||||
accumulator[key][result[1]] = value;
|
||||
};
|
||||
case 'bracket':
|
||||
return (key, value, accumulator) => {
|
||||
result = /(\[\])$/.exec(key);
|
||||
key = key.replace(/\[\]$/, '');
|
||||
|
||||
if (!result) {
|
||||
accumulator[key] = value;
|
||||
return;
|
||||
}
|
||||
|
||||
if (accumulator[key] === undefined) {
|
||||
accumulator[key] = [value];
|
||||
return;
|
||||
}
|
||||
|
||||
accumulator[key] = [].concat(accumulator[key], value);
|
||||
};
|
||||
default:
|
||||
return (key, value, accumulator) => {
|
||||
if (accumulator[key] === undefined) {
|
||||
accumulator[key] = value;
|
||||
return;
|
||||
}
|
||||
|
||||
accumulator[key] = [].concat(accumulator[key], value);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
function encode(value, options) {
|
||||
if (options.encode) {
|
||||
return options.strict ? strictUriEncode(value) : encodeURIComponent(value);
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
function decode(value, options) {
|
||||
if (options.decode) {
|
||||
return decodeComponent(value);
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
function keysSorter(input) {
|
||||
if (Array.isArray(input)) {
|
||||
return input.sort();
|
||||
}
|
||||
|
||||
if (typeof input === 'object') {
|
||||
return keysSorter(Object.keys(input))
|
||||
.sort((a, b) => Number(a) - Number(b))
|
||||
.map(key => input[key]);
|
||||
}
|
||||
|
||||
return input;
|
||||
}
|
||||
|
||||
function extract(input) {
|
||||
const queryStart = input.indexOf('?');
|
||||
if (queryStart === -1) {
|
||||
return '';
|
||||
}
|
||||
return input.slice(queryStart + 1);
|
||||
}
|
||||
|
||||
function parse(input, options) {
|
||||
options = Object.assign({decode: true, arrayFormat: 'none'}, options);
|
||||
|
||||
const formatter = parserForArrayFormat(options);
|
||||
|
||||
// Create an object with no prototype
|
||||
const ret = Object.create(null);
|
||||
|
||||
if (typeof input !== 'string') {
|
||||
return ret;
|
||||
}
|
||||
|
||||
input = input.trim().replace(/^[?#&]/, '');
|
||||
|
||||
if (!input) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
for (const param of input.split('&')) {
|
||||
let [key, value] = param.replace(/\+/g, ' ').split('=');
|
||||
|
||||
// Missing `=` should be `null`:
|
||||
// http://w3.org/TR/2012/WD-url-20120524/#collect-url-parameters
|
||||
value = value === undefined ? null : decode(value, options);
|
||||
|
||||
formatter(decode(key, options), value, ret);
|
||||
}
|
||||
|
||||
return Object.keys(ret).sort().reduce((result, key) => {
|
||||
const value = ret[key];
|
||||
if (Boolean(value) && typeof value === 'object' && !Array.isArray(value)) {
|
||||
// Sort object keys, not values
|
||||
result[key] = keysSorter(value);
|
||||
} else {
|
||||
result[key] = value;
|
||||
}
|
||||
|
||||
return result;
|
||||
}, Object.create(null));
|
||||
}
|
||||
|
||||
exports.extract = extract;
|
||||
exports.parse = parse;
|
||||
|
||||
exports.stringify = (obj, options) => {
|
||||
const defaults = {
|
||||
encode: true,
|
||||
strict: true,
|
||||
arrayFormat: 'none'
|
||||
};
|
||||
|
||||
options = Object.assign(defaults, options);
|
||||
|
||||
if (options.sort === false) {
|
||||
options.sort = () => {};
|
||||
}
|
||||
|
||||
const formatter = encoderForArrayFormat(options);
|
||||
|
||||
return obj ? Object.keys(obj).sort(options.sort).map(key => {
|
||||
const value = obj[key];
|
||||
|
||||
if (value === undefined) {
|
||||
return '';
|
||||
}
|
||||
|
||||
if (value === null) {
|
||||
return encode(key, options);
|
||||
}
|
||||
|
||||
if (Array.isArray(value)) {
|
||||
const result = [];
|
||||
|
||||
for (const value2 of value.slice()) {
|
||||
if (value2 === undefined) {
|
||||
continue;
|
||||
}
|
||||
|
||||
result.push(formatter(key, value2, result.length));
|
||||
}
|
||||
|
||||
return result.join('&');
|
||||
}
|
||||
|
||||
return encode(key, options) + '=' + encode(value, options);
|
||||
}).filter(x => x.length > 0).join('&') : '';
|
||||
};
|
||||
|
||||
exports.parseUrl = (input, options) => {
|
||||
return {
|
||||
url: input.split('?')[0] || '',
|
||||
query: parse(extract(input), options)
|
||||
};
|
||||
};
|
9
website/node_modules/npm/node_modules/query-string/license
generated
vendored
Normal file
9
website/node_modules/npm/node_modules/query-string/license
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.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.
|
81
website/node_modules/npm/node_modules/query-string/package.json
generated
vendored
Normal file
81
website/node_modules/npm/node_modules/query-string/package.json
generated
vendored
Normal file
@@ -0,0 +1,81 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"query-string@6.1.0",
|
||||
"/Users/rebecca/code/npm"
|
||||
]
|
||||
],
|
||||
"_from": "query-string@6.1.0",
|
||||
"_id": "query-string@6.1.0",
|
||||
"_inBundle": true,
|
||||
"_integrity": "sha512-pNB/Gr8SA8ff8KpUFM36o/WFAlthgaThka5bV19AD9PNTH20Pwq5Zxodif2YyHwrctp6SkL4GqlOot0qR/wGaw==",
|
||||
"_location": "/npm/query-string",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "query-string@6.1.0",
|
||||
"name": "query-string",
|
||||
"escapedName": "query-string",
|
||||
"rawSpec": "6.1.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "6.1.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/npm"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/query-string/-/query-string-6.1.0.tgz",
|
||||
"_spec": "6.1.0",
|
||||
"_where": "/Users/rebecca/code/npm",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/sindresorhus/query-string/issues"
|
||||
},
|
||||
"dependencies": {
|
||||
"decode-uri-component": "^0.2.0",
|
||||
"strict-uri-encode": "^2.0.0"
|
||||
},
|
||||
"description": "Parse and stringify URL query strings",
|
||||
"devDependencies": {
|
||||
"ava": "*",
|
||||
"deep-equal": "^1.0.1",
|
||||
"fast-check": "^1.0.1",
|
||||
"xo": "*"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"homepage": "https://github.com/sindresorhus/query-string#readme",
|
||||
"keywords": [
|
||||
"browser",
|
||||
"querystring",
|
||||
"query",
|
||||
"string",
|
||||
"qs",
|
||||
"param",
|
||||
"parameter",
|
||||
"url",
|
||||
"parse",
|
||||
"stringify",
|
||||
"encode",
|
||||
"decode",
|
||||
"searchparams"
|
||||
],
|
||||
"license": "MIT",
|
||||
"name": "query-string",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/sindresorhus/query-string.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava"
|
||||
},
|
||||
"version": "6.1.0"
|
||||
}
|
231
website/node_modules/npm/node_modules/query-string/readme.md
generated
vendored
Normal file
231
website/node_modules/npm/node_modules/query-string/readme.md
generated
vendored
Normal file
@@ -0,0 +1,231 @@
|
||||
# query-string [](https://travis-ci.org/sindresorhus/query-string)
|
||||
|
||||
> Parse and stringify URL [query strings](https://en.wikipedia.org/wiki/Query_string)
|
||||
|
||||
---
|
||||
|
||||
<p align="center"><b>🔥 Want to strengthen your core JavaScript skills and master ES6?</b><br>I would personally recommend this awesome <a href="https://ES6.io/friend/AWESOME">ES6 course</a> by Wes Bos.<br>Also check out his <a href="https://LearnNode.com/friend/AWESOME">Node.js</a>, <a href="https://ReactForBeginners.com/friend/AWESOME">React</a>, <a href="https://SublimeTextBook.com/friend/AWESOME">Sublime</a> courses.</p>
|
||||
|
||||
---
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install query-string
|
||||
```
|
||||
|
||||
This module targets Node.js 6 or later and the latest version of Chrome, Firefox, and Safari. If you want support for older browsers, use version 5: `npm install query-string@5`.
|
||||
|
||||
<a href="https://www.patreon.com/sindresorhus">
|
||||
<img src="https://c5.patreon.com/external/logo/become_a_patron_button@2x.png" width="160">
|
||||
</a>
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const queryString = require('query-string');
|
||||
|
||||
console.log(location.search);
|
||||
//=> '?foo=bar'
|
||||
|
||||
const parsed = queryString.parse(location.search);
|
||||
console.log(parsed);
|
||||
//=> {foo: 'bar'}
|
||||
|
||||
console.log(location.hash);
|
||||
//=> '#token=bada55cafe'
|
||||
|
||||
const parsedHash = queryString.parse(location.hash);
|
||||
console.log(parsedHash);
|
||||
//=> {token: 'bada55cafe'}
|
||||
|
||||
parsed.foo = 'unicorn';
|
||||
parsed.ilike = 'pizza';
|
||||
|
||||
const stringified = queryString.stringify(parsed);
|
||||
//=> 'foo=unicorn&ilike=pizza'
|
||||
|
||||
location.search = stringified;
|
||||
// note that `location.search` automatically prepends a question mark
|
||||
console.log(location.search);
|
||||
//=> '?foo=unicorn&ilike=pizza'
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
### .parse(*string*, *[options]*)
|
||||
|
||||
Parse a query string into an object. Leading `?` or `#` are ignored, so you can pass `location.search` or `location.hash` directly.
|
||||
|
||||
The returned object is created with [`Object.create(null)`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/create) and thus does not have a `prototype`.
|
||||
|
||||
#### decode
|
||||
|
||||
Type: `boolean`<br>
|
||||
Default: `true`
|
||||
|
||||
Decode the keys and values. URI components are decoded with [`decode-uri-component`](https://github.com/SamVerschueren/decode-uri-component).
|
||||
|
||||
#### arrayFormat
|
||||
|
||||
Type: `string`<br>
|
||||
Default: `'none'`
|
||||
|
||||
Supports both `index` for an indexed array representation or `bracket` for a *bracketed* array representation.
|
||||
|
||||
- `bracket`: stands for parsing correctly arrays with bracket representation on the query string, such as:
|
||||
|
||||
```js
|
||||
queryString.parse('foo[]=1&foo[]=2&foo[]=3', {arrayFormat: 'bracket'});
|
||||
//=> foo: [1,2,3]
|
||||
```
|
||||
|
||||
- `index`: stands for parsing taking the index into account, such as:
|
||||
|
||||
```js
|
||||
queryString.parse('foo[0]=1&foo[1]=2&foo[3]=3', {arrayFormat: 'index'});
|
||||
//=> foo: [1,2,3]
|
||||
```
|
||||
|
||||
- `none`: is the **default** option and removes any bracket representation, such as:
|
||||
|
||||
```js
|
||||
queryString.parse('foo=1&foo=2&foo=3');
|
||||
//=> foo: [1,2,3]
|
||||
```
|
||||
|
||||
### .stringify(*object*, *[options]*)
|
||||
|
||||
Stringify an object into a query string, sorting the keys.
|
||||
|
||||
#### strict
|
||||
|
||||
Type: `boolean`<br>
|
||||
Default: `true`
|
||||
|
||||
Strictly encode URI components with [strict-uri-encode](https://github.com/kevva/strict-uri-encode). It uses [encodeURIComponent](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/encodeURIComponent)
|
||||
if set to false. You probably [don't care](https://github.com/sindresorhus/query-string/issues/42) about this option.
|
||||
|
||||
#### encode
|
||||
|
||||
Type: `boolean`<br>
|
||||
Default: `true`
|
||||
|
||||
[URL encode](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/encodeURIComponent) the keys and values.
|
||||
|
||||
#### arrayFormat
|
||||
|
||||
Type: `string`<br>
|
||||
Default: `'none'`
|
||||
|
||||
Supports both `index` for an indexed array representation or `bracket` for a *bracketed* array representation.
|
||||
|
||||
- `bracket`: stands for parsing correctly arrays with bracket representation on the query string, such as:
|
||||
|
||||
```js
|
||||
queryString.stringify({foo: [1,2,3]}, {arrayFormat: 'bracket'});
|
||||
// => foo[]=1&foo[]=2&foo[]=3
|
||||
```
|
||||
|
||||
- `index`: stands for parsing taking the index into account, such as:
|
||||
|
||||
```js
|
||||
queryString.stringify({foo: [1,2,3]}, {arrayFormat: 'index'});
|
||||
// => foo[0]=1&foo[1]=2&foo[3]=3
|
||||
```
|
||||
|
||||
- `none`: is the __default__ option and removes any bracket representation, such as:
|
||||
|
||||
```js
|
||||
queryString.stringify({foo: [1,2,3]});
|
||||
// => foo=1&foo=2&foo=3
|
||||
```
|
||||
|
||||
#### sort
|
||||
|
||||
Type: `Function` `boolean`
|
||||
|
||||
Supports both `Function` as a custom sorting function or `false` to disable sorting.
|
||||
|
||||
```js
|
||||
const order = ['c', 'a', 'b'];
|
||||
queryString.stringify({ a: 1, b: 2, c: 3}, {
|
||||
sort: (m, n) => order.indexOf(m) >= order.indexOf(n)
|
||||
});
|
||||
// => 'c=3&a=1&b=2'
|
||||
```
|
||||
|
||||
```js
|
||||
queryString.stringify({ b: 1, c: 2, a: 3}, {sort: false});
|
||||
// => 'c=3&a=1&b=2'
|
||||
```
|
||||
|
||||
If omitted, keys are sorted using `Array#sort`, which means, converting them to strings and comparing strings in Unicode code point order.
|
||||
|
||||
### .extract(*string*)
|
||||
|
||||
Extract a query string from a URL that can be passed into `.parse()`.
|
||||
|
||||
### .parseUrl(*string*, *[options]*)
|
||||
|
||||
Extract the URL and the query string as an object.
|
||||
|
||||
The `options` are the same as for `.parse()`.
|
||||
|
||||
Returns an object with a `url` and `query` property.
|
||||
|
||||
```js
|
||||
queryString.parseUrl('https://foo.bar?foo=bar');
|
||||
//=> {url: 'https://foo.bar', query: {foo: 'bar'}}
|
||||
```
|
||||
|
||||
|
||||
## Nesting
|
||||
|
||||
This module intentionally doesn't support nesting as it's not spec'd and varies between implementations, which causes a lot of [edge cases](https://github.com/visionmedia/node-querystring/issues).
|
||||
|
||||
You're much better off just converting the object to a JSON string:
|
||||
|
||||
```js
|
||||
queryString.stringify({
|
||||
foo: 'bar',
|
||||
nested: JSON.stringify({
|
||||
unicorn: 'cake'
|
||||
})
|
||||
});
|
||||
//=> 'foo=bar&nested=%7B%22unicorn%22%3A%22cake%22%7D'
|
||||
```
|
||||
|
||||
However, there is support for multiple instances of the same key:
|
||||
|
||||
```js
|
||||
queryString.parse('likes=cake&name=bob&likes=icecream');
|
||||
//=> {likes: ['cake', 'icecream'], name: 'bob'}
|
||||
|
||||
queryString.stringify({color: ['taupe', 'chartreuse'], id: '515'});
|
||||
//=> 'color=chartreuse&color=taupe&id=515'
|
||||
```
|
||||
|
||||
|
||||
## Falsy values
|
||||
|
||||
Sometimes you want to unset a key, or maybe just make it present without assigning a value to it. Here is how falsy values are stringified:
|
||||
|
||||
```js
|
||||
queryString.stringify({foo: false});
|
||||
//=> 'foo=false'
|
||||
|
||||
queryString.stringify({foo: null});
|
||||
//=> 'foo'
|
||||
|
||||
queryString.stringify({foo: undefined});
|
||||
//=> ''
|
||||
```
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](https://sindresorhus.com)
|
Reference in New Issue
Block a user