pax_global_header00006660000000000000000000000064136137022240014512gustar00rootroot0000000000000052 comment=3bae65adc19929e30aef00964c286312b50c5425 make-generator-function-2.0.0/000077500000000000000000000000001361370222400162355ustar00rootroot00000000000000make-generator-function-2.0.0/.editorconfig000066400000000000000000000004241361370222400207120ustar00rootroot00000000000000root = true [*] indent_style = tab; insert_final_newline = true; quote_type = auto; space_after_anonymous_functions = true; space_after_control_statements = true; spaces_around_operators = true; trim_trailing_whitespace = true; spaces_in_brackets = false; end_of_line = lf; make-generator-function-2.0.0/.eslintrc000066400000000000000000000001751361370222400200640ustar00rootroot00000000000000{ "root": true, "extends": "@ljharb", "rules": { "id-length": [2, { "min": 1, "max": 30 }], "no-new-func": [0] } } make-generator-function-2.0.0/.github/000077500000000000000000000000001361370222400175755ustar00rootroot00000000000000make-generator-function-2.0.0/.github/workflows/000077500000000000000000000000001361370222400216325ustar00rootroot00000000000000make-generator-function-2.0.0/.github/workflows/rebase.yml000066400000000000000000000003721361370222400236200ustar00rootroot00000000000000name: Automatic Rebase on: [pull_request] jobs: _: name: "Automatic Rebase" runs-on: ubuntu-latest steps: - uses: actions/checkout@v1 - uses: ljharb/rebase@master env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} make-generator-function-2.0.0/.gitignore000066400000000000000000000001551361370222400202260ustar00rootroot00000000000000# gitignore node_modules # Only apps should have lockfiles npm-shrinkwrap.json package-lock.json yarn.lock make-generator-function-2.0.0/.npmrc000066400000000000000000000001101361370222400173450ustar00rootroot00000000000000package-lock=false audit-level=high allow-same-version=true message=v%s make-generator-function-2.0.0/.nvmrc000066400000000000000000000000051361370222400173560ustar00rootroot00000000000000node make-generator-function-2.0.0/.travis.yml000066400000000000000000000003741361370222400203520ustar00rootroot00000000000000version: ~> 1.0 language: node_js os: - linux import: - ljharb/travis-ci:node/all.yml - ljharb/travis-ci:node/pretest.yml - ljharb/travis-ci:node/posttest.yml - ljharb/travis-ci:node/coverage.yml matrix: allow_failures: - env: COVERAGE=true make-generator-function-2.0.0/CHANGELOG.md000066400000000000000000000245061361370222400200550ustar00rootroot00000000000000# Changelog All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). ## [v2.0.0](https://github.com/ljharb/make-generator-function/compare/v1.1.1...v2.0.0) - 2020-01-28 ### Commits - [Breaking] export a function that returns a list of generator functions [`71003b9`](https://github.com/ljharb/make-generator-function/commit/71003b93cd6c58db7e88529b577f6c207386ef60) ## [v1.1.1](https://github.com/ljharb/make-generator-function/compare/v1.1.0...v1.1.1) - 2020-01-27 ### Fixed - [Docs] Add missing license [`#2`](https://github.com/ljharb/make-generator-function/issues/2) ### Commits - [Tests] use shared travis-ci configs [`73dba5c`](https://github.com/ljharb/make-generator-function/commit/73dba5ca0ecc61b04aedf4143a5bf00d779053a8) - Update `eslint`, `tape`; use my personal shared `eslint` config [`b604ab4`](https://github.com/ljharb/make-generator-function/commit/b604ab4f282726d6b0b499d5254d8219fd8ada05) - Add `npm run eslint` [`113d983`](https://github.com/ljharb/make-generator-function/commit/113d983d0be9f50f63639c9ff90d513d4144749a) - [Tests] remove `jscs` [`4c9100c`](https://github.com/ljharb/make-generator-function/commit/4c9100c5a3891f2d6928ed8978142fc672213100) - [Tests] up to `node` `v8.4`, `v7.10`, `v6.11`, `v4.8`; newer npm breaks on older node; improve matrix [`865d46f`](https://github.com/ljharb/make-generator-function/commit/865d46f234f8f69dec206f7650dfff1eec038d0e) - [Tests] up to `node` `v11.7`, `v10.15`, `v9.11`, `v8.15`, `v6.16`, `v4.9` [`c159ff4`](https://github.com/ljharb/make-generator-function/commit/c159ff4db6d10e52718cbadec1133e4823c8a61c) - [Dev Deps] update `tape`, `jscs`, `eslint`, `@ljharb/eslint-config`, `nsp` [`06336cc`](https://github.com/ljharb/make-generator-function/commit/06336ccd298d959c7e7f7ed9794aa25f9fdebcbb) - [meta] add `auto-changelog` [`672196a`](https://github.com/ljharb/make-generator-function/commit/672196a9309a7db1830a70921567798fe5e5b371) - [Tests] up to `node` `v12.10`, `v11.15`, `v10.16`, `v8.16`, `v6.17` [`97c87a3`](https://github.com/ljharb/make-generator-function/commit/97c87a37509f67a90bb01b7e7216fb8b36a2d0f5) - Update `tape`, `jscs`, `covert` [`55a82c3`](https://github.com/ljharb/make-generator-function/commit/55a82c3050f036bed5269b88f85f3e9db25c0fd2) - [Tests] up to `node` `v6.2`, `v5.11`, `v4.4` [`e8dd157`](https://github.com/ljharb/make-generator-function/commit/e8dd157e88bd4d003bfa2348497049ef59911d13) - [Tests] up to `node` `v9.3`, `v8.9`, `v6.12`; use `nvm install-latest-npm`; pin included builds to LTS [`6b9aeda`](https://github.com/ljharb/make-generator-function/commit/6b9aeda6bdeaff473ddd48b1fc8fcb6e132054b4) - Update `eslint`, `nsp` [`acc5699`](https://github.com/ljharb/make-generator-function/commit/acc5699477ca483b6d0d6f4694b4d5f020d2e709) - [Tests] up to `node` `v7.0`, `v6.9`, `v4.6`; improve test matrix [`6050544`](https://github.com/ljharb/make-generator-function/commit/6050544a17e69704f36f8853f3bcc21a754c02dc) - Update `tape`, `jscs`, `eslint`, `@ljharb/eslint-config` [`3a74514`](https://github.com/ljharb/make-generator-function/commit/3a7451468dae605b3987dc9ec3cc6c204f9771dd) - [actions] add automatic rebasing / merge commit blocking [`2b0632e`](https://github.com/ljharb/make-generator-function/commit/2b0632e7195630256add3a2f5ba747262e553aac) - Test up to `io.js` `v2.2` [`7be5eaa`](https://github.com/ljharb/make-generator-function/commit/7be5eaa68e6a5a4151ab5eb7b6a1cd6857e28a69) - [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `tape` [`89ca6b8`](https://github.com/ljharb/make-generator-function/commit/89ca6b808a2775f07cdda100f92436d38507a7b7) - [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `tape`; add `safe-publish-latest` [`1085b97`](https://github.com/ljharb/make-generator-function/commit/1085b97777dc3e6a921067e665f420acf8a088df) - [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `nsp`, `tape` [`31669dd`](https://github.com/ljharb/make-generator-function/commit/31669dd2fdf50221761f5e245a636a60cbc725d7) - [Dev Deps] update `tape`, `jscs`, `eslint`, `@ljharb/eslint-config`, `nsp` [`3e5632c`](https://github.com/ljharb/make-generator-function/commit/3e5632c60309b688c6f6f0e9f1be3983fa7e6568) - [Tests] up to `io.js` `v3.3`, `node` `v4.1` [`ae10e71`](https://github.com/ljharb/make-generator-function/commit/ae10e71b9bd83b68e33a3663f70efc3245d45b41) - [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `covert`, `tape` [`498a056`](https://github.com/ljharb/make-generator-function/commit/498a05681fe60fddce0f533c958865a9d042dfd6) - [Tests] use `npm audit` instead of `nsp` [`be8e5d2`](https://github.com/ljharb/make-generator-function/commit/be8e5d290d320b017af6d31a102be1d6b6b84e3d) - Only apps should have lockfiles [`2be2319`](https://github.com/ljharb/make-generator-function/commit/2be2319d558eafb89834e4888615af86fdbd3383) - [Dev Deps] update `jscs`, `eslint`, `@ljharb/eslint-config`, `nsp` [`54be59e`](https://github.com/ljharb/make-generator-function/commit/54be59eefaafb025109119d92a371a0a2539bcae) - [Dev Deps] update `jscs` [`5248429`](https://github.com/ljharb/make-generator-function/commit/5248429af6b0be1659ea7793811b1597a380c172) - [Tests] use `npx aud` instead of `nsp` or `npm audit` with hoops [`3b01ae8`](https://github.com/ljharb/make-generator-function/commit/3b01ae8114988d057cb79ed35a9e835954e821d4) - [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `nsp` [`94dc41a`](https://github.com/ljharb/make-generator-function/commit/94dc41a31568eae4110a10eef37a5b1de0f37d9b) - [Dev Deps] update `tape`, `eslint`, `@ljharb/eslint-config` [`5e371bf`](https://github.com/ljharb/make-generator-function/commit/5e371bf9dec98bdf92b47ab5ad17ec0e565e58c0) - [Tests] use pretest/posttest for linting/security; create `tests-only` script. [`d5794fa`](https://github.com/ljharb/make-generator-function/commit/d5794fa7f1bbf934dc30fcdea2cf6b7cc3eb9ff6) - [Tests] use `eclint` instead of `editorconfig-tools` [`eed2fad`](https://github.com/ljharb/make-generator-function/commit/eed2fadcebfce81b2624a24b1e76259c560e249a) - [Dev Deps] update `nsp`, `eslint` [`43665f5`](https://github.com/ljharb/make-generator-function/commit/43665f50b91495587784ee2f60ba79a5ad8a43d1) - [Tests] up to `node` `v7.2` [`0386a7b`](https://github.com/ljharb/make-generator-function/commit/0386a7b4dd77d201c12329111fad8bc033ca08db) - [Dev Deps] Update `tape`, `eslint` [`5810537`](https://github.com/ljharb/make-generator-function/commit/5810537b9293440b5c670e6179ff945bea4bc912) - Test on `iojs-v1.5` and `iojs-v1.6` [`9553cf1`](https://github.com/ljharb/make-generator-function/commit/9553cf102d7473157fd8255c52cfe951eaeb5175) - Update `editorconfig-tools`, `nsp` [`9c1584a`](https://github.com/ljharb/make-generator-function/commit/9c1584aa8815f74ba6f6fb4f1d2fc574f81731ee) - [meta] add `funding` field [`293f453`](https://github.com/ljharb/make-generator-function/commit/293f4535e15a72f2dc59ed44a657c606fdaaae74) - `node` supports generators now. [`ace0d4b`](https://github.com/ljharb/make-generator-function/commit/ace0d4b050aa19e79da6f6b5d285336564a01e92) - Test up to `io.js `v3.0` [`5b2df35`](https://github.com/ljharb/make-generator-function/commit/5b2df35a95c2bf60bad3b1ff1f44078e9bc0a072) - Removing unused devDependencies. [`f72daba`](https://github.com/ljharb/make-generator-function/commit/f72daba16c1cbd3a46a8095f7e09f43e39c98cf4) - [Dev Deps] update `tape` [`c357966`](https://github.com/ljharb/make-generator-function/commit/c35796636dcaeaeaa7038e567723babab6e5a3f5) - Switch from vb.teelaun.ch to versionbadg.es for the npm version badge SVG. [`7607415`](https://github.com/ljharb/make-generator-function/commit/76074156dd28d81d958d675200fa1fa6313e4c48) - Test on `io.js` `v2.4` [`ca61c17`](https://github.com/ljharb/make-generator-function/commit/ca61c174bda520abb4b07381c61dd1b950d62497) - Test on `io.js` `v2.3` [`5b029ba`](https://github.com/ljharb/make-generator-function/commit/5b029ba8c92ffdd58127963cf03e98864c557968) ## [v1.1.0](https://github.com/ljharb/make-generator-function/compare/v1.0.0...v1.1.0) - 2015-03-03 ### Commits - Add a concise generator method. [`ea86f3d`](https://github.com/ljharb/make-generator-function/commit/ea86f3df4565ce6e0f39745921dcb8b79295ea09) - All grade A-supported `node`/`iojs` versions now ship with an `npm` that understands `^`. [`62630da`](https://github.com/ljharb/make-generator-function/commit/62630da0cb6a95b74e01337768bf8155e3f9301e) - Reorganizing tests. [`f77c0cd`](https://github.com/ljharb/make-generator-function/commit/f77c0cd2903a4967f10ee72cc0b845846d82f9c7) - Update `is`, `tape`, `jscs`, `nsp` [`40c85a2`](https://github.com/ljharb/make-generator-function/commit/40c85a261343ced20aa49c0dce092d252dea9b85) - Run `travis-ci` tests on `iojs` and `node` v0.12; speed up builds; allow 0.8 failures. [`2f20edc`](https://github.com/ljharb/make-generator-function/commit/2f20edc19142f72c6754bfec1fded309d33142b3) - Test on latest `io.js` [`0eac7b6`](https://github.com/ljharb/make-generator-function/commit/0eac7b6c268c6c8b26a4d7f317d273ef6ac7c63c) - Update `tape`, `jscs` [`dab3942`](https://github.com/ljharb/make-generator-function/commit/dab3942b0a873779726536345ca1128b933dddff) - Update `jscs` [`f9cfafb`](https://github.com/ljharb/make-generator-function/commit/f9cfafb2eec8d2f3bfd5bd08ea7274ae3db99d1e) - Don't run eccheck as part of tests yet. [`c8fe96d`](https://github.com/ljharb/make-generator-function/commit/c8fe96d983c36bd91e1b6d809aacecea0e314ca5) - Test on `iojs-v1.2` [`b188157`](https://github.com/ljharb/make-generator-function/commit/b18815735c496e49f3b12c875adf279bae262a7e) ## v1.0.0 - 2014-12-15 ### Commits - Dotfiles. [`e46a5e8`](https://github.com/ljharb/make-generator-function/commit/e46a5e8a3bf643ac2b409a5520a9ea6b2dfede8c) - package.json [`3198c72`](https://github.com/ljharb/make-generator-function/commit/3198c72c00d01cc37cfa84ba02c770a2075a51bb) - README. [`745a376`](https://github.com/ljharb/make-generator-function/commit/745a376ea5d159ec2482c9353eef61e0321192ce) - Tests. [`6298e7c`](https://github.com/ljharb/make-generator-function/commit/6298e7cd6d237ddce2f1d4aedfbdf84f02cc6c17) - Implementation. [`7d5e297`](https://github.com/ljharb/make-generator-function/commit/7d5e297069acf8f7fdb123a0520a6f0481bf9a08) - Initial commit. [`cbb4c0c`](https://github.com/ljharb/make-generator-function/commit/cbb4c0cf6ee16d14626ebdf25ee9cce74c0916f6) make-generator-function-2.0.0/LICENSE.md000066400000000000000000000020711361370222400176410ustar00rootroot00000000000000The MIT License (MIT) Copyright (c) 2015 Jordan Harband Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. make-generator-function-2.0.0/README.md000066400000000000000000000042501361370222400175150ustar00rootroot00000000000000#make-generator-function [![Version Badge][npm-version-svg]][package-url] [![Build Status][travis-svg]][travis-url] [![dependency status][deps-svg]][deps-url] [![dev dependency status][dev-deps-svg]][dev-deps-url] [![License][license-image]][license-url] [![Downloads][downloads-image]][downloads-url] [![npm badge][npm-badge-png]][package-url] [![browser support][testling-svg]][testling-url] Returns an arbitrary generator function, or undefined if generator syntax is unsupported. If both generator syntax and concise method syntax are supported, the generator function returned will have a "concise" property containing a concise generator method. ## Example ```js var maybeGeneratorFunction = require('make-generator-function'); if (maybeGeneratorFunction) { assert(typeof maybeGeneratorFunction === 'function'); var maybeConciseGeneratorMethod = maybeGeneratorFunction.concise; if (maybeConciseGeneratorMethod) { assert(typeof maybeConciseGeneratorMethod === 'function'); } } else { assert(typeof maybeGeneratorFunction === 'undefined'); } ``` ## Tests Simply clone the repo, `npm install`, and run `npm test` [package-url]: https://npmjs.org/package/make-generator-function [npm-version-svg]: http://versionbadg.es/ljharb/make-generator-function.svg [travis-svg]: https://travis-ci.org/ljharb/make-generator-function.svg [travis-url]: https://travis-ci.org/ljharb/make-generator-function [deps-svg]: https://david-dm.org/ljharb/make-generator-function.svg [deps-url]: https://david-dm.org/ljharb/make-generator-function [dev-deps-svg]: https://david-dm.org/ljharb/make-generator-function/dev-status.svg [dev-deps-url]: https://david-dm.org/ljharb/make-generator-function#info=devDependencies [testling-svg]: https://ci.testling.com/ljharb/make-generator-function.png [testling-url]: https://ci.testling.com/ljharb/make-generator-function [npm-badge-png]: https://nodei.co/npm/make-generator-function.png?downloads=true&stars=true [license-image]: http://img.shields.io/npm/l/make-generator-function.svg [license-url]: LICENSE [downloads-image]: http://img.shields.io/npm/dm/make-generator-function.svg [downloads-url]: http://npm-stat.com/charts.html?package=make-generator-function make-generator-function-2.0.0/index.js000066400000000000000000000007531361370222400177070ustar00rootroot00000000000000'use strict'; module.exports = function getGeneratorFunctions() { var generatorFuncs = []; try { generatorFuncs.push(Function('return function* () { var x = yield; return x || 42; }')()); } catch (e) {} try { generatorFuncs.push(Function('return function* gen() { var x = yield; return x || 42; }')()); } catch (e) {} try { generatorFuncs.push(Function('return { * concise( ){ var x = yield; return x || 42; } }.concise;')()); } catch (e) {} return generatorFuncs; }; make-generator-function-2.0.0/package.json000066400000000000000000000036631361370222400205330ustar00rootroot00000000000000{ "name": "make-generator-function", "version": "2.0.0", "author": "Jordan Harband", "funding": { "url": "https://github.com/sponsors/ljharb" }, "description": "Returns an arbitrary generator function, or undefined if generator syntax is unsupported.", "license": "MIT", "main": "index.js", "scripts": { "prepublish": "safe-publish-latest", "pretest": "npm run --silent lint", "test": "npm run --silent tests-only", "tests-only": "node --harmony test", "posttest": "npx aud", "coverage": "covert test/*.js", "lint": "eslint .", "eccheck": "eclint check *.js **/*.js > /dev/null", "version": "auto-changelog && git add CHANGELOG.md", "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"" }, "repository": { "type": "git", "url": "git://github.com/ljharb/make-generator-function.git" }, "bugs": { "url": "https://github.com/ljharb/make-generator-function/issues" }, "keywords": [ "generator function", "ES6", "generator", "function*" ], "dependencies": {}, "devDependencies": { "@ljharb/eslint-config": "^16.0.0", "auto-changelog": "^1.16.2", "covert": "^1.1.1", "eclint": "^2.8.1", "eslint": "^6.8.0", "for-each": "^0.3.3", "iterate-iterator": "^1.0.1", "safe-publish-latest": "^1.1.4", "tape": "^5.0.0-next.4" }, "testling": { "files": "test/index.js", "browsers": [ "iexplore/6.0..latest", "firefox/3.0..6.0", "firefox/15.0..latest", "firefox/nightly", "chrome/4.0..10.0", "chrome/20.0..latest", "chrome/canary", "opera/10.0..latest", "opera/next", "safari/4.0..latest", "ipad/6.0..latest", "iphone/6.0..latest", "android-browser/4.2" ] }, "engines": { "node": ">= 0.4" }, "auto-changelog": { "output": "CHANGELOG.md", "template": "keepachangelog", "unreleased": false, "commitLimit": false, "backfillLimit": false } } make-generator-function-2.0.0/test/000077500000000000000000000000001361370222400172145ustar00rootroot00000000000000make-generator-function-2.0.0/test/index.js000066400000000000000000000012271361370222400206630ustar00rootroot00000000000000'use strict'; var test = require('tape'); var forEach = require('for-each'); var iterate = require('iterate-iterator'); var generators = require('../')(); test('generators supported', { skip: generators.length === 0 }, function (t) { forEach(generators, function (genFunction) { t.comment('genFunction: `' + genFunction + '`'); t.equal(typeof genFunction, 'function', 'genFunction is function'); t.deepEqual(iterate(genFunction()), [undefined], 'generator yields expected values'); }); t.end(); }); test('generators not supported', { skip: generators.length > 0 }, function (t) { t.deepEqual(generators, [], 'no generator functions'); t.end(); });