Aktueller Stand

This commit is contained in:
2026-01-23 01:33:35 +01:00
parent 082dc5e110
commit 2766dd12c5
10109 changed files with 1578841 additions and 77685 deletions

View File

@@ -0,0 +1,19 @@
import { constant } from './constant.js';
import { FrequencyArbitrary } from './_internals/FrequencyArbitrary.js';
import { safeHasOwnProperty } from '../utils/globals.js';
export function option(arb, constraints = {}) {
const freq = constraints.freq == null ? 5 : constraints.freq;
const nilValue = safeHasOwnProperty(constraints, 'nil') ? constraints.nil : null;
const nilArb = constant(nilValue);
const weightedArbs = [
{ arbitrary: nilArb, weight: 1, fallbackValue: { default: nilValue } },
{ arbitrary: arb, weight: freq },
];
const frequencyConstraints = {
withCrossShrink: true,
depthSize: constraints.depthSize,
maxDepth: constraints.maxDepth,
depthIdentifier: constraints.depthIdentifier,
};
return FrequencyArbitrary.from(weightedArbs, frequencyConstraints, 'fc.option');
}