Skip to content

Add boolean conversion to ? suffixed predicate method #258

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

Merged
merged 3 commits into from
Jul 24, 2023

Conversation

kateinoigakukun
Copy link
Member

This feature satisfies the scenario shown in #247 in a Ruby way. The form of the shorthand looks much Rubyish and smarter than == JS::True, also it brings minimum complexity.
e.g.

searchParams = JS.global[:URLSearchParams].new(JS.global[:location][:search])
# "URLSearchParams.has" returns Boolean in JS,
# and '?' indicates the returned JS boolean is converted to Ruby boolean
if searchParams.has?('q')
  # ...
end

This idea itself is suggested by @znz. Thanks!

@kateinoigakukun kateinoigakukun force-pushed the katei/js-predicate-method branch from 520ada6 to c1e2afd Compare July 24, 2023 08:02
@kateinoigakukun kateinoigakukun marked this pull request as ready for review July 24, 2023 08:53
@kateinoigakukun kateinoigakukun merged commit 67ae96b into main Jul 24, 2023
@kateinoigakukun kateinoigakukun deleted the katei/js-predicate-method branch July 24, 2023 08:53
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.

1 participant