UNPKG

@dapplion/benchmark

Version:

Ensures that new code does not introduce performance regressions with CI. Tracks:

28 lines (27 loc) 781 B
/** Manual lodash.pick() function. Ensure no unwanted options end up in optsByRootSuite */ export function onlyBenchmarkOpts(opts) { // Define in this way so Typescript guarantees all keys are considered const keysObj = { maxRuns: true, minRuns: true, maxMs: true, minMs: true, maxWarmUpMs: true, maxWarmUpRuns: true, convergeFactor: true, runsFactor: true, yieldEventLoopAfterEach: true, timeoutBench: true, threshold: true, noThreshold: true, only: true, skip: true, }; const optsOut = {}; for (const key of Object.keys(keysObj)) { if (opts[key] !== undefined) { optsOut[key] = opts[key]; } } return optsOut; }