Skip to content

arlas-web-contributors


arlas-web-contributors / processPassesAllowList

Function: processPassesAllowList()

processPassesAllowList(processToExecute, variableName): boolean

Verifies if the Javascript code to execute respects the following rules. Only are allowed - Date, Math, Number classes - Date methods (getters & toxxxString methods only) - Math methods (sqrt, pow, abs, ... you name it !) - Number methods (parseInt, parseFloat, isNaN, ...) - String methods (substring, concat, ...) - Array methods (slice, concat, flat, ...) - Mathematical operations (+ - % ^ x /) - Comparison operators (== === != !== < <= > >=) - The following chars ([ ] ( ) , ; : ? ! .) - text between simple quotes 'your text'. Only these special chars are allowed : ,:-_;%!?

Parameters

processToExecute

string

A javascript code to execute.

variableName

string

variable to use

Returns

boolean

boolean (true if valid)

Defined in

src/utils/utils.ts:489