Skip to content

Commit abfc1f7

Browse files
committed
fix: When mutilple elements match, add them all to in
1 parent ae71eec commit abfc1f7

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

packages/patterns/src/patterns/patternMatchers.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1339,10 +1339,10 @@ const makePatternKit = () => {
13391339
count += num;
13401340
inResults?.push([element, num]);
13411341
} else {
1342-
const numIn = num - numRest;
1342+
const numIn = numRest;
13431343
count += numIn;
1344-
inResults?.push([element, numIn]);
1345-
outResults?.push([element, numRest]);
1344+
inResults?.push([element, numRest]);
1345+
outResults?.push([element, num - numRest]);
13461346
}
13471347
} else {
13481348
outResults?.push([element, num]);

packages/patterns/test/patterns.test.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -491,6 +491,7 @@ const runTests = (t, successCase, failCase) => {
491491
successCase(specimen, M.has(M.string(), 5n));
492492
successCase(specimen, M.has('a', 1n));
493493
successCase(specimen, M.has('a'));
494+
successCase(specimen, M.has('b', 2n));
494495

495496
failCase(
496497
specimen,

0 commit comments

Comments
 (0)