Example #1
0
const evalMethod = (
    expression: string,
    node: IAxonNode,
    allowUndefined: boolean = false
) => {
    const matched = expression.match(
        REGEX_GET_FUNCTION_CALL_ARGS
    ) as RegExpMatchArray;
    const args = !isUndefined(matched[2]) ? matched[2].split(",") : [];
    const data = getPathFull(node.$app.methods, matched[1], true);

    if (data !== null) {
        data.args = args.map((arg: string) => evalLiteralFromNode(arg, node));
        data.node = node.$app.$entry;

        return data;
    }

    return handleMissingProp(expression, allowUndefined);
};
Example #2
0
const evalProp = (
    expression: string,
    node: IAxonNode,
    allowUndefined: boolean = false
) => {
    let current = node;

    while (current) {
        const data = getPathFull(current.data, expression, true);

        if (data !== null) {
            data.node = current;

            return data;
        }

        current = current.$parent as IAxonNode;
    }

    return handleMissingProp(expression, allowUndefined);
};