is-generator-function
Advanced tools
Comparing version 1.0.8 to 1.0.9
@@ -8,2 +8,22 @@ # Changelog | ||
## [v1.0.9](https://github.com/inspect-js/is-generator-function/compare/v1.0.8...v1.0.9) - 2021-05-05 | ||
### Fixed | ||
- [Fix] avoid calling `Function` until absolutely necessary [`#41`](https://github.com/inspect-js/is-generator-function/issues/41) | ||
### Commits | ||
- [actions] use `node/install` instead of `node/run`; use `codecov` action [`612862b`](https://github.com/inspect-js/is-generator-function/commit/612862b5fefc2dc1c7e1f5e7478563a5b53f7b23) | ||
- [meta] do not publish github action workflow files [`c13855d`](https://github.com/inspect-js/is-generator-function/commit/c13855dc11947589ed7314840a9cc5ae04db90f4) | ||
- [readme] fix repo URLs; remove travis badge [`bd11a2a`](https://github.com/inspect-js/is-generator-function/commit/bd11a2af1b644cfa352346dcbf6f4cec48b00b78) | ||
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `tape` [`23f54d4`](https://github.com/inspect-js/is-generator-function/commit/23f54d49da035c1ca79227faee9bacfde2d46884) | ||
- [readme] add actions and codecov badges [`9e759ef`](https://github.com/inspect-js/is-generator-function/commit/9e759ef8e8f098fe1fa3cd9cca98f79f9e8b8b22) | ||
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `tape` [`6305f8d`](https://github.com/inspect-js/is-generator-function/commit/6305f8d71ccfa4656bdd280c2616e88fc5ca184b) | ||
- [meta] remove explicit audit level config [`db4391c`](https://github.com/inspect-js/is-generator-function/commit/db4391c68cf8162245d32734685be7c73c2f03c7) | ||
- [meta] use `prepublishOnly` script for npm 7+ [`82c5b18`](https://github.com/inspect-js/is-generator-function/commit/82c5b183a605f1d25af15ec8242c8a8f88a26bfa) | ||
- [Dev Deps] pin `core-js` v3 to < v3.9 [`5f6cc2a`](https://github.com/inspect-js/is-generator-function/commit/5f6cc2ac94a65d7d592775bac6dce573220ccea2) | ||
- [Tests] avoid running harmony tests on node 16+ [`c41526b`](https://github.com/inspect-js/is-generator-function/commit/c41526b8cd1d376f9ca73b56a5ee076db0f9f1c1) | ||
- [actions] update workflows [`a348c5d`](https://github.com/inspect-js/is-generator-function/commit/a348c5d6d4b06041ae0ece9f3765dc13ec9df354) | ||
## [v1.0.8](https://github.com/inspect-js/is-generator-function/compare/v1.0.7...v1.0.8) - 2020-12-02 | ||
@@ -10,0 +30,0 @@ |
12
index.js
@@ -17,4 +17,3 @@ 'use strict'; | ||
}; | ||
var generatorFunc = getGeneratorFunc(); | ||
var GeneratorFunction = getProto && generatorFunc ? getProto(generatorFunc) : false; | ||
var GeneratorFunction; | ||
@@ -32,3 +31,10 @@ module.exports = function isGeneratorFunction(fn) { | ||
} | ||
return getProto && getProto(fn) === GeneratorFunction; | ||
if (!getProto) { | ||
return false; | ||
} | ||
if (typeof GeneratorFunction === 'undefined') { | ||
var generatorFunc = getGeneratorFunc(); | ||
GeneratorFunction = generatorFunc ? getProto(generatorFunc) : false; | ||
} | ||
return getProto(fn) === GeneratorFunction; | ||
}; |
{ | ||
"name": "is-generator-function", | ||
"version": "1.0.8", | ||
"version": "1.0.9", | ||
"description": "Determine if a function is a native generator function.", | ||
"main": "index.js", | ||
"scripts": { | ||
"prepublish": "safe-publish-latest", | ||
"prepublishOnly": "safe-publish-latest", | ||
"prepublish": "not-in-publish || npm run prepublishOnly", | ||
"pretest": "npm run lint", | ||
@@ -16,3 +17,3 @@ "test": "npm run tests-only", | ||
"test:uglified": "node test/uglified", | ||
"posttest": "npx aud --production", | ||
"posttest": "aud --production", | ||
"lint": "eslint .", | ||
@@ -24,3 +25,3 @@ "version": "auto-changelog && git add CHANGELOG.md", | ||
"type": "git", | ||
"url": "git://github.com/ljharb/is-generator-function.git" | ||
"url": "git://github.com/inspect-js/is-generator-function.git" | ||
}, | ||
@@ -42,15 +43,14 @@ "keywords": [ | ||
"bugs": { | ||
"url": "https://github.com/ljharb/is-generator-function/issues" | ||
"url": "https://github.com/inspect-js/is-generator-function/issues" | ||
}, | ||
"dependencies": {}, | ||
"devDependencies": { | ||
"@ljharb/eslint-config": "^17.3.0", | ||
"aud": "^1.1.3", | ||
"@ljharb/eslint-config": "^17.6.0", | ||
"aud": "^1.1.5", | ||
"auto-changelog": "^2.2.1", | ||
"core-js": "^2.6.5 || ^3", | ||
"eslint": "^7.14.0", | ||
"core-js": "^2.6.5 || ^3 <3.9", | ||
"eslint": "^7.25.0", | ||
"make-generator-function": "^2.0.0", | ||
"nyc": "^10.3.2", | ||
"safe-publish-latest": "^1.1.4", | ||
"tape": "^5.0.1", | ||
"tape": "^5.2.2", | ||
"uglify-register": "^1.0.1" | ||
@@ -57,0 +57,0 @@ }, |
# is-generator-function <sup>[![Version Badge][2]][1]</sup> | ||
[![Build Status][3]][4] | ||
[![github actions][actions-image]][actions-url] | ||
[![coverage][codecov-image]][codecov-url] | ||
[![dependency status][5]][6] | ||
@@ -11,4 +12,2 @@ [![dev dependency status][7]][8] | ||
[![browser support][9]][10] | ||
Is this a native generator function? | ||
@@ -29,16 +28,15 @@ | ||
[1]: https://npmjs.org/package/is-generator-function | ||
[2]: http://versionbadg.es/ljharb/is-generator-function.svg | ||
[3]: https://travis-ci.org/ljharb/is-generator-function.svg | ||
[4]: https://travis-ci.org/ljharb/is-generator-function | ||
[5]: https://david-dm.org/ljharb/is-generator-function.svg | ||
[6]: https://david-dm.org/ljharb/is-generator-function | ||
[7]: https://david-dm.org/ljharb/is-generator-function/dev-status.svg | ||
[8]: https://david-dm.org/ljharb/is-generator-function#info=devDependencies | ||
[9]: https://ci.testling.com/ljharb/is-generator-function.png | ||
[10]: https://ci.testling.com/ljharb/is-generator-function | ||
[2]: https://versionbadg.es/inspect-js/is-generator-function.svg | ||
[5]: https://david-dm.org/inspect-js/is-generator-function.svg | ||
[6]: https://david-dm.org/inspect-js/is-generator-function | ||
[7]: https://david-dm.org/inspect-js/is-generator-function/dev-status.svg | ||
[8]: https://david-dm.org/inspect-js/is-generator-function#info=devDependencies | ||
[11]: https://nodei.co/npm/is-generator-function.png?downloads=true&stars=true | ||
[license-image]: http://img.shields.io/npm/l/is-generator-function.svg | ||
[license-image]: https://img.shields.io/npm/l/is-generator-function.svg | ||
[license-url]: LICENSE | ||
[downloads-image]: http://img.shields.io/npm/dm/is-generator-function.svg | ||
[downloads-url]: http://npm-stat.com/charts.html?package=is-generator-function | ||
[downloads-image]: https://img.shields.io/npm/dm/is-generator-function.svg | ||
[downloads-url]: https://npm-stat.com/charts.html?package=is-generator-function | ||
[codecov-image]: https://codecov.io/gh/inspect-js/is-generator-function/branch/main/graphs/badge.svg | ||
[codecov-url]: https://app.codecov.io/gh/inspect-js/is-generator-function/ | ||
[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/inspect-js/is-generator-function | ||
[actions-url]: https://github.com/inspect-js/is-generator-function/actions |
Sorry, the diff of this file is not supported yet
116
31261
12
41