MCPcopy
hub / github.com/tailwindlabs/tailwindcss / permutations

Function permutations

packages/tailwindcss/src/utils/compare.test.ts:136–154  ·  view source on GitHub ↗
(input: T[])

Source from the content-addressed store, hash-verified

134it('sort is stable', () => {
135 // Heap's algorithm for permutations
136 function* permutations<T>(input: T[]) {
137 let pos = 1
138 let stack = input.map(() => 0)
139
140 yield input.slice()
141
142 while (pos < input.length) {
143 if (stack[pos] < pos) {
144 let k = pos % 2 == 0 ? 0 : stack[pos]
145 ;[input[k], input[pos]] = [input[pos], input[k]]
146 yield input.slice()
147 ++stack[pos]
148 pos = 1
149 } else {
150 stack[pos] = 0
151 ++pos
152 }
153 }
154 }
155
156 let classes = ['duration-initial', 'duration-75', 'duration-150', 'duration-700', 'duration-1000']
157

Callers 1

compare.test.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected