Skip to content
New issue

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

isGenerator? #3

Open
kevinbarabash opened this issue Jan 7, 2016 · 2 comments
Open

isGenerator? #3

kevinbarabash opened this issue Jan 7, 2016 · 2 comments

Comments

@kevinbarabash
Copy link

Not sure if it makes sense to include it in this proposal but it would be nice to have.

@Jamesernator
Copy link

Not sure by isGenerator if you mean a generator object or a generator function, both should be possible.

For testing for a generator object the spec defines that all generator objects have a [[GeneratorState]] property, which after initialization must have a value from: "suspendedStart", "suspendedYield", "executing", "completed", so that should be easy to check.

For testing for a generator function its as trivial as checking "[[FunctionKind]]" is equal to "generator".

@hax
Copy link
Contributor

hax commented Jan 27, 2020

isGenerator may be useful, but we may also need isAsyncFunction isAsyncGenerator or even isBoundFunction isArrowFunction, etc.

I feel we should leave them for future proposals. But maybe we could consider how to make APIs extendable for those future requirements.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants