• Version 5.0.1
  • Published
  • 27.1 kB
  • 3 dependencies
  • MIT license


npm i degenerator
yarn add degenerator
pnpm add degenerator


Compiles sync functions into async generator functions



function compile

compile: <R = unknown, A extends unknown[] = []>(
qjs: QuickJSWASMModule,
code: string,
returnName: string,
options?: CompileOptions
) => (...args: A) => Promise<R>;

    function degenerator

    degenerator: (code: string, _names: DegeneratorNames) => string;
    • Compiles sync JavaScript code into JavaScript with async Functions.

      Parameter code

      JavaScript string to convert

      Parameter names

      Array of function names to add await operators to {String} Converted JavaScript string with async/await injected public


    interface CompileOptions

    interface CompileOptions {}

      property filename

      filename?: string;

        property names

        names?: DegeneratorNames;

          property sandbox

          sandbox?: Context;

            Type Aliases

            type DegeneratorName

            type DegeneratorName = string | RegExp;

              type DegeneratorNames

              type DegeneratorNames = DegeneratorName[];

                Package Files (3)

                Dependencies (3)

                Dev Dependencies (9)

                Peer Dependencies (0)

                No peer dependencies.


                To add a badge like this badgeto your package's README, use the codes available below.

                You may also use to create a custom badge linking to

                • Markdown
                • HTML
                  <a href=""><img src="" alt=""></a>