
Security News
TypeScript is Porting Its Compiler to Go for 10x Faster Builds
TypeScript is porting its compiler to Go, delivering 10x faster builds, lower memory usage, and improved editor performance for a smoother developer experience.
babel-plugin-async-to-plain-generator
Advanced tools
Transform async functions into non-wrapped ES2015 generators
While working with KoaJS v1 we found that the resulting output from transform-async-to-generator was incompatible with Koa's requirements - that app.use
must be passed a generator function.
This plugin was created by modifying the transform-async-to-generator plugin. While that plugin works well in most situations, it curiously (and extraneously?) wraps async functions and results in a generator function wrapped in a regular function of the same name. This plugin was created so that babel would produce plain old vanilla generator functions from async function declarations.
// in
[].forEach(async (a) => {
await a;
});
async function foo (bar) {
await bar;
};
// out
[].forEach(function* (a) {
yield a;
});
function* foo (bar) {
yield bar;
}
$ npm install babel-plugin-async-to-plain-generator
.babelrc
(Recommended).babelrc
{
"plugins": ["async-to-plain-generator"]
}
$ babel --plugins async-to-plain-generator script.js
require("babel-core").transform("code", {
plugins: ["async-to-plain-generator"]
});
FAQs
Transform async functions into non-wrapped ES2015 generators
The npm package babel-plugin-async-to-plain-generator receives a total of 0 weekly downloads. As such, babel-plugin-async-to-plain-generator popularity was classified as not popular.
We found that babel-plugin-async-to-plain-generator demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
TypeScript is porting its compiler to Go, delivering 10x faster builds, lower memory usage, and improved editor performance for a smoother developer experience.
Research
Security News
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
Security News
Socket CEO Feross Aboukhadijeh discusses the open web, open source security, and how Socket tackles software supply chain attacks on The Pair Program podcast.