MCPcopy Index your code
hub / github.com/tailwindlabs/prettier-plugin-tailwindcss / buildFixture

Function buildFixture

src/utils.bench.ts:13–29  ·  view source on GitHub ↗
(repeatCount: number, changeCount: number)

Source from the content-addressed store, hash-verified

11 ]
12
13 function buildFixture(repeatCount: number, changeCount: number) {
14 // A large set of changes across random places in the string
15 let indxes = new Set(
16 Array.from({ length: changeCount }, () => Math.ceil(Math.random() * repeatCount)),
17 )
18
19 let changes: StringChange[] = Array.from(indxes).flatMap((idx) => {
20 return changesTemplate.map((change) => ({
21 start: change.start + strTemplate.length * idx,
22 end: change.end + strTemplate.length * idx,
23 before: change.before,
24 after: change.after,
25 }))
26 })
27
28 return [strTemplate.repeat(repeatCount), changes] as const
29 }
30
31 let [strS, changesS] = buildFixture(5, 2)
32 bench('small string', () => {

Callers 1

utils.bench.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…