(data)
| 4256 | __name(collectASequenceOfCodePointsFast, "collectASequenceOfCodePointsFast"); |
| 4257 | var ASCII_WHITESPACE_REPLACE_REGEX = /[\u0009\u000A\u000C\u000D\u0020]/g; |
| 4258 | function forgivingBase64(data) { |
| 4259 | data = data.replace(ASCII_WHITESPACE_REPLACE_REGEX, ""); |
| 4260 | let dataLength = data.length; |
| 4261 | if (dataLength % 4 === 0) { |
| 4262 | if (data.charCodeAt(dataLength - 1) === 61) { |
| 4263 | --dataLength; |
| 4264 | if (data.charCodeAt(dataLength - 1) === 61) { |
| 4265 | --dataLength; |
| 4266 | } |
| 4267 | } |
| 4268 | } |
| 4269 | if (dataLength % 4 === 1) { |
| 4270 | return "failure"; |
| 4271 | } |
| 4272 | if (/[^+/0-9A-Za-z]/.test(data.length === dataLength ? data : data.substring(0, dataLength))) { |
| 4273 | return "failure"; |
| 4274 | } |
| 4275 | const buffer = Buffer.from(data, "base64"); |
| 4276 | return new Uint8Array(buffer.buffer, buffer.byteOffset, buffer.byteLength); |
| 4277 | } |
| 4278 | __name(forgivingBase64, "forgivingBase64"); |
| 4279 | function isASCIIWhitespace(char) { |
| 4280 | return char === 9 || // \t |
no test coverage detected