isGeneratorFunction
Checks if a value is a generator function (a function* declaration or expression).
Distinct from isGenerator: this predicate targets the function itself, not the iterator it produces when called.
Available since v2.0.3
Import
Section titled “Import”Signature
Section titled “Signature”Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
value | unknown | The value to check |
Returns
Section titled “Returns”value is GeneratorFunction — true if value is a GeneratorFunction
Examples
Section titled “Examples”Detect a generator function
Section titled “Detect a generator function”Returns true for function* declarations and expressions.
Filter generator factories from a mixed array
Section titled “Filter generator factories from a mixed array”Use as a predicate to select only generator functions.
