Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

is-generator-function

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

is-generator-function

Determine if a function is a native generator function.

  • 1.0.10
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
25M
increased by7.08%
Maintainers
1
Weekly downloads
 
Created

What is is-generator-function?

The is-generator-function package is a utility that allows you to check if a given function is a generator function. This can be particularly useful when working with code that dynamically generates functions or when integrating with libraries that may use generator functions for asynchronous control flow.

What are is-generator-function's main functionalities?

Check if a function is a generator function

This feature allows you to distinguish between regular JavaScript functions and generator functions. By passing a function to `isGeneratorFunction`, it returns `true` if the function is a generator function and `false` otherwise. This can be useful for dynamic function handling or when working with APIs that may provide generator functions.

const isGeneratorFunction = require('is-generator-function');

function* myGenerator() {}
const regularFunction = function() {};

console.log(isGeneratorFunction(myGenerator)); // true
console.log(isGeneratorFunction(regularFunction)); // false

Other packages similar to is-generator-function

Keywords

FAQs

Package last updated on 06 Aug 2021

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc