Create some Basura.
Optionalopts: {Options.
OptionalarrayLength?: numberMaximum size of arrays and objects.
OptionalcborSafe?: booleanGenerate only CBOR-safe types?
Optionaldepth?: numberMaximum depth of object to create.
OptionaledgeFreq?: numberHow often do edge cases happen (0-1)?
OptionalfakeSymbols?: booleanInstead of generating symbols, generate an object that will inspect as Symbol.for('string').
OptionaljsonSafe?: booleanGenerate only JSON-safe types?
OptionalnoBoxed?: booleanIgnore boxed types, like String?
Optionaloutput?: booleanAdd custom inspect functions that make output parseable JS?
OptionalrandBytes?: RandBytesRandomness
source. Defaults to a thin wrapper around
crypto.randomBytes.
Optionalscripts?: string[]List of script names to select from for generating strings. Defaults to all Unicode scripts from data.json.
OptionalstringLength?: numberMaximum size of generated strings. (in codepoints), BigInts (in bytes), and buffers (in bytes).
Optionaltypes?: Record<string, BasuraGenerator<unknown>>Additional types. The key is the type name, the value is a function used to generate, or null to prevent that type from being generated.
OptionalzalgoFreq?: numberHow frequently to zalgofy strings (0-1).
OptionalzalgoHeight?: numberMaximum depth for zalgofication. Use 0 to disable.
StaticannotationsGenerate a random type that this object currently supports. Returns null if we're already too deep.
Optionaldepth: number = 0How deep are we in the generated tree of objects already?
Might generate... Anything!
Generate an Array of up to arrayLength size, with each element of the
array being generated from the list of types this object currently
supports. Generates an empty array ([]) if we're too deep already.
Optionaldepth: number = 0How deep are we in the generated tree of objects already?
Generated array.
Generate a random BigInt of up to stringLength bytes.
Optionaldepth: number = 0How deep are we in the generated tree of objects already?
Generated BigInt, possibly negative.
Generate boolean.
Optional_depth: number = 0How deep are we in the generated tree of objects already?
Optionalreason: string = 'boolean'Reason for generating bool.
True or false.
Generate boxed Boolean.
Optional_depth: number = 0How deep are we in the generated tree of objects already?
New Boolean(true) or new Boolean(false).
Generate a Buffer of up
to stringLength size.
Optionaldepth: number = 0How deep are we in the generated tree of objects already?
NodeJS Buffer.
Generate a random Date, gaussian-distributed around today with a standard deviation of 10 years.
Optional_depth: number = 0How deep are we in the generated tree of objects already?
Generated Date.
Generate a random Error. If an AggregateError is selected, fill it with random Errors.
Optionaldepth: number = 0How deep are we in the generated tree of objects already?
Generated Error.
Generate a function of a random "species". The current species list is
stored in this.functionSpecies. See
tutorial
for more information. If we are already too deep, generates () => {}.
Optionaldepth: number = 0How deep are we in the generated tree of objects already?
Generated function.
Generate a generator that yields basura.
Optionaldepth: number = 0How deep are we in the generated tree of objects already?
Generated.
Generate signed 32-bit integer. Note: may be folded into generate_number later.
Optional_depth: number = 0How deep are we in the generated tree of objects already?
32-bit integer.
Generate a random Map with up to arrayLength elements. If we are too deep already, will generate an empty Map. Each key and value will be of a random type currently supported by this object.
Optionaldepth: number = 0How deep are we in the generated tree of objects already?
Generated Map.
Generate 64-bit floating point number, with a 10% chance of something "fun": 0, -0, NaN, Infinity, -Infinity.
Optional_depth: number = 0How deep are we in the generated tree of objects already?
Number or edge case.
Generate boxed 64-bit floating point Number, with a 10% chance of something "fun": 0, -0, NaN, Infinity, -Infinity.
Optional_depth: number = 0How deep are we in the generated tree of objects already?
Wrapped new Number(num).
Generate a random object with up to arrayLength properties. Will generate null (an Object!) if we are too deep already.
Optionaldepth: number = 0How deep are we in the generated tree of objects already?
Object or null.
Generate a rejected or resolved promise.
Optionaldepth: number = 0How deep are we in the generated tree of objects already?
Resolved or rejected promise.
Generate a Proxy over a random object. If we are already too deep,
generates a Proxy around {}.
Optionaldepth: number = 0How deep are we in the generated tree of objects already?
Plain object in output mode, otherwise Proxy.
Generate a regular expression of up to stringLength size, all from the same random Unicode script. The first codepoint will not be a combining character.
Optionaldepth: number = 0How deep are we in the generated tree of objects already?
Generated regexp.
Generate a Set of random things, with length up to arrayLength, and each element being any one of the types this object currently supports. If we are already too deep, generates an empty set.
Optionaldepth: number = 0How deep are we in the generated tree of objects already?
Generated Set.
Generate a string of up to stringLength size, all from the same random Unicode script. The first codepoint will not be a combining character.
Optional_depth: number = 0How deep are we in the generated tree of objects already?
Optionalreason: string = 'string'Reason for generation, since this function is called by others.
Optionalscript: string = undefinedIf specified, use this script instead of a random one.
Generated string.
Generate a boxed String of up to stringLength size, all from the same random Unicode script. The first codepoint will not be a combining character.
Optionaldepth: number = 0How deep are we in the generated tree of objects already?
Wrapped new String().
Generate a symbol from a random string. This will intern the Symbol with Symbol.for to make testing possible.
Optionaldepth: number = 0How deep are we in the generated tree of objects already?
Generated Symbol.
Generate one of the TypedArrays, ArrayBuffer, SharedArrayBuffer, or DataView of arrayLength elements. If we're too deep already, generate an array with length 0.
Optionaldepth: number = 0How deep are we in the generated tree of objects already?
Generated TypedArray.
Generate undefined.
Optional_depth: number = 0How deep are we in the generated tree of objects already?
Always returns undefined.
Generate a URL object where each component can be up to stringLength size, and each component is all from the same random Unicode script. The top-level domain (TLD) name will be valid, and the preceding domain label will be from the same script as the TLD.
However, that means you'll see a lot of Punycode, thanks to the way that the URL class works.
Optionaldepth: number = 0How deep are we in the generated tree of objects already?
Generated punycode URL.
Generate a WeakMap containing 0 or more key/value pairs where the keys are valid weak items, and the values can be any valid type.
Optionaldepth: number = 0How deep are we in the generated tree of objects already?
Generated.
Generate a WeakSet containing 0 or more sub-items of any valid type.
Optionaldepth: number = 0How deep are we in the generated tree of objects already?
Generated.
Create garbage javascript types for testing.