How to use @babel/helper-remap-async-to-generator - 3 common examples

To help you get started, we’ve selected a few @babel/helper-remap-async-to-generator examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github babel / babel / packages / babel-plugin-proposal-async-generator-functions / src / index.js View on Github external
Function(path, state) {
      if (!path.node.async) return;

      path.traverse(forAwaitVisitor, state);

      if (!path.node.generator) return;

      path.traverse(yieldStarVisitor, state);

      remapAsyncToGenerator(path, {
        wrapAsync: state.addHelper("wrapAsyncGenerator"),
        wrapAwait: state.addHelper("awaitAsyncGenerator"),
      });
    },
  };
github babel / babel / packages / babel-plugin-transform-async-to-module-method / src / index.js View on Github external
Function(path, state) {
        if (!path.node.async || path.node.generator) return;

        let wrapAsync = state.methodWrapper;
        if (wrapAsync) {
          wrapAsync = t.cloneDeep(wrapAsync);
        } else {
          wrapAsync = state.methodWrapper = addNamed(path, method, module);
        }

        remapAsyncToGenerator(path, state.file, {
          wrapAsync,
        });
      },
    },
github babel / babel / packages / babel-plugin-transform-async-to-generator / src / index.js View on Github external
Function(path, state) {
        if (!path.node.async || path.node.generator) return;

        remapAsyncToGenerator(path, {
          wrapAsync: state.addHelper("asyncToGenerator"),
        });
      },
    },

@babel/helper-remap-async-to-generator

Helper function to remap async functions to generators

MIT
Latest version published 14 days ago

Package Health Score

95 / 100
Full package analysis

Popular @babel/helper-remap-async-to-generator functions

Similar packages