Every new change

This commit is contained in:
Luca Schwan
2020-03-25 11:05:34 +01:00
parent ff8491e75f
commit b4d041c5de
7164 changed files with 499221 additions and 135 deletions

8
node_modules/flatted/.github/FUNDING.yml generated vendored Normal file
View File

@ -0,0 +1,8 @@
# These are supported funding model platforms
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
patreon: # not working due missing www.
open_collective: #
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
custom: https://www.patreon.com/webreflection

15
node_modules/flatted/LICENSE generated vendored Normal file
View File

@ -0,0 +1,15 @@
ISC License
Copyright (c) 2018, Andrea Giammarchi, @WebReflection
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.

52
node_modules/flatted/README.md generated vendored Normal file
View File

@ -0,0 +1,52 @@
# flatted
![Downloads](https://img.shields.io/npm/dm/flatted.svg) [![Coverage Status](https://coveralls.io/repos/github/WebReflection/flatted/badge.svg?branch=master)](https://coveralls.io/github/WebReflection/flatted?branch=master) [![Build Status](https://travis-ci.org/WebReflection/flatted.svg?branch=master)](https://travis-ci.org/WebReflection/flatted) [![License: ISC](https://img.shields.io/badge/License-ISC-yellow.svg)](https://opensource.org/licenses/ISC) ![WebReflection status](https://offline.report/status/webreflection.svg)
A super light (0.5K) and fast circular JSON parser, directly from the creator of [CircularJSON](https://github.com/WebReflection/circular-json/#circularjson).
Usable via [CDN](https://unpkg.com/flatted) or as regular module.
```js
// ESM
import {parse, stringify} from 'flatted/esm';
// CJS
const {parse, stringify} = require('flatted/cjs');
const a = [{}];
a[0].a = a;
a.push(a);
stringify(a); // [["1","0"],{"a":"0"}]
```
### New in V1: Exact same JSON API
* Added a [reviver](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse#Syntax) parameter to `.parse(string, reviver)` and revive your own objects.
* Added a [replacer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#Syntax) and a `space` parameter to `.stringify(object, replacer, space)` for feature parity with JSON signature.
### Compatibility
All ECMAScript engines compatible with `Map`, `Set`, `Object.keys`, and `Array.prototype.reduce` will work, even if polyfilled.
### How does it work ?
While stringifying, all Objects, including Arrays, and strings, are flattened out and replaced as unique index. `*`
Once parsed, all indexes will be replaced through the flattened collection.
<sup><sub>`*` represented as string to avoid conflicts with numbers</sub></sup>
```js
// logic example
var a = [{one: 1}, {two: '2'}];
a[0].a = a;
// a is the main object, will be at index '0'
// {one: 1} is the second object, index '1'
// {two: '2'} the third, in '2', and it has a string
// which will be found at index '3'
Flatted.stringify(a);
// [["1","2"],{"one":1,"a":"0"},{"two":"3"},"2"]
// a[one,two] {one: 1, a} {two: '2'} '2'
```

94
node_modules/flatted/SPECS.md generated vendored Normal file
View File

@ -0,0 +1,94 @@
# Flatted Specifications
This document describes operations performed to produce, or parse, the flatted output.
## stringify(any) => flattedString
The output is always an `Array` that contains at index `0` the given value.
If the value is an `Array` or an `Object`, per each property value passed through the callback, return the value as is if it's not an `Array`, an `Object`, or a `string`.
In case it's an `Array`, an `Object`, or a `string`, return the index as `string`, associated through a `Map`.
Giving the following example:
```js
flatted.stringify('a'); // ["a"]
flatted.stringify(['a']); // [["1"],"a"]
flatted.stringify(['a', 1, 'b']); // [["1",1,"2"],"a","b"]
```
There is an `input` containing `[array, "a", "b"]`, where the `array` has indexes `"1"` and `"2"` as strings, indexes that point respectively at `"a"` and `"b"` within the input `[array, "a", "b"]`.
The exact same happens for objects.
```js
flatted.stringify('a'); // ["a"]
flatted.stringify({a: 'a'}); // [{"a":"1"},"a"]
flatted.stringify({a: 'a', n: 1, b: 'b'}); // [{"a":"1","n":1,"b":"2"},"a","b"]
```
Every object, string, or array, encountered during serialization will be stored once as stringified index.
```js
// per each property/value of the object/array
if (any == null || !/object|string/.test(typeof any))
return any;
if (!map.has(any)) {
const index = String(arr.length);
arr.push(any);
map.set(any, index);
}
return map.get(any);
```
This, performed before going through all properties, grants unique indexes per reference.
The stringified indexes ensure there won't be conflicts with regularly stored numbers.
## parse(flattedString) => any
Everything that is a `string` is wrapped as `new String`, but strings in the array, from index `1` on, is kept as regular `string`.
```js
const input = JSON.parse('[{"a":"1"},"b"]', Strings).map(strings);
// convert strings primitives into String instances
function Strings(key, value) {
return typeof value === 'string' ? new String(value) : value;
}
// converts String instances into strings primitives
function strings(value) {
return value instanceof String ? String(value) : value;
}
```
The `input` array will have a regular `string` at index `1`, but its object at index `0` will have an `instanceof String` as `.a` property.
That is the key to place back values from the rest of the array, so that per each property of the object at index `0`, if the value is an `instanceof` String, something not serializable via JSON, it means it can be used to retrieve the position of its value from the `input` array.
If such `value` is an object and it hasn't been parsed yet, add it as parsed and go through all its properties/values.
```js
// outside any loop ...
const parsed = new Set;
// ... per each property/value ...
if (value instanceof Primitive) {
const tmp = input[parseInt(value)];
if (typeof tmp === 'object' && !parsed.has(tmp)) {
parsed.add(tmp);
output[key] = tmp;
if (typeof tmp === 'object' && tmp != null) {
// perform this same logic per
// each nested property/value ...
}
} else {
output[key] = tmp;
}
} else
output[key] = tmp;
```
As summary, the whole logic is based on polluting the de-serialization with a kind of variable that is unexpected, hence secure to use as directive to retrieve an index with a value.
The usage of a `Map` and a `Set` to flag known references/strings as visited/stored makes **flatted** a rock solid, fast, and compact, solution.

116
node_modules/flatted/cjs/index.js generated vendored Normal file
View File

@ -0,0 +1,116 @@
var Flatted = (function (Primitive, primitive) {
/*!
* ISC License
*
* Copyright (c) 2018, Andrea Giammarchi, @WebReflection
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
* LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
* OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
var Flatted = {
parse: function parse(text, reviver) {
var input = JSON.parse(text, Primitives).map(primitives);
var value = input[0];
var $ = reviver || noop;
var tmp = typeof value === 'object' && value ?
revive(input, new Set, value, $) :
value;
return $.call({'': tmp}, '', tmp);
},
stringify: function stringify(value, replacer, space) {
for (var
firstRun,
known = new Map,
input = [],
output = [],
$ = replacer && typeof replacer === typeof input ?
function (k, v) {
if (k === '' || -1 < replacer.indexOf(k)) return v;
} :
(replacer || noop),
i = +set(known, input, $.call({'': value}, '', value)),
replace = function (key, value) {
if (firstRun) {
firstRun = !firstRun;
return value;
// this was invoking twice each root object
// return i < 1 ? value : $.call(this, key, value);
}
var after = $.call(this, key, value);
switch (typeof after) {
case 'object':
if (after === null) return after;
case primitive:
return known.get(after) || set(known, input, after);
}
return after;
};
i < input.length; i++
) {
firstRun = true;
output[i] = JSON.stringify(input[i], replace, space);
}
return '[' + output.join(',') + ']';
}
};
return Flatted;
function noop(key, value) {
return value;
}
function revive(input, parsed, output, $) {
return Object.keys(output).reduce(
function (output, key) {
var value = output[key];
if (value instanceof Primitive) {
var tmp = input[value];
if (typeof tmp === 'object' && !parsed.has(tmp)) {
parsed.add(tmp);
output[key] = $.call(output, key, revive(input, parsed, tmp, $));
} else {
output[key] = $.call(output, key, tmp);
}
} else
output[key] = $.call(output, key, value);
return output;
},
output
);
}
function set(known, input, value) {
var index = Primitive(input.push(value) - 1);
known.set(value, index);
return index;
}
// the two kinds of primitives
// 1. the real one
// 2. the wrapped one
function primitives(value) {
return value instanceof Primitive ? Primitive(value) : value;
}
function Primitives(key, value) {
return typeof value === primitive ? new Primitive(value) : value;
}
}(String, 'string'));
module.exports = Flatted;

118
node_modules/flatted/esm/index.js generated vendored Normal file
View File

@ -0,0 +1,118 @@
var Flatted = (function (Primitive, primitive) {
/*!
* ISC License
*
* Copyright (c) 2018, Andrea Giammarchi, @WebReflection
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
* LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
* OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
var Flatted = {
parse: function parse(text, reviver) {
var input = JSON.parse(text, Primitives).map(primitives);
var value = input[0];
var $ = reviver || noop;
var tmp = typeof value === 'object' && value ?
revive(input, new Set, value, $) :
value;
return $.call({'': tmp}, '', tmp);
},
stringify: function stringify(value, replacer, space) {
for (var
firstRun,
known = new Map,
input = [],
output = [],
$ = replacer && typeof replacer === typeof input ?
function (k, v) {
if (k === '' || -1 < replacer.indexOf(k)) return v;
} :
(replacer || noop),
i = +set(known, input, $.call({'': value}, '', value)),
replace = function (key, value) {
if (firstRun) {
firstRun = !firstRun;
return value;
// this was invoking twice each root object
// return i < 1 ? value : $.call(this, key, value);
}
var after = $.call(this, key, value);
switch (typeof after) {
case 'object':
if (after === null) return after;
case primitive:
return known.get(after) || set(known, input, after);
}
return after;
};
i < input.length; i++
) {
firstRun = true;
output[i] = JSON.stringify(input[i], replace, space);
}
return '[' + output.join(',') + ']';
}
};
return Flatted;
function noop(key, value) {
return value;
}
function revive(input, parsed, output, $) {
return Object.keys(output).reduce(
function (output, key) {
var value = output[key];
if (value instanceof Primitive) {
var tmp = input[value];
if (typeof tmp === 'object' && !parsed.has(tmp)) {
parsed.add(tmp);
output[key] = $.call(output, key, revive(input, parsed, tmp, $));
} else {
output[key] = $.call(output, key, tmp);
}
} else
output[key] = $.call(output, key, value);
return output;
},
output
);
}
function set(known, input, value) {
var index = Primitive(input.push(value) - 1);
known.set(value, index);
return index;
}
// the two kinds of primitives
// 1. the real one
// 2. the wrapped one
function primitives(value) {
return value instanceof Primitive ? Primitive(value) : value;
}
function Primitives(key, value) {
return typeof value === primitive ? new Primitive(value) : value;
}
}(String, 'string'));
export default Flatted;
export var parse = Flatted.parse;
export var stringify = Flatted.stringify;

115
node_modules/flatted/index.js generated vendored Normal file
View File

@ -0,0 +1,115 @@
var Flatted = (function (Primitive, primitive) {
/*!
* ISC License
*
* Copyright (c) 2018, Andrea Giammarchi, @WebReflection
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
* LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
* OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
var Flatted = {
parse: function parse(text, reviver) {
var input = JSON.parse(text, Primitives).map(primitives);
var value = input[0];
var $ = reviver || noop;
var tmp = typeof value === 'object' && value ?
revive(input, new Set, value, $) :
value;
return $.call({'': tmp}, '', tmp);
},
stringify: function stringify(value, replacer, space) {
for (var
firstRun,
known = new Map,
input = [],
output = [],
$ = replacer && typeof replacer === typeof input ?
function (k, v) {
if (k === '' || -1 < replacer.indexOf(k)) return v;
} :
(replacer || noop),
i = +set(known, input, $.call({'': value}, '', value)),
replace = function (key, value) {
if (firstRun) {
firstRun = !firstRun;
return value;
// this was invoking twice each root object
// return i < 1 ? value : $.call(this, key, value);
}
var after = $.call(this, key, value);
switch (typeof after) {
case 'object':
if (after === null) return after;
case primitive:
return known.get(after) || set(known, input, after);
}
return after;
};
i < input.length; i++
) {
firstRun = true;
output[i] = JSON.stringify(input[i], replace, space);
}
return '[' + output.join(',') + ']';
}
};
return Flatted;
function noop(key, value) {
return value;
}
function revive(input, parsed, output, $) {
return Object.keys(output).reduce(
function (output, key) {
var value = output[key];
if (value instanceof Primitive) {
var tmp = input[value];
if (typeof tmp === 'object' && !parsed.has(tmp)) {
parsed.add(tmp);
output[key] = $.call(output, key, revive(input, parsed, tmp, $));
} else {
output[key] = $.call(output, key, tmp);
}
} else
output[key] = $.call(output, key, value);
return output;
},
output
);
}
function set(known, input, value) {
var index = Primitive(input.push(value) - 1);
known.set(value, index);
return index;
}
// the two kinds of primitives
// 1. the real one
// 2. the wrapped one
function primitives(value) {
return value instanceof Primitive ? Primitive(value) : value;
}
function Primitives(key, value) {
return typeof value === primitive ? new Primitive(value) : value;
}
}(String, 'string'));

2
node_modules/flatted/min.js generated vendored Normal file
View File

@ -0,0 +1,2 @@
/*! (c) 2018, Andrea Giammarchi, (ISC) */
var Flatted=function(a,l){return{parse:function(n,t){var e=JSON.parse(n,i).map(f),r=e[0],u=t||s,c="object"==typeof r&&r?function u(c,f,n,i){return Object.keys(n).reduce(function(n,t){var e=n[t];if(e instanceof a){var r=c[e];"object"!=typeof r||f.has(r)?n[t]=i.call(n,t,r):(f.add(r),n[t]=i.call(n,t,u(c,f,r,i)))}else n[t]=i.call(n,t,e);return n},n)}(e,new Set,r,u):r;return u.call({"":c},"",c)},stringify:function(n,e,t){function r(n,t){if(u)return u=!u,t;var e=a.call(this,n,t);switch(typeof e){case"object":if(null===e)return e;case l:return c.get(e)||p(c,f,e)}return e}for(var u,c=new Map,f=[],i=[],a=e&&typeof e==typeof f?function(n,t){if(""===n||-1<e.indexOf(n))return t}:e||s,o=+p(c,f,a.call({"":n},"",n));o<f.length;o++)u=!0,i[o]=JSON.stringify(f[o],r,t);return"["+i.join(",")+"]"}};function s(n,t){return t}function p(n,t,e){var r=a(t.push(e)-1);return n.set(e,r),r}function f(n){return n instanceof a?a(n):n}function i(n,t){return typeof t==l?new a(t):t}}(String,"string");

71
node_modules/flatted/package.json generated vendored Normal file
View File

@ -0,0 +1,71 @@
{
"_from": "flatted@^2.0.0",
"_id": "flatted@2.0.1",
"_inBundle": false,
"_integrity": "sha512-a1hQMktqW9Nmqr5aktAux3JMNqaucxGcjtjWnZLHX7yyPCmlSV3M54nGYbqT8K+0GhF3NBgmJCc3ma+WOgX8Jg==",
"_location": "/flatted",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "flatted@^2.0.0",
"name": "flatted",
"escapedName": "flatted",
"rawSpec": "^2.0.0",
"saveSpec": null,
"fetchSpec": "^2.0.0"
},
"_requiredBy": [
"/flat-cache"
],
"_resolved": "https://registry.npmjs.org/flatted/-/flatted-2.0.1.tgz",
"_shasum": "69e57caa8f0eacbc281d2e2cb458d46fdb449e08",
"_spec": "flatted@^2.0.0",
"_where": "/Users/Luca_Schwan/Desktop/DSABot/node_modules/flat-cache",
"author": {
"name": "Andrea Giammarchi"
},
"bugs": {
"url": "https://github.com/WebReflection/flatted/issues"
},
"bundleDependencies": false,
"deprecated": false,
"description": "A super light and fast circular JSON parser.",
"devDependencies": {
"circular-json": "latest",
"circular-json-es6": "latest",
"coveralls": "latest",
"istanbul": "latest",
"jsan": "latest",
"uglify-js": "latest"
},
"homepage": "https://github.com/WebReflection/flatted#readme",
"keywords": [
"circular",
"JSON",
"fast",
"parser",
"minimal"
],
"license": "ISC",
"main": "cjs/index.js",
"module": "esm/index.js",
"name": "flatted",
"repository": {
"type": "git",
"url": "git+https://github.com/WebReflection/flatted.git"
},
"scripts": {
"bench": "node test/bench.js",
"build": "npm run cjs && npm test && npm run esm && npm run min && npm run size",
"cjs": "cp index.js cjs/index.js; echo 'module.exports = Flatted;' >> cjs/index.js",
"coveralls": "cat ./coverage/lcov.info | coveralls",
"esm": "cp index.js esm/index.js; echo 'export default Flatted;' >> esm/index.js; echo 'export var parse = Flatted.parse;' >> esm/index.js; echo 'export var stringify = Flatted.stringify;' >> esm/index.js",
"min": "echo '/*! (c) 2018, Andrea Giammarchi, (ISC) */'>min.js && uglifyjs index.js --support-ie8 -c -m >> min.js",
"size": "cat index.js | wc -c;cat min.js | wc -c;gzip -c9 min.js | wc -c;cat min.js | brotli | wc -c",
"test": "istanbul cover test/index.js"
},
"types": "types.d.ts",
"unpkg": "min.js",
"version": "2.0.1"
}

19
node_modules/flatted/types.d.ts generated vendored Normal file
View File

@ -0,0 +1,19 @@
/**
* Fast and minimal circular JSON parser.
* logic example
```js
var a = [{one: 1}, {two: '2'}];
a[0].a = a;
// a is the main object, will be at index '0'
// {one: 1} is the second object, index '1'
// {two: '2'} the third, in '2', and it has a string
// which will be found at index '3'
Flatted.stringify(a);
// [["1","2"],{"one":1,"a":"0"},{"two":"3"},"2"]
// a[one,two] {one: 1, a} {two: '2'} '2'
```
*/
declare const Flatted: typeof JSON;
export = Flatted;