type-detect icon indicating copy to clipboard operation
type-detect copied to clipboard

Documentation for iterators, global, and browser environment missing

Open tshinnic opened this issue 5 years ago • 2 comments

README.md mentions some features only in passing, without supporting documentation, thus leaving some features 'hidden' and unusable.

It mentions ES2015 support and documents many of the added APIs, but not all. Surprised at no mention of iterators I still found them supported in the code.

Return possibilities

  'Map Iterator'
  'Set Iterator'
  'Array Iterator'
  'String Iterator'

should be documented, though it may be hard to come up with easily understood examples on when these values are encountered. A combination of built-in objects and method calls ...?

    assert(type(new Map()).entries() === 'Map Iterator')
    assert(type(new Set()).entries() === 'Set Iterator')

While spelunking I found these browser/DOM-related values in the code:

return value notes on source
'global' (browser) window , (node) global , others...
'Location' window.location
'Document' window.document
'MimeTypeArray' window.navigator.mimeTypes
'PluginArray' window.navigator.plugins
'HTMLQuoteElement' (IE fix) HTMLElement HTMLElement BLOCKQUOTE
'HTMLTableDataCellElement' (W3C vs. WhatWG fix) HTMLElement TD
'HTMLTableHeaderCellElement' (W3C vs. WhatWG fix) HTMLElement TH

After much scrolling of doc/code windows I think the above are all the missing parts.

If the mentions in passing of "global object", "iterators", "browsers" and "HTML elements" in README.md can be matched up with documented type string return values then readers will know how to use all the features this package provides.

tshinnic avatar Mar 04 '19 06:03 tshinnic

@tshinnic a lot of these rely on the browsers Symbol.toStringTag value on each implementation, which is why they're not so well documented here.

It looks like you've done a great job documenting some of these already - so if you'd like to PR what you have so far that'd be a great start to documenting all of this!

keithamus avatar Mar 04 '19 11:03 keithamus

boolean is also missing.

IanKemp avatar Jan 13 '20 12:01 IanKemp