util-ex
Version:
Browser-friendly enhanced util fully compatible with standard node.js
15 lines (14 loc) • 682 B
TypeScript
/**
* Create a function using the given body and scope.
*
* @param {string} body - The body of the function to create.
* @param {object|string[]} [scope] - The scope of the function, as an object with key/value pairs or an array of strings.
* @param {Array=} values - The values to use for the scope, if scope is an array.
* @returns {function} - The created function.
*
* @example
* var fn = _createFunction('function yourFuncName(arg1, arg2){log(arg1+arg2);}', {log:console.log});
* fn(2,3); //print 5
*/
export function _createFunction(body: string, scope?: object | string[], values?: any[] | undefined, ...args: any[]): Function;
export default _createFunction;