bowser icon indicating copy to clipboard operation
bowser copied to clipboard

Improve documentation for 2.0

Open lancedikson opened this issue 5 years ago • 8 comments

  • [ ] Describe Parser's alternative initialization
  • [ ] Add more examples to existing methods
  • [ ] Describe uncovered methods of Parser
  • [ ] Describe a list of canonical browser names
  • [ ] Describe a list of possible returns from Parser.getPlatformType, Parser.get...

lancedikson avatar Mar 07 '19 06:03 lancedikson

Another thing: I can’t find a list of canonical browser names (i.e. valid inputs to is()) anywhere in the documentation. I had to scroll through the source of the parser-browsers module.

outoftime avatar Mar 12 '19 16:03 outoftime

Right, good point. Thanks, @outoftime. Added it to the list.

lancedikson avatar Mar 13 '19 07:03 lancedikson

May the doc also explain in more detail the browser.satisfies() API? For instance I understand this:

if (browser.satisfies({chrome: '>118.01.1322' }))

However I don't know how to do something like this (which does not work at all):

if (browser.satisfies({chrome: '>118.01.1322 && < 119'' }))

ibc avatar May 04 '19 21:05 ibc

@ibc, thanks for your feedback. Sure, we need to add more examples to the docs. The answer to your question is hidden in readme.md :)

  // and loose-equality operator
  chrome: "~20"         // will match any 20.* sub-version
  chrome: "~20.1"       // will match any 20.1.* sub-version (20.1.19 as well as 20.1.12.42-alpha.1)

lancedikson avatar May 04 '19 22:05 lancedikson

Thanks @lancedikson. Perhaps I should have written a more complex example, like if I want to detect Chrome between versions 70 and 75. Is that possible?

ibc avatar May 04 '19 22:05 ibc

I have another suggestion to add to the list for documentation improvements. An example is that the docs for getPlatformType don't clearly list what the possible response values would be. I found them listed in the ParsedResult docs, but for these individual functions it would be helpful if the values were listed inline, or at least offer a link to ParsedResults.

tebs1200 avatar May 20 '19 01:05 tebs1200

@ibc, sorry for the late response, was on a vacation :)

I want to detect Chrome between versions 70 and 75. Is that possible?

Yes, but it would be done with simple logic maths in JS:

if (browser.satisfies({chrome: '>=70'}) && browser.satisfies({chrome: '<=75'})) { ... }

There's no way to set a range for .satisfies now. But, it could be a great feature. We should open an issue and implement it someday.

lancedikson avatar May 20 '19 07:05 lancedikson

@tebs1200, yes, thank you. I'll add a point about that.

lancedikson avatar May 20 '19 07:05 lancedikson