UNPKG

@openpass/openpass-js-sdk

Version:
16 lines 566 B
export function executeFunctionByName(functionName, context, functionArgs) { const namespaces = functionName.split("."); const func = namespaces.pop(); if (func === undefined) { throw Error("Function name not provided"); } for (let i = 0; i < namespaces.length; i++) { context = context[namespaces[i]]; } const toExecute = context[func]; if (toExecute === undefined) { throw Error(`Function '${func}' not found`); } return toExecute.apply(context, functionArgs); } //# sourceMappingURL=functions.js.map