Détail du package

is-generator-function

inspect-js147.3mMIT1.1.0

Determine if a function is a native generator function.

generator, generator function, es6, es2015

readme

is-generator-function Version Badge

github actions coverage dependency status dev dependency status License Downloads

npm badge

Is this a native generator function?

Example

var isGeneratorFunction = require('is-generator-function');
assert(!isGeneratorFunction(function () {}));
assert(!isGeneratorFunction(null));
assert(isGeneratorFunction(function* () { yield 42; return Infinity; }));

Tests

Simply clone the repo, npm install, and run npm test

changelog

Changelog

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog and this project adheres to Semantic Versioning.

v1.1.0 - 2025-01-02

Commits

  • [actions] reuse common workflows 7301651
  • [actions] split out node 10-20, and 20+ 40f30a5
  • [meta] use npmignore to autogenerate an npmignore file ec843a4
  • [New] add types 6dd27c4
  • [actions] update codecov uploader 717f85e
  • [Dev Deps] update eslint, @ljharb/eslint-config, safe-publish-latest, tape 4280e62
  • [actions] update rebase action to use reusable workflow 895c2d0
  • [Tests] use for-each 3caee87
  • [Robustness] use call-bound 1eb55de
  • [Dev Deps] update eslint, @ljharb/eslint-config, aud, auto-changelog, object-inspect, tape 5bbd4cd
  • [Robustness] use safe-regex-test 5f8b992
  • [Dev Deps] update @ljharb/eslint-config, auto-changelog, npmignore, tape c730f4c
  • [Robustness] use get-proto 6dfff38
  • [Tests] replace aud with npm audit 725db70
  • [Deps] update has-tostringtag 5cc3c2d
  • [Dev Deps] add missing peer dep 869a507

v1.0.10 - 2021-08-05

Commits

  • [Dev Deps] update eslint, auto-changelog, core-js, tape 63cd935
  • [Fix] use has-tostringtag to behave correctly in the presence of symbol shams 8c3fe76
  • [Dev Deps] unpin core-js v3 ebf2885

v1.0.9 - 2021-05-05

Fixed

  • [Fix] avoid calling Function until absolutely necessary #41

Commits

  • [actions] use node/install instead of node/run; use codecov action 612862b
  • [meta] do not publish github action workflow files c13855d
  • [readme] fix repo URLs; remove travis badge bd11a2a
  • [Dev Deps] update eslint, @ljharb/eslint-config, aud, tape 23f54d4
  • [readme] add actions and codecov badges 9e759ef
  • [Dev Deps] update eslint, @ljharb/eslint-config, tape 6305f8d
  • [meta] remove explicit audit level config db4391c
  • [meta] use prepublishOnly script for npm 7+ 82c5b18
  • [Dev Deps] pin core-js v3 to < v3.9 5f6cc2a
  • [Tests] avoid running harmony tests on node 16+ c41526b
  • [actions] update workflows a348c5d

v1.0.8 - 2020-12-02

Fixed

  • [Refactor] improve performance in non-toStringTag envs #9

Commits

  • [Tests] use shared travis-ci configs 98c84ec
  • [Tests] migrate tests to Github Actions 52ea2e2
  • [meta] add auto-changelog a31c8d9
  • [Tests] remove jscs c30694e
  • [meta] remove unused Makefile and associated utilities 23a8dd7
  • [Tests] up to node v11.4, v10.14, v8.14, v6.15 9711495
  • [Dev Deps] update eslint, @ljharb/eslint-config, tape, make-generator-function; add safe-publish-latest 3afb4d0
  • [Tests] up to node v10.0, v9.11, v8.11, v6.14, v4.9 f1e9b0f
  • [Tests] up to node v11.13, v10.15, v8.15, v6.17 433ca64
  • [Tests] run nyc on all tests 84d8e18
  • [Dev Deps] update eslint, @ljharb/eslint-config, aud, auto-changelog, tape ec51a9f
  • [Dev Deps] update eslint, @ljharb/eslint-config, replace, semver, tape 180fb0d
  • [actions] add automatic rebasing / merge commit blocking 7e0f94b
  • [Dev Deps] update eslint, @ljharb/eslint-config, covert, tape, replace, semver, core-js 75768b3
  • [Dev Deps] update eslint, @ljharb/eslint-config, core-js, replace, semver, tape d6413cd
  • [actions] add "Allow Edits" workflow e73fec7
  • [Dev Deps] update core-js, eslint, nsp, semver, tape 6746c73
  • [Tests] switch from nsp to npm audit; allow it to fail for now 301aa25
  • [Dev Deps] update eslint, @ljharb/eslint-config, aud, auto-changelog d978937
  • Revert "[Refactor] improve performance in non-toStringTag envs" 3892c18
  • [Tests] test on both core-js 3 and 2 fac5447
  • [Tests] use npx aud instead of npm audit with hoops e12897f
  • [meta] add funding field 60711d1
  • [Fix] Object.getPrototypeOf does not exist in all engines 7484531
  • [Dev Deps] update auto-changelog, tape fe92b74
  • [Dev Deps] update eslint, tape 2f16f77
  • [Dev Deps] update core-js, replace c67825a
  • [Tests] on node v10.1 b00dbcc
  • [actions] update rebase action to use checkout v2 85c7947
  • [actions] switch Automatic Rebase workflow to pull_request_target event d2fd827
  • [Dev Deps] update @ljharb/eslint-config 791766e

