js-base64 2.6.0 → 2.6.4

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.
@@ -1,19 +0,0 @@
1
- /*
2
- * use mocha to test me
3
- * http://visionmedia.github.com/mocha/
4
- */
5
- var assert = assert || require("assert");
6
- var Base64 = Base64 || require('../base64.js').Base64;
7
- var is = function (a, e, m) {
8
- return function () {
9
- assert.equal(a, e, m)
10
- }
11
- };
12
-
13
- describe('Yoshinoya', function () {
14
- it('.encode', is(Base64.encode('𠮷野家'), '8KCut+mHjuWutg=='));
15
- it('.encodeURI', is(Base64.encodeURI('𠮷野家'), '8KCut-mHjuWutg'));
16
- it('.decode', is(Base64.decode('8KCut+mHjuWutg=='), '𠮷野家'));
17
- it('.decode', is(Base64.decode('8KCut-mHjuWutg'), '𠮷野家'));
18
- /* it('.decode', is(Base64.decode('7aGC7b636YeO5a62'), '𠮷野家')); */
19
- });
package/1x1.png DELETED
Binary file
package/base64.html DELETED
@@ -1,47 +0,0 @@
1
- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2
- <!-- $Id: base64.html,v 1.1 2009/03/01 22:00:28 dankogai Exp dankogai $ -->
3
- <html>
4
- <head>
5
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
6
- <title>Demo for base64.js</title>
7
- </head>
8
- <body>
9
- <h1>Demo for base64.js</h1>
10
- <p>$Id: base64.html,v 1.1 2009/03/01 22:00:28 dankogai Exp dankogai $</p>
11
- <table width="640"><tbody>
12
- <tr><th width="50%">Text</th><th>Base64
13
- (URL Safe <input id="encodeURI" type="checkbox" onclick="doit()">)</th></tr>
14
- <tr>
15
- <th><textarea id="srctxt" cols="32" rows="4" onkeyup="doit()">
16
- </textarea></th>
17
- <th><textarea id="base64" cols="32" rows="4" onkeyup="
18
- $('srctxt').value = Base64.decode(this.value);
19
- doit();
20
- if (1 /*@cc_on -1 @*/) $('data').src = 'data:text/plain;base64,' + this.value;
21
- "></textarea></th>
22
- </tr>
23
- <tr><th width="50%">Roundtrip</th><th>iframe w/ data: (no IE)</th></tr>
24
- <tr>
25
- <th><textarea id="roundtrip" cols="32" rows="4" disabled></textarea></th>
26
- <th><iframe id="data" width="80%" height="64"></iframe></th>
27
- </tr>
28
- </tbody></table>
29
-
30
-
31
- <script src="./base64.js"></script>
32
- <script>
33
- $ = function(id){ return document.getElementById(id) };
34
- function doit(){
35
- var encoded = Base64[
36
- 'encode' + ($('encodeURI').checked ? 'URI' : '')
37
- ]($('srctxt').value);
38
- $('base64').value = encoded;
39
- if (1 /*@cc_on -1 @*/) {
40
- $('data').src = 'data:text/plain;base64,'
41
- + Base64.encode(Base64.decode(encoded));
42
- }
43
- $('roundtrip').value = Base64.decode(encoded);
44
- }
45
- </script>
46
- </body>
47
- </html>
package/bower.json DELETED
@@ -1,18 +0,0 @@
1
- {
2
- "name": "js-base64",
3
- "version": "2.6.0",
4
- "license": "BSD-3-Clause",
5
- "main": [
6
- "./base64.js"
7
- ],
8
- "ignore": [
9
- "old",
10
- "test",
11
- ".gitignore",
12
- ".travis.yml",
13
- "base64.html",
14
- "package.json"
15
- ],
16
- "dependencies": {
17
- }
18
- }
package/package.js DELETED
@@ -1,9 +0,0 @@
1
- Package.describe({
2
- summary: "Yet another Base64 transcoder"
3
- })
4
-
5
- Package.on_use(function(api){
6
- api.export('Base64');
7
-
8
- api.add_files(['base64.js'], 'server');
9
- });
package/test/atob.js DELETED
@@ -1,46 +0,0 @@
1
- /*
2
- * use mocha to test me
3
- * http://visionmedia.github.com/mocha/
4
- */
5
- var assert = assert || require("assert");
6
- var Base64 = Base64 || require('../base64.js').Base64;
7
- var is = function (a, e, m) {
8
- return function () {
9
- assert.equal(a, e, m)
10
- }
11
- };
12
-
13
- describe('atob', function () {
14
-
15
- describe('basic', function () {
16
- it('d', is(Base64.btoa('d'), 'ZA=='));
17
- it('da', is(Base64.btoa('da'), 'ZGE='));
18
- it('dan', is(Base64.btoa('dan'), 'ZGFu'));
19
- it('ZA==', is(Base64.atob('ZA=='), 'd' ));
20
- it('ZGE=', is(Base64.atob('ZGE='), 'da' ));
21
- it('ZGFu', is(Base64.atob('ZGFu'), 'dan' ));
22
- });
23
-
24
- describe('whitespace', function () {
25
- it('Z A==', is(Base64.atob('ZA =='), 'd' ));
26
- it('ZG E=', is(Base64.atob('ZG E='), 'da' ));
27
- it('ZGF u', is(Base64.atob('ZGF u'), 'dan' ));
28
- });
29
-
30
- describe('null', function () {
31
- it('\\0', is(Base64.btoa('\0'), 'AA=='));
32
- it('\\0\\0', is(Base64.btoa('\0\0'), 'AAA='));
33
- it('\\0\\0\\0', is(Base64.btoa('\0\0\0'), 'AAAA'));
34
- it('AA==', is(Base64.atob('AA=='), '\0' ));
35
- it('AAA=', is(Base64.atob('AAA='), '\0\0' ));
36
- it('AAAA', is(Base64.atob('AAAA'), '\0\0\0'));
37
- });
38
-
39
- describe('binary', function () {
40
- var pngBase64 = 'iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=';
41
- var pngBinary = '\x89\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52\x00\x00\x00\x01\x00\x00\x00\x01\x08\x04\x00\x00\x00\xb5\x1c\x0c\x02\x00\x00\x00\x0b\x49\x44\x41\x54\x78\xda\x63\x64\x60\x00\x00\x00\x06\x00\x02\x30\x81\xd0\x2f\x00\x00\x00\x00\x49\x45\x4e\x44\xae\x42\x60\x82';
42
- it('.btoa', is(Base64.btoa(pngBinary), pngBase64));
43
- it('.atob', is(Base64.atob(pngBase64), pngBinary));
44
- });
45
-
46
- });
package/test/dankogai.js DELETED
@@ -1,44 +0,0 @@
1
- /*
2
- * $Id: dankogai.js,v 0.4 2012/08/24 05:23:18 dankogai Exp dankogai $
3
- *
4
- * use mocha to test me
5
- * http://visionmedia.github.com/mocha/
6
- */
7
- var assert = assert || require("assert");
8
- var Base64 = Base64 || require('../base64.js').Base64;
9
- var is = function (a, e, m) {
10
- return function () {
11
- assert.equal(a, e, m)
12
- }
13
- };
14
-
15
- describe('basic', function () {
16
- it('d', is(Base64.encode('d'), 'ZA=='));
17
- it('da', is(Base64.encode('da'), 'ZGE='));
18
- it('dan', is(Base64.encode('dan'), 'ZGFu'));
19
- it('ZA==', is(Base64.decode('ZA=='), 'd' ));
20
- it('ZGE=', is(Base64.decode('ZGE='), 'da' ));
21
- it('ZGFu', is(Base64.decode('ZGFu'), 'dan' ));
22
- });
23
-
24
- describe('whitespace', function () {
25
- it('Z A==', is(Base64.decode('ZA =='), 'd' ));
26
- it('ZG E=', is(Base64.decode('ZG E='), 'da' ));
27
- it('ZGF u', is(Base64.decode('ZGF u'), 'dan' ));
28
- });
29
-
30
- describe('null', function () {
31
- it('\\0', is(Base64.encode('\0'), 'AA=='));
32
- it('\\0\\0', is(Base64.encode('\0\0'), 'AAA='));
33
- it('\\0\\0\\0', is(Base64.encode('\0\0\0'), 'AAAA'));
34
- it('AA==', is(Base64.decode('AA=='), '\0' ));
35
- it('AAA=', is(Base64.decode('AAA='), '\0\0' ));
36
- it('AAAA', is(Base64.decode('AAAA'), '\0\0\0'));
37
- });
38
-
39
- describe('Base64', function () {
40
- it('.encode', is(Base64.encode('小飼弾'), '5bCP6aO85by+'));
41
- it('.encodeURI', is(Base64.encodeURI('小飼弾'), '5bCP6aO85by-'));
42
- it('.decode', is(Base64.decode('5bCP6aO85by+'), '小飼弾'));
43
- it('.decode', is(Base64.decode('5bCP6aO85by-'), '小飼弾'));
44
- });
package/test/es5.js DELETED
@@ -1,24 +0,0 @@
1
- /*
2
- * $Id: es5.js,v 0.1 2012/08/23 19:43:17 dankogai Exp dankogai $
3
- *
4
- * use mocha to test me
5
- * http://visionmedia.github.com/mocha/
6
- */
7
- var assert = assert || require("assert");
8
- var Base64 = Base64 || require('../base64.js').Base64;
9
- var is = function (a, e, m) {
10
- return function () {
11
- assert.equal(a, e, m)
12
- }
13
- };
14
-
15
- if ('extendString' in Base64){
16
- Base64.extendString();
17
- describe('String', function () {
18
- it('.toBase64', is('小飼弾'.toBase64(), '5bCP6aO85by+'));
19
- it('.toBase64', is('小飼弾'.toBase64(true), '5bCP6aO85by-'));
20
- it('.toBase64URI', is('小飼弾'.toBase64URI(), '5bCP6aO85by-'));
21
- it('.fromBase64', is('5bCP6aO85by+'.fromBase64(), '小飼弾'));
22
- it('.fromBase64', is('5bCP6aO85by-'.fromBase64(), '小飼弾'));
23
- });
24
- }
package/test/es6.js DELETED
@@ -1,25 +0,0 @@
1
- /*
2
- * $Id: es6.js,v 0.1 2017/11/29 21:43:17 ufolux Exp ufolux $
3
- *
4
- * use mocha to test me
5
- * http://visionmedia.github.com/mocha/
6
- */
7
- import {Base64} from '../base64'
8
-
9
- var assert = assert || require("assert");
10
- var is = function (a, e, m) {
11
- return function () {
12
- assert.equal(a, e, m)
13
- }
14
- };
15
-
16
- if ('extendString' in Base64){
17
- Base64.extendString();
18
- describe('String', function () {
19
- it('.toBase64', is('小飼弾'.toBase64(), '5bCP6aO85by+'));
20
- it('.toBase64', is('小飼弾'.toBase64(true), '5bCP6aO85by-'));
21
- it('.toBase64URI', is('小飼弾'.toBase64URI(), '5bCP6aO85by-'));
22
- it('.fromBase64', is('5bCP6aO85by+'.fromBase64(), '小飼弾'));
23
- it('.fromBase64', is('5bCP6aO85by-'.fromBase64(), '小飼弾'));
24
- });
25
- }
package/test/index.html DELETED
@@ -1,40 +0,0 @@
1
- <html>
2
- <head>
3
- <meta charset="utf-8">
4
- <title>Mocha Tests</title>
5
- <link href="https://cdn.rawgit.com/mochajs/mocha/2.2.5/mocha.css" rel="stylesheet" />
6
- </head>
7
- <body>
8
- <div id="mocha"></div>
9
-
10
- <script src="https://cdn.rawgit.com/jquery/jquery/3.5.1/dist/jquery.min.js"></script>
11
- <script src="https://cdn.rawgit.com/Automattic/expect.js/0.3.1/index.js"></script>
12
- <script src="https://cdn.rawgit.com/mochajs/mocha/2.2.5/mocha.js"></script>
13
- <script>
14
- mocha.setup('bdd');
15
- </script>
16
- <script src="../base64.js"></script>
17
- <script>
18
- var assert = function(expr, msg) {
19
- if (!expr) throw new Error(msg || 'failed');
20
- };
21
- assert.equal = function(a, b, msg) {
22
- if (a !== b) throw new Error(msg || ('failed : '+a+','+b));
23
- };
24
- </script>
25
- <script src="./dankogai.js"></script>
26
- <script src="./es5.js"></script>
27
- <script src="./large.js"></script>
28
- <script src="./yoshinoya.js"></script>
29
- <script src="./atob.js"></script>
30
- <script>
31
- $(function() {
32
- mocha.run();
33
- });
34
- </script>
35
- </head>
36
- <body>
37
- $Id: index.html,v 0.3 2017/09/11 08:43:43 dankogai Exp dankogai $
38
- <div id="mocha"></div>
39
- </body>
40
- </html>
package/test/large.js DELETED
@@ -1,25 +0,0 @@
1
- /*
2
- * $Id: large.js,v 0.3 2012/08/23 19:14:37 dankogai Exp dankogai $
3
- *
4
- * use mocha to test me
5
- * http://visionmedia.github.com/mocha/
6
- */
7
- var assert = assert || require("assert");
8
- var Base64 = Base64 || require('../base64.js').Base64;
9
- var is = function (a, e, m) {
10
- return function () {
11
- assert.equal(a, e, m)
12
- }
13
- };
14
- var seed = function () {
15
- var a, i;
16
- for (a = [], i = 0; i < 256; i++) {
17
- a.push(String.fromCharCode(i));
18
- }
19
- return a.join('');
20
- }();
21
- describe('Base64', function () {
22
- for (var i = 0, str = seed; i < 16; str += str, i++) {
23
- it(''+str.length, is(Base64.decode(Base64.encode(str)), str));
24
- }
25
- });
package/test/yoshinoya.js DELETED
@@ -1,19 +0,0 @@
1
- /*
2
- * use mocha to test me
3
- * http://visionmedia.github.com/mocha/
4
- */
5
- var assert = assert || require("assert");
6
- var Base64 = Base64 || require('../base64.js').Base64;
7
- var is = function (a, e, m) {
8
- return function () {
9
- assert.equal(a, e, m)
10
- }
11
- };
12
-
13
- describe('Yoshinoya', function () {
14
- it('.encode', is(Base64.encode('𠮷野家'), '8KCut+mHjuWutg=='));
15
- it('.encodeURI', is(Base64.encodeURI('𠮷野家'), '8KCut-mHjuWutg'));
16
- it('.decode', is(Base64.decode('8KCut+mHjuWutg=='), '𠮷野家'));
17
- it('.decode', is(Base64.decode('8KCut-mHjuWutg'), '𠮷野家'));
18
- /* it('.decode', is(Base64.decode('7aGC7b636YeO5a62'), '𠮷野家')); */
19
- });