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

Simplify check for promises in equals #93

Merged
merged 4 commits into from
Oct 13, 2023

Conversation

Igorbek
Copy link
Contributor

@Igorbek Igorbek commented Oct 11, 2023

The current implementation of the equals function performs a check if the given object is a Promise by pattern-matching stringified function.

Since the function might redefine its toString function, the check is not considered a reliable.

According to Promises A+ spec, the only way to check if the object is thenable is that it has a member called then that is a function.

@oleksiilevzhynskyi oleksiilevzhynskyi merged commit 73e4a10 into grammarly:master Oct 13, 2023
1 check passed
@Igorbek Igorbek deleted the f-fix-equals branch October 13, 2023 18:24
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

Successfully merging this pull request may close these issues.

None yet

3 participants