UNPKG

@openpass/openpass-js-sdk

Version:
20 lines 731 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.executeFunctionByName = void 0; 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); } exports.executeFunctionByName = executeFunctionByName; //# sourceMappingURL=functions.js.map