* @see https://www.rfc-editor.org/rfc/rfc1738#section-2.2 * @param {string} url * @returns {boolean}
(url)
| 60 | * @returns {boolean} |
| 61 | */ |
| 62 | function isValidEncodedURL (url) { |
| 63 | for (let i = 0; i < url.length; ++i) { |
| 64 | const code = url.charCodeAt(i) |
| 65 | |
| 66 | if ( |
| 67 | code > 0x7E || // Non-US-ASCII + DEL |
| 68 | code < 0x20 // Control characters NUL - US |
| 69 | ) { |
| 70 | return false |
| 71 | } |
| 72 | } |
| 73 | return true |
| 74 | } |
| 75 | |
| 76 | /** |
| 77 | * If string contains non-ASCII characters, assumes it's UTF-8 encoded and decodes it. |
no outgoing calls
no test coverage detected