Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

js-base64

Package Overview
Dependencies
Maintainers
1
Versions
68
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

js-base64 - npm Package Compare versions

Comparing version 2.6.0 to 2.6.1

28

base64.js

@@ -25,3 +25,3 @@ /*

var _Base64 = global.Base64;
var version = "2.6.0";
var version = "2.6.1";
// constants

@@ -81,9 +81,7 @@ var b64chars

var _encode = function(u) {
var isUint8Array = Object.prototype.toString.call(u) === '[object Uint8Array]';
return isUint8Array ? u.toString('base64')
: btoa(utob(String(u)));
}
return btoa(utob(String(u)));
};
var encode = function(u, urisafe) {
return !urisafe
? _encode(u)
? _encode(String(u))
: _encode(String(u)).replace(/[+\/]/g, function(m0) {

@@ -94,2 +92,7 @@ return m0 == '+' ? '-' : '_';

var encodeURI = function(u) { return encode(u, true) };
var fromUint8Array = function(a) {
return btoa(Array.from(a, function(c) {
return String.fromCharCode(c)
}).join(''));
};
// decoder stuff

@@ -148,6 +151,12 @@ var re_btou = /[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g;

return _decode(
String(a).replace(/[-_]/g, function(m0) { return m0 == '-' ? '+' : '/' })
.replace(/[^A-Za-z0-9\+\/]/g, '')
String(a).replace(/[-_]/g, function(m0) {
return m0 == '-' ? '+' : '/'
}).replace(/[^A-Za-z0-9\+\/]/g, '')
);
};
var toUint8Array = function(a) {
return Uint8Array.from(atob(a), function(c) {
return c.charCodeAt(0);
});
};
var noConflict = function() {

@@ -171,2 +180,4 @@ var Base64 = global.Base64;

noConflict: noConflict,
fromUint8Array: fromUint8Array,
toUint8Array: toUint8Array
};

@@ -211,2 +222,1 @@ // if ES5 is available, make Base64.extendString() available

}));
{
"name": "js-base64",
"version": "2.6.0",
"version": "2.6.1",
"license": "BSD-3-Clause",

@@ -5,0 +5,0 @@ "main": [

{
"name": "js-base64",
"version": "2.6.0",
"version": "2.6.1",
"description": "Yet another Base64 transcoder in pure-JS",

@@ -5,0 +5,0 @@ "main": "base64.js",

@@ -47,8 +47,16 @@ [![build status](https://secure.travis-ci.org/dankogai/js-base64.png)](http://travis-ci.org/dankogai/js-base64)

Base64.btoa( 'dankogai'); // ZGFua29nYWk=
Base64.encode('小飼弾'); // 5bCP6aO85by+
Base64.encodeURI('小飼弾'); // 5bCP6aO85by-
Base64.btoa( '小飼弾'); // raises exception
Base64.fromUint8Array( // ZGFua29nYWk=
new Uint8Array([100,97,110,107,111,103,97,105])
);
Base64.encode( '小飼弾'); // 5bCP6aO85by+
Base64.encodeURI('小飼弾'); // 5bCP6aO85by- which equals to Base64.encode('小飼弾', true)
Base64.btoa( '小飼弾'); // raises exception
```
```javascript
Base64.decode('ZGFua29nYWk='); // dankogai
Base64.atob( 'ZGFua29nYWk='); // dankogai
Base64.toUint8Array( // new Uint8Array([100,97,110,107,111,103,97,105])
'ZGFua29nYWk='
);
Base64.decode('5bCP6aO85by+'); // 小飼弾

@@ -55,0 +63,0 @@ // note .decodeURI() is unnecessary since it accepts both flavors

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc