isSafeCompiledExpression
Returns whether a value is an expression the compilers could have emitted over these formals, and so may be compiled.
@internote/canvas-sdkOn this page
import { isSafeCompiledExpression } from '@internote/canvas-sdk';An allowlist over the emitted JavaScript: numbers, the formals, Math.<member> and the members of any namespace given, + - * / **, brackets and commas, with the compilers' own helper bodies matched verbatim. No quotes, no [, no =, no ;, no braces, no comments, and no name the caller did not declare.
#Signature
(
js: unknown,
formals: readonly string[],
namespaces?: ExpressionNamespaces,
): js is string#Parameters
jsThe value to test.
formalsThe names the function will declare; the only bare names the body may use.
namespacesThe namespaces reachable as
ns.member. Math alone by default.Declared in packages/canvas-sdk/src/maths/safe-function.ts:92.