We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
is-generator-function
https://github.com/inspect-js/is-generator-function
There is a one-liner replacement:
const isGenerator = typeof fn === 'function' && Object.getPrototypeof(fn) === (function* () {}.constructor);
Though you probably want to cache the generator prototype (JS should make it a global, IMO).
is-generator-function depends on has-tostringtag (which depends on a third) so replacing this could eliminate up to three dependencies.
has-tostringtag
The text was updated successfully, but these errors were encountered:
In Node context, we can also use util.types.isGeneratorFunction from v10 Node.
util.types.isGeneratorFunction
Sorry, something went wrong.
No branches or pull requests
https://github.com/inspect-js/is-generator-function
There is a one-liner replacement:
Though you probably want to cache the generator prototype (JS should make it a global, IMO).
is-generator-function
depends onhas-tostringtag
(which depends on a third) so replacing this could eliminate up to three dependencies.The text was updated successfully, but these errors were encountered: