Skip to content

Commit dbff156

Browse files
committed
fix: Make sure regeneratorRuntime isn't included in the cjs build
1 parent 5fffafd commit dbff156

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/patterns.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,10 +128,18 @@ function chainable<pattern extends Matcher<any, any, any, any, any>>(
128128

129129
const variadic = <pattern extends {}>(pattern: pattern): Variadic<pattern> =>
130130
Object.assign(pattern, {
131-
*[Symbol.iterator]() {
132-
yield Object.assign(pattern, {
131+
[Symbol.iterator](): Iterator<pattern, void, undefined> {
132+
let i = 0;
133+
const variadicPattern = Object.assign(pattern, {
133134
[symbols.isVariadic]: true,
134135
});
136+
const values: IteratorResult<pattern, void>[] = [
137+
{ value: variadicPattern, done: false },
138+
{ done: true, value: undefined },
139+
];
140+
return {
141+
next: () => values[i++] ?? values.at(-1)!,
142+
};
135143
},
136144
});
137145

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy