fast-check
Version:
Property based testing framework for JavaScript (like QuickCheck)
25 lines (24 loc) • 749 B
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.getDepthContextFor = getDepthContextFor;
exports.createDepthIdentifier = createDepthIdentifier;
const depthContextCache = new Map();
function getDepthContextFor(contextMeta) {
if (contextMeta === undefined) {
return { depth: 0 };
}
if (typeof contextMeta !== 'string') {
return contextMeta;
}
const cachedContext = depthContextCache.get(contextMeta);
if (cachedContext !== undefined) {
return cachedContext;
}
const context = { depth: 0 };
depthContextCache.set(contextMeta, context);
return context;
}
function createDepthIdentifier() {
const identifier = { depth: 0 };
return identifier;
}
;