Comparing version 3.4.2 to 3.4.3
@@ -12,10 +12,10 @@ /** | ||
*/ | ||
declare const version = "3.4.2"; | ||
declare const version = "3.4.3"; | ||
/** | ||
* @deprecated use lowercase `version`. | ||
*/ | ||
declare const VERSION = "3.4.2"; | ||
declare const VERSION = "3.4.3"; | ||
/** | ||
* does what `window.btoa` of web browsers does. | ||
* @param {String} src binary string | ||
* does what `window.btoa` of web browsers do. | ||
* @param {String} bin binary string | ||
* @returns {string} Base64-encoded string | ||
@@ -54,4 +54,4 @@ */ | ||
/** | ||
* does what `window.atob` of web browsers does. | ||
* @param {String} src Base64-encoded string | ||
* does what `window.atob` of web browsers do. | ||
* @param {String} asc Base64-encoded string | ||
* @returns {string} binary string | ||
@@ -70,4 +70,13 @@ */ | ||
declare const toUint8Array: (a: string) => any; | ||
/** | ||
* extend String.prototype with relevant methods | ||
*/ | ||
declare const extendString: () => void; | ||
/** | ||
* extend Uint8Array.prototype with relevant methods | ||
*/ | ||
declare const extendUint8Array: () => void; | ||
/** | ||
* extend Builtin prototypes with relevant methods | ||
*/ | ||
declare const extendBuiltins: () => void; | ||
@@ -74,0 +83,0 @@ declare const gBase64: { |
@@ -43,3 +43,3 @@ | ||
*/ | ||
const version = '3.4.2'; | ||
const version = '3.4.3'; | ||
/** | ||
@@ -63,4 +63,4 @@ * @deprecated use lowercase `version`. | ||
/** | ||
* does what `window.btoa` of web browsers does. | ||
* @param {String} src binary string | ||
* does what `window.btoa` of web browsers do. | ||
* @param {String} bin binary string | ||
* @returns {string} Base64-encoded string | ||
@@ -121,3 +121,5 @@ */ | ||
*/ | ||
const encode = (src, rfc4648 = false) => rfc4648 ? _mkUriSafe(_encode(src)) : _encode(src); | ||
const encode = (src, rfc4648 = false) => rfc4648 | ||
? _mkUriSafe(_encode(src)) | ||
: _encode(src); | ||
/** | ||
@@ -135,4 +137,4 @@ * converts a UTF-8-encoded string to URL-safe Base64 RFC4648. | ||
/** | ||
* does what `window.atob` of web browsers does. | ||
* @param {String} src Base64-encoded string | ||
* does what `window.atob` of web browsers do. | ||
* @param {String} asc Base64-encoded string | ||
* @returns {string} binary string | ||
@@ -180,32 +182,25 @@ */ | ||
}; | ||
/** | ||
* extend String.prototype with relevant methods | ||
*/ | ||
const extendString = function () { | ||
const _add = (name, body) => Object.defineProperty(String.prototype, name, _noEnum(body)); | ||
_add('fromBase64', function () { | ||
return decode(this); | ||
}); | ||
_add('toBase64', function (rfc4648) { | ||
return encode(this, rfc4648); | ||
}); | ||
_add('toBase64URI', function () { | ||
return encode(this, true); | ||
}); | ||
_add('toBase64URL', function () { | ||
return encode(this, true); | ||
}); | ||
_add('toUint8Array', function () { | ||
return toUint8Array(this); | ||
}); | ||
_add('fromBase64', function () { return decode(this); }); | ||
_add('toBase64', function (rfc4648) { return encode(this, rfc4648); }); | ||
_add('toBase64URI', function () { return encode(this, true); }); | ||
_add('toBase64URL', function () { return encode(this, true); }); | ||
_add('toUint8Array', function () { return toUint8Array(this); }); | ||
}; | ||
/** | ||
* extend Uint8Array.prototype with relevant methods | ||
*/ | ||
const extendUint8Array = function () { | ||
const _add = (name, body) => Object.defineProperty(Uint8Array.prototype, name, _noEnum(body)); | ||
_add('toBase64', function (rfc4648) { | ||
return fromUint8Array(this, rfc4648); | ||
}); | ||
_add('toBase64URI', function () { | ||
return fromUint8Array(this, true); | ||
}); | ||
_add('toBase64URL', function () { | ||
return fromUint8Array(this, true); | ||
}); | ||
_add('toBase64', function (rfc4648) { return fromUint8Array(this, rfc4648); }); | ||
_add('toBase64URI', function () { return fromUint8Array(this, true); }); | ||
_add('toBase64URL', function () { return fromUint8Array(this, true); }); | ||
}; | ||
/** | ||
* extend Builtin prototypes with relevant methods | ||
*/ | ||
const extendBuiltins = () => { | ||
@@ -212,0 +207,0 @@ extendString(); |
{ | ||
"name": "js-base64", | ||
"version": "3.4.2", | ||
"version": "3.4.3", | ||
"description": "Yet another Base64 transcoder in pure-JS", | ||
@@ -5,0 +5,0 @@ "main": "base64.js", |
@@ -32,3 +32,3 @@ [![build status](https://secure.travis-ci.org/dankogai/js-base64.png)](http://travis-ci.org/dankogai/js-base64) | ||
```html | ||
<script src="https://cdn.jsdelivr.net/npm/js-base64@3.4.2/base64.min.js"></script> | ||
<script src="https://cdn.jsdelivr.net/npm/js-base64@3.4.3/base64.min.js"></script> | ||
``` | ||
@@ -56,3 +56,3 @@ | ||
// note jsdelivr.net does not automatically minify .mjs | ||
import { Base64 } from 'https://cdn.jsdelivr.net/npm/js-base64@3.4.2/base64.mjs'; | ||
import { Base64 } from 'https://cdn.jsdelivr.net/npm/js-base64@3.4.3/base64.mjs'; | ||
</script> | ||
@@ -64,3 +64,3 @@ ``` | ||
// or if you prefer no Base64 namespace | ||
import { encode, decode } from 'https://cdn.jsdelivr.net/npm/js-base64@3.4.2/base64.mjs'; | ||
import { encode, decode } from 'https://cdn.jsdelivr.net/npm/js-base64@3.4.3/base64.mjs'; | ||
</script> | ||
@@ -67,0 +67,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
26010
557