INNER CODE UNIT · TypeScript
createScopeChain
jeffijoe/awilix · benchmarks/helpers.ts:42
export function createScopeChain(
depth: number,
): { root: AwilixContainer; deepest: AwilixContainer } {
const root = createContainer()
root.register({ rootVal: asValue('from-root') })
let current: AwilixContainer = root
for (let i = 0; i < depth; i++) {
current = current.createScope()
}
return { root, deepest: current }
}
/**
* Formats bench results into a table for console + markdown.
*/
export function formatResults(bench: Bench): {
rows: Array<{ Name: string; 'ops/sec': number; 'avg (ns)': number; 'p99 (ns)': number }>
markdown: string