add pattern id to query state controls
This commit is contained in:
parent
694162a7b1
commit
fdde05e751
1 changed files with 5 additions and 1 deletions
|
|
@ -214,7 +214,10 @@ export function repl({
|
|||
}
|
||||
let { pattern, meta } = await _evaluate(code, transpiler, transpilerOptions);
|
||||
if (Object.keys(pPatterns).length) {
|
||||
let patterns = Object.values(pPatterns);
|
||||
let patterns = [];
|
||||
for (const [key, value] of Object.entries(pPatterns)) {
|
||||
patterns.push(value.withState(state => state.setControls({id: key})));
|
||||
}
|
||||
if (eachTransform) {
|
||||
// Explicit lambda so only element (not index and array) are passed
|
||||
patterns = patterns.map((x) => eachTransform(x));
|
||||
|
|
@ -228,6 +231,7 @@ export function repl({
|
|||
pattern = allTransforms[i](pattern);
|
||||
}
|
||||
}
|
||||
|
||||
if (!isPattern(pattern)) {
|
||||
const message = `got "${typeof evaluated}" instead of pattern`;
|
||||
throw new Error(message + (typeof evaluated === 'function' ? ', did you forget to call a function?' : '.'));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue