Initial commit
This commit is contained in:
commit
b3a51a4115
10336 changed files with 2381973 additions and 0 deletions
23
node_modules/fast-check/lib/esm/arbitrary/letrec.js
generated
vendored
Normal file
23
node_modules/fast-check/lib/esm/arbitrary/letrec.js
generated
vendored
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
import { LazyArbitrary } from './_internals/LazyArbitrary.js';
|
||||
import { safeHasOwnProperty } from '../utils/globals.js';
|
||||
const safeObjectCreate = Object.create;
|
||||
export function letrec(builder) {
|
||||
const lazyArbs = safeObjectCreate(null);
|
||||
const tie = (key) => {
|
||||
if (!safeHasOwnProperty(lazyArbs, key)) {
|
||||
lazyArbs[key] = new LazyArbitrary(String(key));
|
||||
}
|
||||
return lazyArbs[key];
|
||||
};
|
||||
const strictArbs = builder(tie);
|
||||
for (const key in strictArbs) {
|
||||
if (!safeHasOwnProperty(strictArbs, key)) {
|
||||
continue;
|
||||
}
|
||||
const lazyAtKey = lazyArbs[key];
|
||||
const lazyArb = lazyAtKey !== undefined ? lazyAtKey : new LazyArbitrary(key);
|
||||
lazyArb.underlying = strictArbs[key];
|
||||
lazyArbs[key] = lazyArb;
|
||||
}
|
||||
return strictArbs;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue