Comparing version 3.5.1 to 3.5.2
@@ -12,7 +12,7 @@ /** | ||
*/ | ||
declare const version = "3.5.1"; | ||
declare const version = "3.5.2"; | ||
/** | ||
* @deprecated use lowercase `version`. | ||
*/ | ||
declare const VERSION = "3.5.1"; | ||
declare const VERSION = "3.5.2"; | ||
/** | ||
@@ -68,2 +68,6 @@ * polyfill version of `btoa` | ||
/** | ||
* converts a Base64 string to a Uint8Array. | ||
*/ | ||
declare const toUint8Array: (a: string) => Uint8Array; | ||
/** | ||
* converts a Base64 string to a UTF-8 string. | ||
@@ -75,6 +79,2 @@ * @param {String} src Base64 string. Both normal and URL-safe are supported | ||
/** | ||
* converts a Base64 string to a Uint8Array. | ||
*/ | ||
declare const toUint8Array: (a: string) => any; | ||
/** | ||
* extend String.prototype with relevant methods | ||
@@ -107,3 +107,3 @@ */ | ||
fromUint8Array: (u8a: Uint8Array, urlsafe?: boolean) => string; | ||
toUint8Array: (a: string) => any; | ||
toUint8Array: (a: string) => Uint8Array; | ||
extendString: () => void; | ||
@@ -110,0 +110,0 @@ extendUint8Array: () => void; |
@@ -43,3 +43,3 @@ | ||
*/ | ||
const version = '3.5.1'; | ||
const version = '3.5.2'; | ||
/** | ||
@@ -148,3 +148,4 @@ * @deprecated use lowercase `version`. | ||
? (s) => Buffer.from(s, 'utf8').toString('base64') | ||
: _TE ? (s) => _fromUint8Array(_TE.encode(s)) | ||
: _TE | ||
? (s) => _fromUint8Array(_TE.encode(s)) | ||
: (s) => _btoa(utob(s)); | ||
@@ -221,2 +222,11 @@ /** | ||
: atobPolyfill; | ||
// | ||
const _toUint8Array = _hasBuffer | ||
? (a) => _U8Afrom(Buffer.from(a, 'base64')) | ||
: (a) => _U8Afrom(_atob(a), c => c.charCodeAt(0)); | ||
/** | ||
* converts a Base64 string to a Uint8Array. | ||
*/ | ||
const toUint8Array = (a) => _toUint8Array(_unURI(a)); | ||
// | ||
const _decode = _hasBuffer | ||
@@ -235,10 +245,2 @@ ? (a) => Buffer.from(a, 'base64').toString('utf8') | ||
// | ||
const _toUint8Array = _hasBuffer | ||
? (a) => _U8Afrom(Buffer.from(a, 'base64')) | ||
: (a) => _U8Afrom(_atob(a), c => c.charCodeAt(0)); | ||
/** | ||
* converts a Base64 string to a Uint8Array. | ||
*/ | ||
const toUint8Array = (a) => _toUint8Array(_unURI(a)); | ||
// | ||
const _noEnum = (v) => { | ||
@@ -245,0 +247,0 @@ return { |
{ | ||
"name": "js-base64", | ||
"version": "3.5.1", | ||
"version": "3.5.2", | ||
"description": "Yet another Base64 transcoder in pure-JS", | ||
@@ -5,0 +5,0 @@ "main": "base64.js", |
@@ -9,5 +9,5 @@ [![build status](https://secure.travis-ci.org/dankogai/js-base64.png)](http://travis-ci.org/dankogai/js-base64) | ||
## HEADS UP: switch to TypeScript since version 3.3 | ||
## HEADS UP | ||
In version 3.0 `js-base64` switch to ES2015 module. That made it easy to switch to TypeScript(just renaming `base64.mjs` to `base64.ts` was almost enough). Now `base64.mjs` is compiled from `base64.ts` then `base64.js` is generated from `base64.mjs`. | ||
In version 3.0 `js-base64` switch to ES2015 module so it is no longer compatible with legacy browsers like IE (see below). And since version 3.3 it is written in TypeScript. Now `base64.mjs` is compiled from `base64.ts` then `base64.js` is generated from `base64.mjs`. | ||
@@ -33,3 +33,3 @@ ## Install | ||
```html | ||
<script src="https://cdn.jsdelivr.net/npm/js-base64@3.5.1/base64.min.js"></script> | ||
<script src="https://cdn.jsdelivr.net/npm/js-base64@3.5.2/base64.min.js"></script> | ||
``` | ||
@@ -57,3 +57,3 @@ | ||
// note jsdelivr.net does not automatically minify .mjs | ||
import { Base64 } from 'https://cdn.jsdelivr.net/npm/js-base64@3.5.1/base64.mjs'; | ||
import { Base64 } from 'https://cdn.jsdelivr.net/npm/js-base64@3.5.2/base64.mjs'; | ||
</script> | ||
@@ -65,3 +65,3 @@ ``` | ||
// or if you prefer no Base64 namespace | ||
import { encode, decode } from 'https://cdn.jsdelivr.net/npm/js-base64@3.5.1/base64.mjs'; | ||
import { encode, decode } from 'https://cdn.jsdelivr.net/npm/js-base64@3.5.2/base64.mjs'; | ||
</script> | ||
@@ -87,3 +87,2 @@ ``` | ||
## SYNOPSIS | ||
@@ -90,0 +89,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
31242
713
162