(input)
| 1388 | } |
| 1389 | |
| 1390 | function atob(input) { |
| 1391 | if (arguments.length === 0) { |
| 1392 | throw new ERR_MISSING_ARGS('input'); |
| 1393 | } |
| 1394 | |
| 1395 | const result = _atob(`${input}`); |
| 1396 | |
| 1397 | switch (result) { |
| 1398 | case -2: // Invalid character |
| 1399 | throw lazyDOMException('Invalid character', 'InvalidCharacterError'); |
| 1400 | case -1: // Single character remained |
| 1401 | throw lazyDOMException( |
| 1402 | 'The string to be decoded is not correctly encoded.', |
| 1403 | 'InvalidCharacterError'); |
| 1404 | case -3: // Possible overflow |
| 1405 | // TODO(@anonrig): Throw correct error in here. |
| 1406 | throw lazyDOMException('The input causes overflow.', 'InvalidCharacterError'); |
| 1407 | default: |
| 1408 | return result; |
| 1409 | } |
| 1410 | } |
| 1411 | |
| 1412 | function isUtf8(input) { |
| 1413 | if (isTypedArray(input) || isAnyArrayBuffer(input)) { |
no test coverage detected
searching dependent graphs…