Initial commit
This commit is contained in:
commit
b3a51a4115
10336 changed files with 2381973 additions and 0 deletions
18
node_modules/fast-check/lib/esm/arbitrary/dictionary.js
generated
vendored
Normal file
18
node_modules/fast-check/lib/esm/arbitrary/dictionary.js
generated
vendored
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
import { tuple } from './tuple.js';
|
||||
import { uniqueArray } from './uniqueArray.js';
|
||||
import { keyValuePairsToObjectMapper, keyValuePairsToObjectUnmapper } from './_internals/mappers/KeyValuePairsToObject.js';
|
||||
import { constant } from './constant.js';
|
||||
import { boolean } from './boolean.js';
|
||||
function dictionaryKeyExtractor(entry) {
|
||||
return entry[0];
|
||||
}
|
||||
export function dictionary(keyArb, valueArb, constraints = {}) {
|
||||
const noNullPrototype = constraints.noNullPrototype !== false;
|
||||
return tuple(uniqueArray(tuple(keyArb, valueArb), {
|
||||
minLength: constraints.minKeys,
|
||||
maxLength: constraints.maxKeys,
|
||||
size: constraints.size,
|
||||
selector: dictionaryKeyExtractor,
|
||||
depthIdentifier: constraints.depthIdentifier,
|
||||
}), noNullPrototype ? constant(false) : boolean()).map(keyValuePairsToObjectMapper, keyValuePairsToObjectUnmapper);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue