htc 7ca38fdcbb 善行少年PC端首次提交(基础版) 2 هفته پیش
..
.github 7ca38fdcbb 善行少年PC端首次提交(基础版) 2 هفته پیش
test 7ca38fdcbb 善行少年PC端首次提交(基础版) 2 هفته پیش
.eslintrc 7ca38fdcbb 善行少年PC端首次提交(基础版) 2 هفته پیش
.nycrc 7ca38fdcbb 善行少年PC端首次提交(基础版) 2 هفته پیش
CHANGELOG.md 7ca38fdcbb 善行少年PC端首次提交(基础版) 2 هفته پیش
LICENSE.md 7ca38fdcbb 善行少年PC端首次提交(基础版) 2 هفته پیش
README.md 7ca38fdcbb 善行少年PC端首次提交(基础版) 2 هفته پیش
index.d.mts 7ca38fdcbb 善行少年PC端首次提交(基础版) 2 هفته پیش
index.d.ts 7ca38fdcbb 善行少年PC端首次提交(基础版) 2 هفته پیش
index.js 7ca38fdcbb 善行少年PC端首次提交(基础版) 2 هفته پیش
index.mjs 7ca38fdcbb 善行少年PC端首次提交(基础版) 2 هفته پیش
legacy.js 7ca38fdcbb 善行少年PC端首次提交(基础版) 2 هفته پیش
package.json 7ca38fdcbb 善行少年PC端首次提交(基础版) 2 هفته پیش
require.mjs 7ca38fdcbb 善行少年PC端首次提交(基础版) 2 هفته پیش
tsconfig.json 7ca38fdcbb 善行少年PC端首次提交(基础版) 2 هفته پیش

README.md

generator-function Version Badge

github actions coverage License Downloads

npm badge

A function that returns the normally hidden GeneratorFunction constructor, when available.

Getting started

npm install --save generator-function

Usage/Examples

const assert = require('assert');
const GeneratorFunction = require('generator-function')();

const fn = new GeneratorFunction('return 1');

assert.equal(fn.toString(), 'function* anonymous(\n) {\nreturn 1\n}');

const iterator = fn();

assert.deepEqual(iterator.next(), { done: true, value: 1 });

Tests

Clone the repo, npm install, and run npm test