Function compileWhenClause

  • Compiles a when-clause into a when-function.

    When-clauses use the same syntax as JavaScript expressions including literals, operators, variables, object property access, array indexing, and function calls. Currently, only a subset of all JavaScript operators are supported, namely:

    • ternary conditional: x ? y : z
    • binary comparative: !=, ==, <=, >=, <, >
    • binary arithmetic: +, -, *, /, %
    • unary: +, -, !
    • function call: x() or x(y, ...)
    • array indexing: x[y]
    • property access: x.y

    Variables are made available as a context object during evaluation of a compiled when-clause, i.e., the When function. Variables may have any JavaScript value.

    This utility function may be used inside the processEntry function that is part of the ManifestContributionInfo.

    Compiled when-functions are cached; the method will return the same function instance for equal when-clauses.

    Parameters

    • whenClause: undefined | null | string

      The when-clause / expression

    Returns When | undefined

    a function that executes the when-clause, or undefined if an error occurs during compilation

Generated using TypeDoc