Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/austingebauer/devise.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/js-base64/base64.js')
-rw-r--r--node_modules/js-base64/base64.js32
1 files changed, 11 insertions, 21 deletions
diff --git a/node_modules/js-base64/base64.js b/node_modules/js-base64/base64.js
index f8200ec..f310b1f 100644
--- a/node_modules/js-base64/base64.js
+++ b/node_modules/js-base64/base64.js
@@ -22,7 +22,7 @@
// existing version for noConflict()
global = global || {};
var _Base64 = global.Base64;
- var version = "2.5.1";
+ var version = "2.5.2";
// if node.js and NOT React Native, we use Buffer
var buffer;
if (typeof module !== 'undefined' && module.exports) {
@@ -49,8 +49,8 @@
: cc < 0x800 ? (fromCharCode(0xc0 | (cc >>> 6))
+ fromCharCode(0x80 | (cc & 0x3f)))
: (fromCharCode(0xe0 | ((cc >>> 12) & 0x0f))
- + fromCharCode(0x80 | ((cc >>> 6) & 0x3f))
- + fromCharCode(0x80 | ( cc & 0x3f)));
+ + fromCharCode(0x80 | ((cc >>> 6) & 0x3f))
+ + fromCharCode(0x80 | ( cc & 0x3f)));
} else {
var cc = 0x10000
+ (c.charCodeAt(0) - 0xD800) * 0x400
@@ -83,32 +83,21 @@
} : function(b) {
return b.replace(/[\s\S]{1,3}/g, cb_encode);
};
- var _encode = buffer ?
- buffer.from && Uint8Array && buffer.from !== Uint8Array.from
- ? function (u) {
- return (u.constructor === buffer.constructor ? u : buffer.from(u))
- .toString('base64')
- }
- : function (u) {
- return (u.constructor === buffer.constructor ? u : new buffer(u))
- .toString('base64')
- }
- : function (u) { return btoa(utob(u)) }
- ;
+ var _encode = function(u) {
+ var isUint8Array = Object.prototype.toString.call(u) === '[object Uint8Array]';
+ return isUint8Array ? u.toString('base64')
+ : btoa(utob(String(u)));
+ }
var encode = function(u, urisafe) {
return !urisafe
- ? _encode(String(u))
+ ? _encode(u)
: _encode(String(u)).replace(/[+\/]/g, function(m0) {
return m0 == '+' ? '-' : '_';
}).replace(/=/g, '');
};
var encodeURI = function(u) { return encode(u, true) };
// decoder stuff
- var re_btou = new RegExp([
- '[\xC0-\xDF][\x80-\xBF]',
- '[\xE0-\xEF][\x80-\xBF]{2}',
- '[\xF0-\xF7][\x80-\xBF]{3}'
- ].join('|'), 'g');
+ var re_btou = /[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g;
var cb_btou = function(cccc) {
switch(cccc.length) {
case 4:
@@ -233,3 +222,4 @@
// that's it!
return {Base64: global.Base64}
}));
+