/ cloudformation-templates / node_modules / aws-cdk / node_modules / degenerator / dist / src / index.d.ts
index.d.ts
1 /// <reference types="node" /> 2 import { Context, RunningScriptOptions } from 'vm'; 3 /** 4 * Compiles sync JavaScript code into JavaScript with async Functions. 5 * 6 * @param {String} code JavaScript string to convert 7 * @param {Array} names Array of function names to add `await` operators to 8 * @return {String} Converted JavaScript string with async/await injected 9 * @api public 10 */ 11 declare function degenerator(code: string, _names: degenerator.DegeneratorNames, { output }?: degenerator.DegeneratorOptions): string; 12 declare namespace degenerator { 13 type DegeneratorName = string | RegExp; 14 type DegeneratorNames = DegeneratorName[]; 15 type DegeneratorOutput = 'async' | 'generator'; 16 interface DegeneratorOptions { 17 output?: DegeneratorOutput; 18 } 19 interface CompileOptions extends DegeneratorOptions, RunningScriptOptions { 20 sandbox?: Context; 21 } 22 const supportsAsync: boolean; 23 function compile<T extends Function>(code: string, returnName: string, names: DegeneratorNames, options?: CompileOptions): T; 24 } 25 export = degenerator;