Erster Docker-Stand
This commit is contained in:
16
_node_modules/fast-check/lib/arbitrary/_internals/mappers/ArrayToMap.js
generated
Normal file
16
_node_modules/fast-check/lib/arbitrary/_internals/mappers/ArrayToMap.js
generated
Normal file
@@ -0,0 +1,16 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.arrayToMapMapper = arrayToMapMapper;
|
||||
exports.arrayToMapUnmapper = arrayToMapUnmapper;
|
||||
function arrayToMapMapper(data) {
|
||||
return new Map(data);
|
||||
}
|
||||
function arrayToMapUnmapper(value) {
|
||||
if (typeof value !== 'object' || value === null) {
|
||||
throw new Error('Incompatible instance received: should be a non-null object');
|
||||
}
|
||||
if (!('constructor' in value) || value.constructor !== Map) {
|
||||
throw new Error('Incompatible instance received: should be of exact type Map');
|
||||
}
|
||||
return Array.from(value);
|
||||
}
|
||||
16
_node_modules/fast-check/lib/arbitrary/_internals/mappers/ArrayToSet.js
generated
Normal file
16
_node_modules/fast-check/lib/arbitrary/_internals/mappers/ArrayToSet.js
generated
Normal file
@@ -0,0 +1,16 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.arrayToSetMapper = arrayToSetMapper;
|
||||
exports.arrayToSetUnmapper = arrayToSetUnmapper;
|
||||
function arrayToSetMapper(data) {
|
||||
return new Set(data);
|
||||
}
|
||||
function arrayToSetUnmapper(value) {
|
||||
if (typeof value !== 'object' || value === null) {
|
||||
throw new Error('Incompatible instance received: should be a non-null object');
|
||||
}
|
||||
if (!('constructor' in value) || value.constructor !== Set) {
|
||||
throw new Error('Incompatible instance received: should be of exact type Set');
|
||||
}
|
||||
return Array.from(value);
|
||||
}
|
||||
14
_node_modules/fast-check/lib/arbitrary/_internals/mappers/CharsToString.js
generated
Normal file
14
_node_modules/fast-check/lib/arbitrary/_internals/mappers/CharsToString.js
generated
Normal file
@@ -0,0 +1,14 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.charsToStringMapper = charsToStringMapper;
|
||||
exports.charsToStringUnmapper = charsToStringUnmapper;
|
||||
const globals_1 = require("../../../utils/globals");
|
||||
function charsToStringMapper(tab) {
|
||||
return (0, globals_1.safeJoin)(tab, '');
|
||||
}
|
||||
function charsToStringUnmapper(value) {
|
||||
if (typeof value !== 'string') {
|
||||
throw new Error('Cannot unmap the passed value');
|
||||
}
|
||||
return (0, globals_1.safeSplit)(value, '');
|
||||
}
|
||||
14
_node_modules/fast-check/lib/arbitrary/_internals/mappers/CodePointsToString.js
generated
Normal file
14
_node_modules/fast-check/lib/arbitrary/_internals/mappers/CodePointsToString.js
generated
Normal file
@@ -0,0 +1,14 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.codePointsToStringMapper = codePointsToStringMapper;
|
||||
exports.codePointsToStringUnmapper = codePointsToStringUnmapper;
|
||||
const globals_1 = require("../../../utils/globals");
|
||||
function codePointsToStringMapper(tab) {
|
||||
return (0, globals_1.safeJoin)(tab, '');
|
||||
}
|
||||
function codePointsToStringUnmapper(value) {
|
||||
if (typeof value !== 'string') {
|
||||
throw new Error('Cannot unmap the passed value');
|
||||
}
|
||||
return [...value];
|
||||
}
|
||||
85
_node_modules/fast-check/lib/arbitrary/_internals/mappers/EntitiesToIPv6.js
generated
Normal file
85
_node_modules/fast-check/lib/arbitrary/_internals/mappers/EntitiesToIPv6.js
generated
Normal file
@@ -0,0 +1,85 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.fullySpecifiedMapper = fullySpecifiedMapper;
|
||||
exports.fullySpecifiedUnmapper = fullySpecifiedUnmapper;
|
||||
exports.onlyTrailingMapper = onlyTrailingMapper;
|
||||
exports.onlyTrailingUnmapper = onlyTrailingUnmapper;
|
||||
exports.multiTrailingMapper = multiTrailingMapper;
|
||||
exports.multiTrailingUnmapper = multiTrailingUnmapper;
|
||||
exports.multiTrailingMapperOne = multiTrailingMapperOne;
|
||||
exports.multiTrailingUnmapperOne = multiTrailingUnmapperOne;
|
||||
exports.singleTrailingMapper = singleTrailingMapper;
|
||||
exports.singleTrailingUnmapper = singleTrailingUnmapper;
|
||||
exports.noTrailingMapper = noTrailingMapper;
|
||||
exports.noTrailingUnmapper = noTrailingUnmapper;
|
||||
const globals_1 = require("../../../utils/globals");
|
||||
function readBh(value) {
|
||||
if (value.length === 0)
|
||||
return [];
|
||||
else
|
||||
return (0, globals_1.safeSplit)(value, ':');
|
||||
}
|
||||
function extractEhAndL(value) {
|
||||
const valueSplits = (0, globals_1.safeSplit)(value, ':');
|
||||
if (valueSplits.length >= 2 && valueSplits[valueSplits.length - 1].length <= 4) {
|
||||
return [
|
||||
(0, globals_1.safeSlice)(valueSplits, 0, valueSplits.length - 2),
|
||||
`${valueSplits[valueSplits.length - 2]}:${valueSplits[valueSplits.length - 1]}`,
|
||||
];
|
||||
}
|
||||
return [(0, globals_1.safeSlice)(valueSplits, 0, valueSplits.length - 1), valueSplits[valueSplits.length - 1]];
|
||||
}
|
||||
function fullySpecifiedMapper(data) {
|
||||
return `${(0, globals_1.safeJoin)(data[0], ':')}:${data[1]}`;
|
||||
}
|
||||
function fullySpecifiedUnmapper(value) {
|
||||
if (typeof value !== 'string')
|
||||
throw new Error('Invalid type');
|
||||
return extractEhAndL(value);
|
||||
}
|
||||
function onlyTrailingMapper(data) {
|
||||
return `::${(0, globals_1.safeJoin)(data[0], ':')}:${data[1]}`;
|
||||
}
|
||||
function onlyTrailingUnmapper(value) {
|
||||
if (typeof value !== 'string')
|
||||
throw new Error('Invalid type');
|
||||
if (!(0, globals_1.safeStartsWith)(value, '::'))
|
||||
throw new Error('Invalid value');
|
||||
return extractEhAndL((0, globals_1.safeSubstring)(value, 2));
|
||||
}
|
||||
function multiTrailingMapper(data) {
|
||||
return `${(0, globals_1.safeJoin)(data[0], ':')}::${(0, globals_1.safeJoin)(data[1], ':')}:${data[2]}`;
|
||||
}
|
||||
function multiTrailingUnmapper(value) {
|
||||
if (typeof value !== 'string')
|
||||
throw new Error('Invalid type');
|
||||
const [bhString, trailingString] = (0, globals_1.safeSplit)(value, '::', 2);
|
||||
const [eh, l] = extractEhAndL(trailingString);
|
||||
return [readBh(bhString), eh, l];
|
||||
}
|
||||
function multiTrailingMapperOne(data) {
|
||||
return multiTrailingMapper([data[0], [data[1]], data[2]]);
|
||||
}
|
||||
function multiTrailingUnmapperOne(value) {
|
||||
const out = multiTrailingUnmapper(value);
|
||||
return [out[0], (0, globals_1.safeJoin)(out[1], ':'), out[2]];
|
||||
}
|
||||
function singleTrailingMapper(data) {
|
||||
return `${(0, globals_1.safeJoin)(data[0], ':')}::${data[1]}`;
|
||||
}
|
||||
function singleTrailingUnmapper(value) {
|
||||
if (typeof value !== 'string')
|
||||
throw new Error('Invalid type');
|
||||
const [bhString, trailing] = (0, globals_1.safeSplit)(value, '::', 2);
|
||||
return [readBh(bhString), trailing];
|
||||
}
|
||||
function noTrailingMapper(data) {
|
||||
return `${(0, globals_1.safeJoin)(data[0], ':')}::`;
|
||||
}
|
||||
function noTrailingUnmapper(value) {
|
||||
if (typeof value !== 'string')
|
||||
throw new Error('Invalid type');
|
||||
if (!(0, globals_1.safeEndsWith)(value, '::'))
|
||||
throw new Error('Invalid value');
|
||||
return [readBh((0, globals_1.safeSubstring)(value, 0, value.length - 2))];
|
||||
}
|
||||
23
_node_modules/fast-check/lib/arbitrary/_internals/mappers/IndexToCharString.js
generated
Normal file
23
_node_modules/fast-check/lib/arbitrary/_internals/mappers/IndexToCharString.js
generated
Normal file
@@ -0,0 +1,23 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.indexToCharStringMapper = void 0;
|
||||
exports.indexToCharStringUnmapper = indexToCharStringUnmapper;
|
||||
const globals_1 = require("../../../utils/globals");
|
||||
exports.indexToCharStringMapper = String.fromCodePoint;
|
||||
function indexToCharStringUnmapper(c) {
|
||||
if (typeof c !== 'string') {
|
||||
throw new Error('Cannot unmap non-string');
|
||||
}
|
||||
if (c.length === 0 || c.length > 2) {
|
||||
throw new Error('Cannot unmap string with more or less than one character');
|
||||
}
|
||||
const c1 = (0, globals_1.safeCharCodeAt)(c, 0);
|
||||
if (c.length === 1) {
|
||||
return c1;
|
||||
}
|
||||
const c2 = (0, globals_1.safeCharCodeAt)(c, 1);
|
||||
if (c1 < 0xd800 || c1 > 0xdbff || c2 < 0xdc00 || c2 > 0xdfff) {
|
||||
throw new Error('Cannot unmap invalid surrogate pairs');
|
||||
}
|
||||
return c.codePointAt(0);
|
||||
}
|
||||
71
_node_modules/fast-check/lib/arbitrary/_internals/mappers/IndexToMappedConstant.js
generated
Normal file
71
_node_modules/fast-check/lib/arbitrary/_internals/mappers/IndexToMappedConstant.js
generated
Normal file
@@ -0,0 +1,71 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.indexToMappedConstantMapperFor = indexToMappedConstantMapperFor;
|
||||
exports.indexToMappedConstantUnmapperFor = indexToMappedConstantUnmapperFor;
|
||||
const globals_1 = require("../../../utils/globals");
|
||||
const safeObjectIs = Object.is;
|
||||
function buildDichotomyEntries(entries) {
|
||||
let currentFrom = 0;
|
||||
const dichotomyEntries = [];
|
||||
for (const entry of entries) {
|
||||
const from = currentFrom;
|
||||
currentFrom = from + entry.num;
|
||||
const to = currentFrom - 1;
|
||||
dichotomyEntries.push({ from, to, entry });
|
||||
}
|
||||
return dichotomyEntries;
|
||||
}
|
||||
function findDichotomyEntry(dichotomyEntries, choiceIndex) {
|
||||
let min = 0;
|
||||
let max = dichotomyEntries.length;
|
||||
while (max - min > 1) {
|
||||
const mid = ~~((min + max) / 2);
|
||||
if (choiceIndex < dichotomyEntries[mid].from) {
|
||||
max = mid;
|
||||
}
|
||||
else {
|
||||
min = mid;
|
||||
}
|
||||
}
|
||||
return dichotomyEntries[min];
|
||||
}
|
||||
function indexToMappedConstantMapperFor(entries) {
|
||||
const dichotomyEntries = buildDichotomyEntries(entries);
|
||||
return function indexToMappedConstantMapper(choiceIndex) {
|
||||
const dichotomyEntry = findDichotomyEntry(dichotomyEntries, choiceIndex);
|
||||
return dichotomyEntry.entry.build(choiceIndex - dichotomyEntry.from);
|
||||
};
|
||||
}
|
||||
function buildReverseMapping(entries) {
|
||||
const reverseMapping = { mapping: new globals_1.Map(), negativeZeroIndex: undefined };
|
||||
let choiceIndex = 0;
|
||||
for (let entryIdx = 0; entryIdx !== entries.length; ++entryIdx) {
|
||||
const entry = entries[entryIdx];
|
||||
for (let idxInEntry = 0; idxInEntry !== entry.num; ++idxInEntry) {
|
||||
const value = entry.build(idxInEntry);
|
||||
if (value === 0 && 1 / value === globals_1.Number.NEGATIVE_INFINITY) {
|
||||
reverseMapping.negativeZeroIndex = choiceIndex;
|
||||
}
|
||||
else {
|
||||
(0, globals_1.safeMapSet)(reverseMapping.mapping, value, choiceIndex);
|
||||
}
|
||||
++choiceIndex;
|
||||
}
|
||||
}
|
||||
return reverseMapping;
|
||||
}
|
||||
function indexToMappedConstantUnmapperFor(entries) {
|
||||
let reverseMapping = null;
|
||||
return function indexToMappedConstantUnmapper(value) {
|
||||
if (reverseMapping === null) {
|
||||
reverseMapping = buildReverseMapping(entries);
|
||||
}
|
||||
const choiceIndex = safeObjectIs(value, -0)
|
||||
? reverseMapping.negativeZeroIndex
|
||||
: (0, globals_1.safeMapGet)(reverseMapping.mapping, value);
|
||||
if (choiceIndex === undefined) {
|
||||
throw new globals_1.Error('Unknown value encountered cannot be built using this mapToConstant');
|
||||
}
|
||||
return choiceIndex;
|
||||
};
|
||||
}
|
||||
18
_node_modules/fast-check/lib/arbitrary/_internals/mappers/IndexToPrintableIndex.js
generated
Normal file
18
_node_modules/fast-check/lib/arbitrary/_internals/mappers/IndexToPrintableIndex.js
generated
Normal file
@@ -0,0 +1,18 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.indexToPrintableIndexMapper = indexToPrintableIndexMapper;
|
||||
exports.indexToPrintableIndexUnmapper = indexToPrintableIndexUnmapper;
|
||||
function indexToPrintableIndexMapper(v) {
|
||||
if (v < 95)
|
||||
return v + 0x20;
|
||||
if (v <= 0x7e)
|
||||
return v - 95;
|
||||
return v;
|
||||
}
|
||||
function indexToPrintableIndexUnmapper(v) {
|
||||
if (v >= 0x20 && v <= 0x7e)
|
||||
return v - 0x20;
|
||||
if (v >= 0 && v <= 0x1f)
|
||||
return v + 95;
|
||||
return v;
|
||||
}
|
||||
52
_node_modules/fast-check/lib/arbitrary/_internals/mappers/KeyValuePairsToObject.js
generated
Normal file
52
_node_modules/fast-check/lib/arbitrary/_internals/mappers/KeyValuePairsToObject.js
generated
Normal file
@@ -0,0 +1,52 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.keyValuePairsToObjectMapper = keyValuePairsToObjectMapper;
|
||||
exports.keyValuePairsToObjectUnmapper = keyValuePairsToObjectUnmapper;
|
||||
const globals_1 = require("../../../utils/globals");
|
||||
const safeObjectCreate = Object.create;
|
||||
const safeObjectDefineProperty = Object.defineProperty;
|
||||
const safeObjectGetOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
||||
const safeObjectGetPrototypeOf = Object.getPrototypeOf;
|
||||
const safeObjectGetOwnPropertySymbols = Object.getOwnPropertySymbols;
|
||||
const safeObjectGetOwnPropertyNames = Object.getOwnPropertyNames;
|
||||
const safeObjectEntries = Object.entries;
|
||||
function keyValuePairsToObjectMapper(definition) {
|
||||
const obj = definition[1] ? safeObjectCreate(null) : {};
|
||||
for (const keyValue of definition[0]) {
|
||||
safeObjectDefineProperty(obj, keyValue[0], {
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
writable: true,
|
||||
value: keyValue[1],
|
||||
});
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
function buildIsValidPropertyNameFilter(obj) {
|
||||
return function isValidPropertyNameFilter(key) {
|
||||
const descriptor = safeObjectGetOwnPropertyDescriptor(obj, key);
|
||||
return (descriptor !== undefined &&
|
||||
!!descriptor.configurable &&
|
||||
!!descriptor.enumerable &&
|
||||
!!descriptor.writable &&
|
||||
descriptor.get === undefined &&
|
||||
descriptor.set === undefined);
|
||||
};
|
||||
}
|
||||
function keyValuePairsToObjectUnmapper(value) {
|
||||
if (typeof value !== 'object' || value === null) {
|
||||
throw new globals_1.Error('Incompatible instance received: should be a non-null object');
|
||||
}
|
||||
const hasNullPrototype = safeObjectGetPrototypeOf(value) === null;
|
||||
const hasObjectPrototype = 'constructor' in value && value.constructor === Object;
|
||||
if (!hasNullPrototype && !hasObjectPrototype) {
|
||||
throw new globals_1.Error('Incompatible instance received: should be of exact type Object');
|
||||
}
|
||||
if (safeObjectGetOwnPropertySymbols(value).length > 0) {
|
||||
throw new globals_1.Error('Incompatible instance received: should contain symbols');
|
||||
}
|
||||
if (!(0, globals_1.safeEvery)(safeObjectGetOwnPropertyNames(value), buildIsValidPropertyNameFilter(value))) {
|
||||
throw new globals_1.Error('Incompatible instance received: should contain only c/e/w properties without get/set');
|
||||
}
|
||||
return [safeObjectEntries(value), hasNullPrototype];
|
||||
}
|
||||
38
_node_modules/fast-check/lib/arbitrary/_internals/mappers/NatToStringifiedNat.js
generated
Normal file
38
_node_modules/fast-check/lib/arbitrary/_internals/mappers/NatToStringifiedNat.js
generated
Normal file
@@ -0,0 +1,38 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.natToStringifiedNatMapper = natToStringifiedNatMapper;
|
||||
exports.tryParseStringifiedNat = tryParseStringifiedNat;
|
||||
exports.natToStringifiedNatUnmapper = natToStringifiedNatUnmapper;
|
||||
const globals_1 = require("../../../utils/globals");
|
||||
const safeNumberParseInt = Number.parseInt;
|
||||
function natToStringifiedNatMapper(options) {
|
||||
const [style, v] = options;
|
||||
switch (style) {
|
||||
case 'oct':
|
||||
return `0${(0, globals_1.safeNumberToString)(v, 8)}`;
|
||||
case 'hex':
|
||||
return `0x${(0, globals_1.safeNumberToString)(v, 16)}`;
|
||||
case 'dec':
|
||||
default:
|
||||
return `${v}`;
|
||||
}
|
||||
}
|
||||
function tryParseStringifiedNat(stringValue, radix) {
|
||||
const parsedNat = safeNumberParseInt(stringValue, radix);
|
||||
if ((0, globals_1.safeNumberToString)(parsedNat, radix) !== stringValue) {
|
||||
throw new Error('Invalid value');
|
||||
}
|
||||
return parsedNat;
|
||||
}
|
||||
function natToStringifiedNatUnmapper(value) {
|
||||
if (typeof value !== 'string') {
|
||||
throw new Error('Invalid type');
|
||||
}
|
||||
if (value.length >= 2 && value[0] === '0') {
|
||||
if (value[1] === 'x') {
|
||||
return ['hex', tryParseStringifiedNat((0, globals_1.safeSubstring)(value, 2), 16)];
|
||||
}
|
||||
return ['oct', tryParseStringifiedNat((0, globals_1.safeSubstring)(value, 1), 8)];
|
||||
}
|
||||
return ['dec', tryParseStringifiedNat(value, 10)];
|
||||
}
|
||||
21
_node_modules/fast-check/lib/arbitrary/_internals/mappers/NumberToPaddedEight.js
generated
Normal file
21
_node_modules/fast-check/lib/arbitrary/_internals/mappers/NumberToPaddedEight.js
generated
Normal file
@@ -0,0 +1,21 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.numberToPaddedEightMapper = numberToPaddedEightMapper;
|
||||
exports.numberToPaddedEightUnmapper = numberToPaddedEightUnmapper;
|
||||
const globals_1 = require("../../../utils/globals");
|
||||
function numberToPaddedEightMapper(n) {
|
||||
return (0, globals_1.safePadStart)((0, globals_1.safeNumberToString)(n, 16), 8, '0');
|
||||
}
|
||||
function numberToPaddedEightUnmapper(value) {
|
||||
if (typeof value !== 'string') {
|
||||
throw new Error('Unsupported type');
|
||||
}
|
||||
if (value.length !== 8) {
|
||||
throw new Error('Unsupported value: invalid length');
|
||||
}
|
||||
const n = parseInt(value, 16);
|
||||
if (value !== numberToPaddedEightMapper(n)) {
|
||||
throw new Error('Unsupported value: invalid content');
|
||||
}
|
||||
return n;
|
||||
}
|
||||
19
_node_modules/fast-check/lib/arbitrary/_internals/mappers/PaddedEightsToUuid.js
generated
Normal file
19
_node_modules/fast-check/lib/arbitrary/_internals/mappers/PaddedEightsToUuid.js
generated
Normal file
@@ -0,0 +1,19 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.paddedEightsToUuidMapper = paddedEightsToUuidMapper;
|
||||
exports.paddedEightsToUuidUnmapper = paddedEightsToUuidUnmapper;
|
||||
const globals_1 = require("../../../utils/globals");
|
||||
function paddedEightsToUuidMapper(t) {
|
||||
return `${t[0]}-${(0, globals_1.safeSubstring)(t[1], 4)}-${(0, globals_1.safeSubstring)(t[1], 0, 4)}-${(0, globals_1.safeSubstring)(t[2], 0, 4)}-${(0, globals_1.safeSubstring)(t[2], 4)}${t[3]}`;
|
||||
}
|
||||
const UuidRegex = /^([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{12})$/;
|
||||
function paddedEightsToUuidUnmapper(value) {
|
||||
if (typeof value !== 'string') {
|
||||
throw new Error('Unsupported type');
|
||||
}
|
||||
const m = UuidRegex.exec(value);
|
||||
if (m === null) {
|
||||
throw new Error('Unsupported type');
|
||||
}
|
||||
return [m[1], m[3] + m[2], m[4] + (0, globals_1.safeSubstring)(m[5], 0, 4), (0, globals_1.safeSubstring)(m[5], 4)];
|
||||
}
|
||||
32
_node_modules/fast-check/lib/arbitrary/_internals/mappers/PartsToUrl.js
generated
Normal file
32
_node_modules/fast-check/lib/arbitrary/_internals/mappers/PartsToUrl.js
generated
Normal file
@@ -0,0 +1,32 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.partsToUrlMapper = partsToUrlMapper;
|
||||
exports.partsToUrlUnmapper = partsToUrlUnmapper;
|
||||
function partsToUrlMapper(data) {
|
||||
const [scheme, authority, path] = data;
|
||||
const query = data[3] === null ? '' : `?${data[3]}`;
|
||||
const fragments = data[4] === null ? '' : `#${data[4]}`;
|
||||
return `${scheme}://${authority}${path}${query}${fragments}`;
|
||||
}
|
||||
const UrlSplitRegex = /^([[A-Za-z][A-Za-z0-9+.-]*):\/\/([^/?#]*)([^?#]*)(\?[A-Za-z0-9\-._~!$&'()*+,;=:@/?%]*)?(#[A-Za-z0-9\-._~!$&'()*+,;=:@/?%]*)?$/;
|
||||
function partsToUrlUnmapper(value) {
|
||||
if (typeof value !== 'string') {
|
||||
throw new Error('Incompatible value received: type');
|
||||
}
|
||||
const m = UrlSplitRegex.exec(value);
|
||||
if (m === null) {
|
||||
throw new Error('Incompatible value received');
|
||||
}
|
||||
const scheme = m[1];
|
||||
const authority = m[2];
|
||||
const path = m[3];
|
||||
const query = m[4];
|
||||
const fragments = m[5];
|
||||
return [
|
||||
scheme,
|
||||
authority,
|
||||
path,
|
||||
query !== undefined ? query.substring(1) : null,
|
||||
fragments !== undefined ? fragments.substring(1) : null,
|
||||
];
|
||||
}
|
||||
32
_node_modules/fast-check/lib/arbitrary/_internals/mappers/PatternsToString.js
generated
Normal file
32
_node_modules/fast-check/lib/arbitrary/_internals/mappers/PatternsToString.js
generated
Normal file
@@ -0,0 +1,32 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.patternsToStringMapper = patternsToStringMapper;
|
||||
exports.patternsToStringUnmapperIsValidLength = patternsToStringUnmapperIsValidLength;
|
||||
exports.patternsToStringUnmapperFor = patternsToStringUnmapperFor;
|
||||
const MaxLengthFromMinLength_1 = require("../helpers/MaxLengthFromMinLength");
|
||||
const globals_1 = require("../../../utils/globals");
|
||||
const TokenizeString_1 = require("../helpers/TokenizeString");
|
||||
function patternsToStringMapper(tab) {
|
||||
return (0, globals_1.safeJoin)(tab, '');
|
||||
}
|
||||
function minLengthFrom(constraints) {
|
||||
return constraints.minLength !== undefined ? constraints.minLength : 0;
|
||||
}
|
||||
function maxLengthFrom(constraints) {
|
||||
return constraints.maxLength !== undefined ? constraints.maxLength : MaxLengthFromMinLength_1.MaxLengthUpperBound;
|
||||
}
|
||||
function patternsToStringUnmapperIsValidLength(tokens, constraints) {
|
||||
return minLengthFrom(constraints) <= tokens.length && tokens.length <= maxLengthFrom(constraints);
|
||||
}
|
||||
function patternsToStringUnmapperFor(patternsArb, constraints) {
|
||||
return function patternsToStringUnmapper(value) {
|
||||
if (typeof value !== 'string') {
|
||||
throw new globals_1.Error('Unsupported value');
|
||||
}
|
||||
const tokens = (0, TokenizeString_1.tokenizeString)(patternsArb, value, minLengthFrom(constraints), maxLengthFrom(constraints));
|
||||
if (tokens === undefined) {
|
||||
throw new globals_1.Error('Unable to unmap received string');
|
||||
}
|
||||
return tokens;
|
||||
};
|
||||
}
|
||||
17
_node_modules/fast-check/lib/arbitrary/_internals/mappers/SegmentsToPath.js
generated
Normal file
17
_node_modules/fast-check/lib/arbitrary/_internals/mappers/SegmentsToPath.js
generated
Normal file
@@ -0,0 +1,17 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.segmentsToPathMapper = segmentsToPathMapper;
|
||||
exports.segmentsToPathUnmapper = segmentsToPathUnmapper;
|
||||
const globals_1 = require("../../../utils/globals");
|
||||
function segmentsToPathMapper(segments) {
|
||||
return (0, globals_1.safeJoin)((0, globals_1.safeMap)(segments, (v) => `/${v}`), '');
|
||||
}
|
||||
function segmentsToPathUnmapper(value) {
|
||||
if (typeof value !== 'string') {
|
||||
throw new Error('Incompatible value received: type');
|
||||
}
|
||||
if (value.length !== 0 && value[0] !== '/') {
|
||||
throw new Error('Incompatible value received: start');
|
||||
}
|
||||
return (0, globals_1.safeSplice)((0, globals_1.safeSplit)(value, '/'), 1);
|
||||
}
|
||||
31
_node_modules/fast-check/lib/arbitrary/_internals/mappers/StringToBase64.js
generated
Normal file
31
_node_modules/fast-check/lib/arbitrary/_internals/mappers/StringToBase64.js
generated
Normal file
@@ -0,0 +1,31 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.stringToBase64Mapper = stringToBase64Mapper;
|
||||
exports.stringToBase64Unmapper = stringToBase64Unmapper;
|
||||
const globals_1 = require("../../../utils/globals");
|
||||
function stringToBase64Mapper(s) {
|
||||
switch (s.length % 4) {
|
||||
case 0:
|
||||
return s;
|
||||
case 3:
|
||||
return `${s}=`;
|
||||
case 2:
|
||||
return `${s}==`;
|
||||
default:
|
||||
return (0, globals_1.safeSubstring)(s, 1);
|
||||
}
|
||||
}
|
||||
function stringToBase64Unmapper(value) {
|
||||
if (typeof value !== 'string' || value.length % 4 !== 0) {
|
||||
throw new Error('Invalid string received');
|
||||
}
|
||||
const lastTrailingIndex = value.indexOf('=');
|
||||
if (lastTrailingIndex === -1) {
|
||||
return value;
|
||||
}
|
||||
const numTrailings = value.length - lastTrailingIndex;
|
||||
if (numTrailings > 2) {
|
||||
throw new Error('Cannot unmap the passed value');
|
||||
}
|
||||
return (0, globals_1.safeSubstring)(value, 0, lastTrailingIndex);
|
||||
}
|
||||
29
_node_modules/fast-check/lib/arbitrary/_internals/mappers/TimeToDate.js
generated
Normal file
29
_node_modules/fast-check/lib/arbitrary/_internals/mappers/TimeToDate.js
generated
Normal file
@@ -0,0 +1,29 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.timeToDateMapper = timeToDateMapper;
|
||||
exports.timeToDateUnmapper = timeToDateUnmapper;
|
||||
exports.timeToDateMapperWithNaN = timeToDateMapperWithNaN;
|
||||
exports.timeToDateUnmapperWithNaN = timeToDateUnmapperWithNaN;
|
||||
const globals_1 = require("../../../utils/globals");
|
||||
const safeNaN = Number.NaN;
|
||||
const safeNumberIsNaN = Number.isNaN;
|
||||
function timeToDateMapper(time) {
|
||||
return new globals_1.Date(time);
|
||||
}
|
||||
function timeToDateUnmapper(value) {
|
||||
if (!(value instanceof globals_1.Date) || value.constructor !== globals_1.Date) {
|
||||
throw new globals_1.Error('Not a valid value for date unmapper');
|
||||
}
|
||||
return (0, globals_1.safeGetTime)(value);
|
||||
}
|
||||
function timeToDateMapperWithNaN(valueForNaN) {
|
||||
return (time) => {
|
||||
return time === valueForNaN ? new globals_1.Date(safeNaN) : timeToDateMapper(time);
|
||||
};
|
||||
}
|
||||
function timeToDateUnmapperWithNaN(valueForNaN) {
|
||||
return (value) => {
|
||||
const time = timeToDateUnmapper(value);
|
||||
return safeNumberIsNaN(time) ? valueForNaN : time;
|
||||
};
|
||||
}
|
||||
111
_node_modules/fast-check/lib/arbitrary/_internals/mappers/UintToBase32String.js
generated
Normal file
111
_node_modules/fast-check/lib/arbitrary/_internals/mappers/UintToBase32String.js
generated
Normal file
@@ -0,0 +1,111 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.uintToBase32StringMapper = uintToBase32StringMapper;
|
||||
exports.paddedUintToBase32StringMapper = paddedUintToBase32StringMapper;
|
||||
exports.uintToBase32StringUnmapper = uintToBase32StringUnmapper;
|
||||
const globals_1 = require("../../../utils/globals");
|
||||
const encodeSymbolLookupTable = {
|
||||
10: 'A',
|
||||
11: 'B',
|
||||
12: 'C',
|
||||
13: 'D',
|
||||
14: 'E',
|
||||
15: 'F',
|
||||
16: 'G',
|
||||
17: 'H',
|
||||
18: 'J',
|
||||
19: 'K',
|
||||
20: 'M',
|
||||
21: 'N',
|
||||
22: 'P',
|
||||
23: 'Q',
|
||||
24: 'R',
|
||||
25: 'S',
|
||||
26: 'T',
|
||||
27: 'V',
|
||||
28: 'W',
|
||||
29: 'X',
|
||||
30: 'Y',
|
||||
31: 'Z',
|
||||
};
|
||||
const decodeSymbolLookupTable = {
|
||||
'0': 0,
|
||||
'1': 1,
|
||||
'2': 2,
|
||||
'3': 3,
|
||||
'4': 4,
|
||||
'5': 5,
|
||||
'6': 6,
|
||||
'7': 7,
|
||||
'8': 8,
|
||||
'9': 9,
|
||||
A: 10,
|
||||
B: 11,
|
||||
C: 12,
|
||||
D: 13,
|
||||
E: 14,
|
||||
F: 15,
|
||||
G: 16,
|
||||
H: 17,
|
||||
J: 18,
|
||||
K: 19,
|
||||
M: 20,
|
||||
N: 21,
|
||||
P: 22,
|
||||
Q: 23,
|
||||
R: 24,
|
||||
S: 25,
|
||||
T: 26,
|
||||
V: 27,
|
||||
W: 28,
|
||||
X: 29,
|
||||
Y: 30,
|
||||
Z: 31,
|
||||
};
|
||||
function encodeSymbol(symbol) {
|
||||
return symbol < 10 ? (0, globals_1.String)(symbol) : encodeSymbolLookupTable[symbol];
|
||||
}
|
||||
function pad(value, paddingLength) {
|
||||
let extraPadding = '';
|
||||
while (value.length + extraPadding.length < paddingLength) {
|
||||
extraPadding += '0';
|
||||
}
|
||||
return extraPadding + value;
|
||||
}
|
||||
function smallUintToBase32StringMapper(num) {
|
||||
let base32Str = '';
|
||||
for (let remaining = num; remaining !== 0;) {
|
||||
const next = remaining >> 5;
|
||||
const current = remaining - (next << 5);
|
||||
base32Str = encodeSymbol(current) + base32Str;
|
||||
remaining = next;
|
||||
}
|
||||
return base32Str;
|
||||
}
|
||||
function uintToBase32StringMapper(num, paddingLength) {
|
||||
const head = ~~(num / 0x40000000);
|
||||
const tail = num & 0x3fffffff;
|
||||
return pad(smallUintToBase32StringMapper(head), paddingLength - 6) + pad(smallUintToBase32StringMapper(tail), 6);
|
||||
}
|
||||
function paddedUintToBase32StringMapper(paddingLength) {
|
||||
return function padded(num) {
|
||||
return uintToBase32StringMapper(num, paddingLength);
|
||||
};
|
||||
}
|
||||
function uintToBase32StringUnmapper(value) {
|
||||
if (typeof value !== 'string') {
|
||||
throw new globals_1.Error('Unsupported type');
|
||||
}
|
||||
let accumulated = 0;
|
||||
let power = 1;
|
||||
for (let index = value.length - 1; index >= 0; --index) {
|
||||
const char = value[index];
|
||||
const numericForChar = decodeSymbolLookupTable[char];
|
||||
if (numericForChar === undefined) {
|
||||
throw new globals_1.Error('Unsupported type');
|
||||
}
|
||||
accumulated += numericForChar * power;
|
||||
power *= 32;
|
||||
}
|
||||
return accumulated;
|
||||
}
|
||||
25
_node_modules/fast-check/lib/arbitrary/_internals/mappers/UnboxedToBoxed.js
generated
Normal file
25
_node_modules/fast-check/lib/arbitrary/_internals/mappers/UnboxedToBoxed.js
generated
Normal file
@@ -0,0 +1,25 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.unboxedToBoxedMapper = unboxedToBoxedMapper;
|
||||
exports.unboxedToBoxedUnmapper = unboxedToBoxedUnmapper;
|
||||
const globals_1 = require("../../../utils/globals");
|
||||
function unboxedToBoxedMapper(value) {
|
||||
switch (typeof value) {
|
||||
case 'boolean':
|
||||
return new globals_1.Boolean(value);
|
||||
case 'number':
|
||||
return new globals_1.Number(value);
|
||||
case 'string':
|
||||
return new globals_1.String(value);
|
||||
default:
|
||||
return value;
|
||||
}
|
||||
}
|
||||
function unboxedToBoxedUnmapper(value) {
|
||||
if (typeof value !== 'object' || value === null || !('constructor' in value)) {
|
||||
return value;
|
||||
}
|
||||
return value.constructor === globals_1.Boolean || value.constructor === globals_1.Number || value.constructor === globals_1.String
|
||||
? value.valueOf()
|
||||
: value;
|
||||
}
|
||||
63
_node_modules/fast-check/lib/arbitrary/_internals/mappers/ValuesAndSeparateKeysToObject.js
generated
Normal file
63
_node_modules/fast-check/lib/arbitrary/_internals/mappers/ValuesAndSeparateKeysToObject.js
generated
Normal file
@@ -0,0 +1,63 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.buildValuesAndSeparateKeysToObjectMapper = buildValuesAndSeparateKeysToObjectMapper;
|
||||
exports.buildValuesAndSeparateKeysToObjectUnmapper = buildValuesAndSeparateKeysToObjectUnmapper;
|
||||
const globals_1 = require("../../../utils/globals");
|
||||
const safeObjectCreate = Object.create;
|
||||
const safeObjectDefineProperty = Object.defineProperty;
|
||||
const safeObjectGetOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
||||
const safeObjectGetOwnPropertyNames = Object.getOwnPropertyNames;
|
||||
const safeObjectGetOwnPropertySymbols = Object.getOwnPropertySymbols;
|
||||
function buildValuesAndSeparateKeysToObjectMapper(keys, noKeyValue) {
|
||||
return function valuesAndSeparateKeysToObjectMapper(definition) {
|
||||
const obj = definition[1] ? safeObjectCreate(null) : {};
|
||||
for (let idx = 0; idx !== keys.length; ++idx) {
|
||||
const valueWrapper = definition[0][idx];
|
||||
if (valueWrapper !== noKeyValue) {
|
||||
safeObjectDefineProperty(obj, keys[idx], {
|
||||
value: valueWrapper,
|
||||
configurable: true,
|
||||
enumerable: true,
|
||||
writable: true,
|
||||
});
|
||||
}
|
||||
}
|
||||
return obj;
|
||||
};
|
||||
}
|
||||
function buildValuesAndSeparateKeysToObjectUnmapper(keys, noKeyValue) {
|
||||
return function valuesAndSeparateKeysToObjectUnmapper(value) {
|
||||
if (typeof value !== 'object' || value === null) {
|
||||
throw new Error('Incompatible instance received: should be a non-null object');
|
||||
}
|
||||
const hasNullPrototype = Object.getPrototypeOf(value) === null;
|
||||
const hasObjectPrototype = 'constructor' in value && value.constructor === Object;
|
||||
if (!hasNullPrototype && !hasObjectPrototype) {
|
||||
throw new Error('Incompatible instance received: should be of exact type Object');
|
||||
}
|
||||
let extractedPropertiesCount = 0;
|
||||
const extractedValues = [];
|
||||
for (let idx = 0; idx !== keys.length; ++idx) {
|
||||
const descriptor = safeObjectGetOwnPropertyDescriptor(value, keys[idx]);
|
||||
if (descriptor !== undefined) {
|
||||
if (!descriptor.configurable || !descriptor.enumerable || !descriptor.writable) {
|
||||
throw new Error('Incompatible instance received: should contain only c/e/w properties');
|
||||
}
|
||||
if (descriptor.get !== undefined || descriptor.set !== undefined) {
|
||||
throw new Error('Incompatible instance received: should contain only no get/set properties');
|
||||
}
|
||||
++extractedPropertiesCount;
|
||||
(0, globals_1.safePush)(extractedValues, descriptor.value);
|
||||
}
|
||||
else {
|
||||
(0, globals_1.safePush)(extractedValues, noKeyValue);
|
||||
}
|
||||
}
|
||||
const namePropertiesCount = safeObjectGetOwnPropertyNames(value).length;
|
||||
const symbolPropertiesCount = safeObjectGetOwnPropertySymbols(value).length;
|
||||
if (extractedPropertiesCount !== namePropertiesCount + symbolPropertiesCount) {
|
||||
throw new Error('Incompatible instance received: should not contain extra properties');
|
||||
}
|
||||
return [extractedValues, hasNullPrototype];
|
||||
};
|
||||
}
|
||||
29
_node_modules/fast-check/lib/arbitrary/_internals/mappers/VersionsApplierForUuid.js
generated
Normal file
29
_node_modules/fast-check/lib/arbitrary/_internals/mappers/VersionsApplierForUuid.js
generated
Normal file
@@ -0,0 +1,29 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.buildVersionsAppliersForUuid = buildVersionsAppliersForUuid;
|
||||
const globals_1 = require("../../../utils/globals");
|
||||
const quickNumberToHexaString = '0123456789abcdef';
|
||||
function buildVersionsAppliersForUuid(versions) {
|
||||
const mapping = {};
|
||||
const reversedMapping = {};
|
||||
for (let index = 0; index !== versions.length; ++index) {
|
||||
const from = quickNumberToHexaString[index];
|
||||
const to = quickNumberToHexaString[versions[index]];
|
||||
mapping[from] = to;
|
||||
reversedMapping[to] = from;
|
||||
}
|
||||
function versionsApplierMapper(value) {
|
||||
return mapping[value[0]] + (0, globals_1.safeSubstring)(value, 1);
|
||||
}
|
||||
function versionsApplierUnmapper(value) {
|
||||
if (typeof value !== 'string') {
|
||||
throw new globals_1.Error('Cannot produce non-string values');
|
||||
}
|
||||
const rev = reversedMapping[value[0]];
|
||||
if (rev === undefined) {
|
||||
throw new globals_1.Error('Cannot produce strings not starting by the version in hexa code');
|
||||
}
|
||||
return rev + (0, globals_1.safeSubstring)(value, 1);
|
||||
}
|
||||
return { versionsApplierMapper, versionsApplierUnmapper };
|
||||
}
|
||||
75
_node_modules/fast-check/lib/arbitrary/_internals/mappers/WordsToLorem.js
generated
Normal file
75
_node_modules/fast-check/lib/arbitrary/_internals/mappers/WordsToLorem.js
generated
Normal file
@@ -0,0 +1,75 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.wordsToJoinedStringMapper = wordsToJoinedStringMapper;
|
||||
exports.wordsToJoinedStringUnmapperFor = wordsToJoinedStringUnmapperFor;
|
||||
exports.wordsToSentenceMapper = wordsToSentenceMapper;
|
||||
exports.wordsToSentenceUnmapperFor = wordsToSentenceUnmapperFor;
|
||||
exports.sentencesToParagraphMapper = sentencesToParagraphMapper;
|
||||
exports.sentencesToParagraphUnmapper = sentencesToParagraphUnmapper;
|
||||
const globals_1 = require("../../../utils/globals");
|
||||
function wordsToJoinedStringMapper(words) {
|
||||
return (0, globals_1.safeJoin)((0, globals_1.safeMap)(words, (w) => (w[w.length - 1] === ',' ? (0, globals_1.safeSubstring)(w, 0, w.length - 1) : w)), ' ');
|
||||
}
|
||||
function wordsToJoinedStringUnmapperFor(wordsArbitrary) {
|
||||
return function wordsToJoinedStringUnmapper(value) {
|
||||
if (typeof value !== 'string') {
|
||||
throw new Error('Unsupported type');
|
||||
}
|
||||
const words = [];
|
||||
for (const candidate of (0, globals_1.safeSplit)(value, ' ')) {
|
||||
if (wordsArbitrary.canShrinkWithoutContext(candidate))
|
||||
(0, globals_1.safePush)(words, candidate);
|
||||
else if (wordsArbitrary.canShrinkWithoutContext(candidate + ','))
|
||||
(0, globals_1.safePush)(words, candidate + ',');
|
||||
else
|
||||
throw new Error('Unsupported word');
|
||||
}
|
||||
return words;
|
||||
};
|
||||
}
|
||||
function wordsToSentenceMapper(words) {
|
||||
let sentence = (0, globals_1.safeJoin)(words, ' ');
|
||||
if (sentence[sentence.length - 1] === ',') {
|
||||
sentence = (0, globals_1.safeSubstring)(sentence, 0, sentence.length - 1);
|
||||
}
|
||||
return (0, globals_1.safeToUpperCase)(sentence[0]) + (0, globals_1.safeSubstring)(sentence, 1) + '.';
|
||||
}
|
||||
function wordsToSentenceUnmapperFor(wordsArbitrary) {
|
||||
return function wordsToSentenceUnmapper(value) {
|
||||
if (typeof value !== 'string') {
|
||||
throw new Error('Unsupported type');
|
||||
}
|
||||
if (value.length < 2 ||
|
||||
value[value.length - 1] !== '.' ||
|
||||
value[value.length - 2] === ',' ||
|
||||
(0, globals_1.safeToUpperCase)((0, globals_1.safeToLowerCase)(value[0])) !== value[0]) {
|
||||
throw new Error('Unsupported value');
|
||||
}
|
||||
const adaptedValue = (0, globals_1.safeToLowerCase)(value[0]) + (0, globals_1.safeSubstring)(value, 1, value.length - 1);
|
||||
const words = [];
|
||||
const candidates = (0, globals_1.safeSplit)(adaptedValue, ' ');
|
||||
for (let idx = 0; idx !== candidates.length; ++idx) {
|
||||
const candidate = candidates[idx];
|
||||
if (wordsArbitrary.canShrinkWithoutContext(candidate))
|
||||
(0, globals_1.safePush)(words, candidate);
|
||||
else if (idx === candidates.length - 1 && wordsArbitrary.canShrinkWithoutContext(candidate + ','))
|
||||
(0, globals_1.safePush)(words, candidate + ',');
|
||||
else
|
||||
throw new Error('Unsupported word');
|
||||
}
|
||||
return words;
|
||||
};
|
||||
}
|
||||
function sentencesToParagraphMapper(sentences) {
|
||||
return (0, globals_1.safeJoin)(sentences, ' ');
|
||||
}
|
||||
function sentencesToParagraphUnmapper(value) {
|
||||
if (typeof value !== 'string') {
|
||||
throw new Error('Unsupported type');
|
||||
}
|
||||
const sentences = (0, globals_1.safeSplit)(value, '. ');
|
||||
for (let idx = 0; idx < sentences.length - 1; ++idx) {
|
||||
sentences[idx] += '.';
|
||||
}
|
||||
return sentences;
|
||||
}
|
||||
Reference in New Issue
Block a user