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

Add parser.some() #235

Closed
wants to merge 1 commit into from
Closed

Conversation

mjlescano
Copy link
Contributor

Hi @lancedikson !

What do you think about this? It adds the function Parser.some() to be able to check if the browser satisfies any of the given options.

The function is called some to mimic the native array convention: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/some

This will allow us to change code like this:

const supportsPinch =
  browser.safari
  || browser.chrome
  || browser.opera
  || browser.firefox

for this:

const supportsPinch = browser.some(['safari', 'chrome', 'opera', 'firefox']);

@coveralls
Copy link

Pull Request Test Coverage Report for Build 317

  • 1 of 1 (100.0%) changed or added relevant line in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.04%) to 86.243%

Totals Coverage Status
Change from base Build 316: 0.04%
Covered Lines: 404
Relevant Lines: 426

💛 - Coveralls

@lancedikson
Copy link
Collaborator

Hey, @mjlescano. Thanks for the PR. I agree it may be useful. Let's add this in the next release 👍

@lancedikson
Copy link
Collaborator

The feature has been published as 2.0.0-alpha.3. I haven't merged this PR since the releasing process is made from develop branch currently, so it's better to apply features to it instead of master.
But, I've cherry-picked your commit and published. So, try 2.0.0-alpha.3 and thanks for your collaboration.

@mjlescano mjlescano deleted the add/parser-some branch July 22, 2018 17:31
@mjlescano
Copy link
Contributor Author

Awesome, thanks!

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.

3 participants