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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feature]: add isEngine() into is() for simplicity #480

Open
ivodolenc opened this issue Jun 12, 2021 · 0 comments
Open

[feature]: add isEngine() into is() for simplicity #480

ivodolenc opened this issue Jun 12, 2021 · 0 comments

Comments

@ivodolenc
Copy link

Hi and thanks for your awesome work 馃憢

I want to mention, this isn't a issue but a possible feature-request. And I'm sorry if I misunderstood or missed something, I don't think this is documented at the moment.

Current behavior

.is(anything, includingAlias) checks only for isBrowser, isOS and isPlatform but not for isEngine.

const browser = Bowser.getParser(window.navigator.userAgent)

// Is Platform
browser.is('desktop') // true

// Is OS
browser.is('macos') // true

// Is Browser
browser.is('chrome') // true

// ---

// Is Engine
browser.is('blink') // false -> doesn't work

// but
browser.isEngine('blink') // true -> works as expected

Feature request

It would be great if we could use .is('isEngine') to check if the engine is called anything, just like we use it for platform, os or browser.

This makes it easier to use and removes possible doubts as to whether it's an bug or not.

// Currently this doesn't work
browser.is('blink') 

Additional info

I did a quick test and add || this.isEngine(anything) to this line. It turned out to work as expected.

  is(anything, includingAlias = false) {
    return this.isBrowser(anything, includingAlias) || this.isOS(anything)
+      || this.isPlatform(anything) || this.isEngine(anything);
  }

Now we can check for Engine like this:

// Is Engine
browser.is('blink') // true -> works as expected

// or
browser.isEngine('blink') // true -> works as expected
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

1 participant