* @see https://fetch.spec.whatwg.org/#is-local * @param {URL} url * @returns {boolean}
(url)
| 1024 | * @returns {boolean} |
| 1025 | */ |
| 1026 | function urlIsLocal (url) { |
| 1027 | assert('protocol' in url) // ensure it's a url object |
| 1028 | |
| 1029 | const protocol = url.protocol |
| 1030 | |
| 1031 | // A URL is local if its scheme is a local scheme. |
| 1032 | // A local scheme is "about", "blob", or "data". |
| 1033 | return protocol === 'about:' || protocol === 'blob:' || protocol === 'data:' |
| 1034 | } |
| 1035 | |
| 1036 | /** |
| 1037 | * @param {string|URL} url |
no test coverage detected