
Company News
Socket Named Top Sales Organization by RepVue
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.
is-generator-function
Advanced tools
Is this a native generator function?
var isGeneratorFunction = require('is-generator-function');
assert(!isGeneratorFunction(function () {}));
assert(!isGeneratorFunction(null));
assert(isGeneratorFunction(function* () { yield 42; return Infinity; }));
Simply clone the repo, npm install, and run npm test
Similar to is-generator-function, is-generator checks if a given value is a generator object, which is different from checking if a function is a generator function. It's useful for identifying generator objects, but not for identifying generator functions directly.
While is-function is more general and checks if a given value is a function, it does not specifically differentiate between regular functions and generator functions. It's broader in scope compared to is-generator-function, which is specifically designed to identify generator functions.
FAQs
Determine if a function is a native generator function.
The npm package is-generator-function receives a total of 62,803,853 weekly downloads. As such, is-generator-function popularity was classified as popular.
We found that is-generator-function demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Company News
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.

Security News
NIST will stop enriching most CVEs under a new risk-based model, narrowing the NVD's scope as vulnerability submissions continue to surge.

Company News
/Security News
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.