import { customEndpointFunctions } from "./customEndpointFunctions"; import { endpointFunctions } from "./endpointFunctions"; import { evaluateExpression } from "./evaluateExpression"; export const callFunction = ({ fn, argv }, options) => { const evaluatedArgs = argv.map((arg) => ["boolean", "number"].includes(typeof arg) ? arg : evaluateExpression(arg, "arg", options)); const fnSegments = fn.split("."); if (fnSegments[0] in customEndpointFunctions && fnSegments[1] != null) { return customEndpointFunctions[fnSegments[0]][fnSegments[1]](...evaluatedArgs); } return endpointFunctions[fn](...evaluatedArgs); };