Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
This repository was archived by the owner on Feb 1, 2025. It is now read-only.
/regeneratorPublic archive

Source transformer enabling ECMAScript 6 generator functions in JavaScript-of-today.

License

NotificationsYou must be signed in to change notification settings

facebook/regenerator

Repository files navigation

This package implements a fully-functional source transformation thattakes the syntax for generators/yield fromECMAScript 2015 or ES2015 andAsynchronous Iteration proposal andspits out efficient JS-of-today (ES5) that behaves the same way.

A small runtime library (less than 1KB compressed) is required to provide thewrapGenerator function. You can install it either as a CommonJS moduleor as a standalone .js file, whichever you prefer.

Installation

From npm:

npm install -g regenerator

From GitHub:

cd path/to/node_modulesgit clone git://github.com/facebook/regenerator.gitcd regeneratornpm install.npmtest

Usage

You have several options for using this module.

Simplest usage:

regenerator es6.js> es5.js# Just the transform.regenerator --include-runtime es6.js> es5.js# Add the runtime too.regenerator src lib# Transform every .js file in src and output to lib.

Programmatic usage:

vares5Source=require("regenerator").compile(es6Source).code;vares5SourceWithRuntime=require("regenerator").compile(es6Source,{includeRuntime:true}).code;

AST transformation:

varrecast=require("recast");varast=recast.parse(es6Source);ast=require("regenerator").transform(ast);vares5Source=recast.print(ast);

How can you get involved?

The easiest way to get involved is to look for buggy examples usingthesandbox, and when you findsomething strange just click the "report a bug" link (the new issue formwill be populated automatically with the problematic code).

Alternatively, you canfork the repository,create some failing tests cases intest/tests.es6.js,and send pull requests for me to fix.

If you're feeling especially brave, you are more than welcome to dive intothe transformer code and fix the bug(s) yourself, but I must warn you thatthe code could really benefit frombetter implementationcomments.

About

Source transformer enabling ECMAScript 6 generator functions in JavaScript-of-today.

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

No packages published

Languages


[8]ページ先頭

©2009-2025 Movatter.jp