build
This commit is contained in:
parent
f6be175af0
commit
413d401567
14 changed files with 873 additions and 471 deletions
12
docs/dist/evaluate.js
vendored
12
docs/dist/evaluate.js
vendored
|
|
@ -27,10 +27,12 @@ export const evaluate = (code) => {
|
|||
if (typeof evaluated === "function") {
|
||||
evaluated = evaluated();
|
||||
}
|
||||
const pattern = minify(evaluated);
|
||||
if (pattern?.constructor?.name !== "Pattern") {
|
||||
const message = `got "${typeof pattern}" instead of pattern`;
|
||||
throw new Error(message + (typeof pattern === "function" ? ", did you forget to call a function?" : "."));
|
||||
if (typeof evaluated === "string") {
|
||||
evaluated = strudel.withLocationOffset(minify(evaluated), {start: {line: 1, column: -1}});
|
||||
}
|
||||
return {mode: "javascript", pattern};
|
||||
if (evaluated?.constructor?.name !== "Pattern") {
|
||||
const message = `got "${typeof evaluated}" instead of pattern`;
|
||||
throw new Error(message + (typeof evaluated === "function" ? ", did you forget to call a function?" : "."));
|
||||
}
|
||||
return {mode: "javascript", pattern: evaluated};
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue