MCPcopy Create free account
hub / github.com/activejs/activejs / randomDictObject

Function randomDictObject

packages/core/src/tests/utils.ts:236–244  ·  view source on GitHub ↗
(nestingLvl = 2, maxKeys = 3)

Source from the content-addressed store, hash-verified

234}
235
236export function randomDictObject(nestingLvl = 2, maxKeys = 3) {
237 if (nestingLvl < 0 || !isNumber(nestingLvl)) {
238 return {END: true};
239 }
240 return randomKeys(maxKeys).reduce((reduced, key) => {
241 reduced[key] = randomValue(nestingLvl);
242 return reduced;
243 }, {});
244}
245
246export function randomValues(nestingLvl = 2) {
247 return randomSelectMultiple(RANDOM_VALUE_PRODUCERS).map(gen => gen(nestingLvl));

Callers 5

dict-unit.spec.tsFile · 0.90
utils.tsFile · 0.85
randomArrayFunction · 0.85
randomValidValueFunction · 0.85
differentValueFunction · 0.85

Calls 3

isNumberFunction · 0.90
randomKeysFunction · 0.85
randomValueFunction · 0.85

Tested by

no test coverage detected