js-base64 2.6.2 → 2.6.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/base64.js CHANGED
@@ -22,7 +22,7 @@
22
22
  // existing version for noConflict()
23
23
  global = global || {};
24
24
  var _Base64 = global.Base64;
25
- var version = "2.6.2";
25
+ var version = "2.6.3";
26
26
  // constants
27
27
  var b64chars
28
28
  = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
@@ -155,16 +155,17 @@
155
155
  return _atob(String(a).replace(/[^A-Za-z0-9\+\/]/g, ''));
156
156
  };
157
157
  var _decode = function(a) { return btou(_atob(a)) };
158
+ var _fromURI = function(a) {
159
+ return String(a).replace(/[-_]/g, function(m0) {
160
+ return m0 == '-' ? '+' : '/'
161
+ }).replace(/[^A-Za-z0-9\+\/]/g, '');
162
+ };
158
163
  var decode = function(a){
159
- return _decode(
160
- String(a).replace(/[-_]/g, function(m0) {
161
- return m0 == '-' ? '+' : '/'
162
- }).replace(/[^A-Za-z0-9\+\/]/g, '')
163
- );
164
+ return _decode(_fromURI(a));
164
165
  };
165
166
  var toUint8Array;
166
167
  if (global.Uint8Array) toUint8Array = function(a) {
167
- return Uint8Array.from(atob(a), function(c) {
168
+ return Uint8Array.from(atob(_fromURI(a)), function(c) {
168
169
  return c.charCodeAt(0);
169
170
  });
170
171
  };
package/bower.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "js-base64",
3
- "version": "2.6.2",
3
+ "version": "2.6.3",
4
4
  "license": "BSD-3-Clause",
5
5
  "main": [
6
6
  "./base64.js"
package/package.js CHANGED
@@ -6,4 +6,4 @@ Package.on_use(function(api){
6
6
  api.export('Base64');
7
7
 
8
8
  api.add_files(['base64.js'], 'server');
9
- });
9
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "js-base64",
3
- "version": "2.6.2",
3
+ "version": "2.6.3",
4
4
  "description": "Yet another Base64 transcoder in pure-JS",
5
5
  "main": "base64.js",
6
6
  "directories": {
package/test/dankogai.js CHANGED
@@ -43,7 +43,7 @@ describe('Base64', function () {
43
43
  it('.decode', is(Base64.decode('5bCP6aO85by-'), '小飼弾'));
44
44
  });
45
45
 
46
- if (typeof Uint8Array === 'function') describe('fromBase64', function() {
46
+ if (typeof Uint8Array === 'function') describe('fromUint8Array', function() {
47
47
  it('dankogai', is(Base64.fromUint8Array(new Uint8Array([100,97,110,107,111,103,97,105])), Base64.encode('dankogai')));
48
48
  it('dankoga', is(Base64.fromUint8Array(new Uint8Array([100,97,110,107,111,103,97])), Base64.encode('dankoga')));
49
49
  it('dankog', is(Base64.fromUint8Array(new Uint8Array([100,97,110,107,111,103])), Base64.encode('dankog')));
@@ -55,7 +55,7 @@ if (typeof Uint8Array === 'function') describe('fromBase64', function() {
55
55
  it('', is(Base64.fromUint8Array(new Uint8Array([])), Base64.encode('')));
56
56
  });
57
57
 
58
- if (typeof Uint8Array === 'function') describe('toBase64', function() {
58
+ if (typeof Uint8Array === 'function') describe('toUint8Array', function() {
59
59
  it('ZGFua29nYWk=', is(Base64.toUint8Array('ZGFua29nYWk=').toString(), '100,97,110,107,111,103,97,105'));
60
60
  it('ZGFua29nYQ==', is(Base64.toUint8Array('ZGFua29nYQ==').toString(), '100,97,110,107,111,103,97'));
61
61
  it('ZGFua29n', is(Base64.toUint8Array('ZGFua29n').toString(), '100,97,110,107,111,103'));