v1.0.7 - 2017-12-27

Fixed

  • [Tests] run tests with uglify-register #16
  • Exclude testling.html from npm package. #8

Commits

  • [Tests] up to node v8.4; use nvm install-latest-npm to ensure new npm doesn’t break old node; remove osx builds 365004b
  • [Tests] up to node v9.2, v8.9, v6.12; pin included builds to LTS 33916ea
  • [Dev Deps] update core-js, eslint, nsp b4ce014
  • [Dev Deps] update eslint, @ljharb/eslint-config, core-js, nsp, semver, tape e4b499f
  • [Tests] up to node v7.4, v4.7 ce642b6
  • Only apps should have lockfiles. ea4dfb1
  • [Tests] on node v9.3 307d9c1
  • fix: example code missing ) after argument list 05f62c7
  • [Tests] update uglify-register 7376bec
  • [Dev Deps] update eslint c3f5895

v1.0.6 - 2016-12-20

Fixed

  • [Fix] fix is-generator-function in an env without native generators, with core-js. #33

Commits

  • [Tests] fix linting errors. 9d12cdb

v1.0.5 - 2016-12-19

Commits

  • Update tape, semver, eslint; use my personal shared eslint config. 3a1192c
  • Add npm run eslint ae191b6
  • [Tests] improve test matrix 0d0837f
  • [Dev Deps] update tape, jscs, eslint, @ljharb/eslint-config, semver, nsp 6523655
  • Update jscs, tape, semver c185388
  • Update eslint 9959dbc
  • Update tape, jscs, eslint, @ljharb/eslint-config 5945497
  • [Dev Deps] update tape, jscs, eslint, @ljharb/eslint-config 1754eae
  • Update eslint, semver, nsp a40f7af
  • Update covert, jscs, eslint, semver f7c3504
  • [Fix] account for Safari 10 which reports the wrong toString on generator functions. 3a3a52b
  • [Dev Deps] update tape, jscs, eslint, @ljharb/eslint-config, semver, nsp aaab6c3
  • [Dev Deps] update jscs e24641c
  • [Tests] up to io.js v3.3, node v4.1 c43c5ad
  • Add npm run security via nsp 24256ca
  • Test up to io.js v2.3 730233f
  • [Tests] use pretest/posttest for linting/security 3e6b860
  • [Refactor] remove useless Object#toString check. 9d4d7ac
  • [Dev Deps] Update tape, eslint 34673b8
  • Test up to io.js v2.1 1e91585
  • Test on two latest io.js versions. 8702608
  • Test on iojs-v1.5 and iojs-v1.6 c74935e
  • Latest node now supports generators. beb3bfe
  • [Dev Deps] update tape c6e6587
  • Switch from vb.teelaun.ch to versionbadg.es for the npm version badge SVG. 0039875
  • Test on io.js v2.5 0017408
  • Test on io.js v2.4 bc013e2
  • Test on io.js v3.0 e195030

v1.0.4 - 2015-03-03

Fixed

  • Add support for detecting concise generator methods. #2

Commits

  • All grade A-supported node/iojs versions now ship with an npm that understands ^. 6562e80
  • Run travis-ci tests on iojs and node v0.12; speed up builds; allow 0.8 failures. 592f768
  • Test on latest io.js edca329
  • Forgot to add replace in 209fac444b4bd90eaa8df279457c4a15e6bba6d2 3ebfb38
  • Update semver c21baa5
  • Update jscs 71a68f4
  • Update tape 32c03cf

v1.0.3 - 2015-01-31

Commits

  • make release 209fac4
  • Run tests against a faked @@toStringTag c9ba1ea
  • Add sudo: false to speed up travis-ci tests. a4b41e1
  • Bail out early when typeof is not "function" a62e7a5

v1.0.2 - 2015-01-20

Commits

v1.0.1 - 2014-12-14

Commits

v1.0.0 - 2014-08-09

Commits

v0.0.0 - 2014-02-09

Commits