(str)
| 1711 | var INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g |
| 1712 | |
| 1713 | function base64clean (str) { |
| 1714 | // Node takes equal signs as end of the Base64 encoding |
| 1715 | str = str.split('=')[0] |
| 1716 | // Node strips out invalid characters like \n and \t from the string, base64-js does not |
| 1717 | str = str.trim().replace(INVALID_BASE64_RE, '') |
| 1718 | // Node converts strings with length < 2 to '' |
| 1719 | if (str.length < 2) return '' |
| 1720 | // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not |
| 1721 | while (str.length % 4 !== 0) { |
| 1722 | str = str + '=' |
| 1723 | } |
| 1724 | return str |
| 1725 | } |
| 1726 | |
| 1727 | function toHex (n) { |
| 1728 | if (n < 16) return '0' + n.toString(16) |
no outgoing calls
no test coverage detected
searching dependent graphs…