isSafeCompiledExpression

Returns whether a value is an expression the compilers could have emitted over these formals, and so may be compiled.

@internote/canvas-sdkFunction
On 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

js
The value to test.
formals
The names the function will declare; the only bare names the body may use.
namespaces
The namespaces reachable as ns.member. Math alone by default.

Declared in packages/canvas-sdk/src/maths/safe-function.ts:92.

Last updated