From c836dc04a58638ace58465a4b0fef9adc2c04f2d Mon Sep 17 00:00:00 2001 From: alex Date: Wed, 30 Oct 2024 22:42:08 +0100 Subject: [PATCH 1/2] Apply `all` function to individual patterns rather than final stack --- packages/core/repl.mjs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/core/repl.mjs b/packages/core/repl.mjs index 016eca3ee..560c9d330 100644 --- a/packages/core/repl.mjs +++ b/packages/core/repl.mjs @@ -152,9 +152,12 @@ export function repl({ shouldHush && hush(); let { pattern, meta } = await _evaluate(code, transpiler, transpilerOptions); if (Object.keys(pPatterns).length) { - pattern = stack(...Object.values(pPatterns)); - } - if (allTransform) { + let patterns = Object.values(pPatterns); + if (allTransform) { + patterns = patterns.map(allTransform); + } + pattern = stack(...patterns); + } else if (allTransform) { pattern = allTransform(pattern); } if (!isPattern(pattern)) { From cb0f6d2e526176f8347beccc256d75bf21516048 Mon Sep 17 00:00:00 2001 From: alex Date: Sun, 22 Dec 2024 19:59:15 +0000 Subject: [PATCH 2/2] fix for `d1` and `.p(1)` --- packages/core/repl.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/core/repl.mjs b/packages/core/repl.mjs index 560c9d330..eff0a16cb 100644 --- a/packages/core/repl.mjs +++ b/packages/core/repl.mjs @@ -92,7 +92,7 @@ export function repl({ // set pattern methods that use this repl via closure const injectPatternMethods = () => { Pattern.prototype.p = function (id) { - if (id.startsWith('_') || id.endsWith('_')) { + if (typeof id === 'string' && (id.startsWith('_') || id.endsWith('_'))) { // allows muting a pattern x with x_ or _x return silence; }