Skip to content

Commit

Permalink
CHORE remove old
Browse files Browse the repository at this point in the history
  • Loading branch information
justnewbee committed Dec 2, 2020
1 parent 432d80a commit 51b5586
Show file tree
Hide file tree
Showing 3,244 changed files with 41,519 additions and 53,535 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
3 changes: 0 additions & 3 deletions .eslintignore

This file was deleted.

27 changes: 0 additions & 27 deletions .eslintrc.js

This file was deleted.

24 changes: 0 additions & 24 deletions .gitignore

This file was deleted.

1 change: 0 additions & 1 deletion .npmrc

This file was deleted.

5 changes: 0 additions & 5 deletions .prettierrc.js

This file was deleted.

21 changes: 0 additions & 21 deletions LICENSE

This file was deleted.

10 changes: 0 additions & 10 deletions README.md

This file was deleted.

35 changes: 0 additions & 35 deletions babel.config.js

This file was deleted.

3 changes: 0 additions & 3 deletions jest.config.js

This file was deleted.

11 changes: 0 additions & 11 deletions lerna.json

This file was deleted.

33 changes: 0 additions & 33 deletions package.json

This file was deleted.

30 changes: 30 additions & 0 deletions packages/base64/build/cjs/const/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
"use strict";

Object.defineProperty(exports, "__esModule", {
value: true
});
exports.REG_BTOU = exports.REG_UTOB = exports.REG_BTOA = exports.REG_ATOB = exports.B64TAB = exports.CHARS = void 0;
var CHARS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
exports.CHARS = CHARS;

var B64TAB = function (bin) {
var t = {};
var l = bin.length;

for (var i = 0; i < l; i++) {
t[bin.charAt(i)] = i;
}

return t;
}(CHARS);

exports.B64TAB = B64TAB;
var REG_ATOB = /[\s\S]{1,4}/g;
exports.REG_ATOB = REG_ATOB;
var REG_BTOA = /[\s\S]{1,3}/g;
exports.REG_BTOA = REG_BTOA;
var REG_UTOB = /[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g; // eslint-disable-line no-control-regex

exports.REG_UTOB = REG_UTOB;
var REG_BTOU = new RegExp(['[\xC0-\xDF][\x80-\xBF]', '[\xE0-\xEF][\x80-\xBF]{2}', '[\xF0-\xF7][\x80-\xBF]{3}'].join('|'), 'g');
exports.REG_BTOU = REG_BTOU;
23 changes: 23 additions & 0 deletions packages/base64/build/cjs/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");

Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "encode", {
enumerable: true,
get: function get() {
return _encode.default;
}
});
Object.defineProperty(exports, "decode", {
enumerable: true,
get: function get() {
return _decode.default;
}
});

var _encode = _interopRequireDefault(require("./util/encode"));

var _decode = _interopRequireDefault(require("./util/decode"));
43 changes: 43 additions & 0 deletions packages/base64/build/cjs/util/atob.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
"use strict";

Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;

var _const = require("../const");

/* eslint-disable no-bitwise */
var fromCharCode = String.fromCharCode;
/**
* window 自带的 atob 和 btoa https://developer.mozilla.org/en-US/docs/Web/API/WindowBase64/Base64_encoding_and_decoding
*
* - atob base64 解码
* - btoa base64 编码
*
* 注意:
*
* - 不支持 unicode,`btoa/atob` 对汉字(或汉字标点)等会报错
* + FF → DOMException: String contains an invalid character
* + CH → DOMException: Failed to execute 'atob' on 'Window': The string to be decoded contains characters outside of the Latin1 range.
* + SF → InvalidCharacterError: The string contains invalid characters.
* - 这两个方法有些奇怪,可以把它从 window 上脱离出来调用,但不能把它挂到某对象下面调用,否则会报错
* + FF → TypeError: 'atob' called on an object that does not implement interface Window
* + CH → TypeError: Illegal invocation
* + SF → TypeError: Can only call Window.btoa on instances of Window
*/

function atobPolyfill(a) {
return a.replace(_const.REG_ATOB, function (cccc) {
var len = cccc.length;
var padLen = len % 4;
var n = (len > 0 ? _const.B64TAB[cccc.charAt(0)] << 18 : 0) | (len > 1 ? _const.B64TAB[cccc.charAt(1)] << 12 : 0) | (len > 2 ? _const.B64TAB[cccc.charAt(2)] << 6 : 0) | (len > 3 ? _const.B64TAB[cccc.charAt(3)] : 0);
var chars = [fromCharCode(n >>> 16), fromCharCode(n >>> 8 & 0xff), fromCharCode(n & 0xff)];
chars.length -= [0, 0, 2, 1][padLen];
return chars.join('');
});
}

var _default = typeof window !== 'undefined' && window.atob ? window.atob : atobPolyfill;

exports.default = _default;
21 changes: 21 additions & 0 deletions packages/base64/build/cjs/util/btoa.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
"use strict";

Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;

var _const = require("../const");

/* eslint-disable no-bitwise */
function btoaPolyfill(b) {
return b.replace(_const.REG_BTOA, function (ccc) {
var padLen = [0, 2, 1][ccc.length % 3];
var ord = ccc.charCodeAt(0) << 16 | (ccc.length > 1 ? ccc.charCodeAt(1) : 0) << 8 | (ccc.length > 2 ? ccc.charCodeAt(2) : 0);
return [_const.CHARS.charAt(ord >>> 18), _const.CHARS.charAt(ord >>> 12 & 63), padLen >= 2 ? '=' : _const.CHARS.charAt(ord >>> 6 & 63), padLen >= 1 ? '=' : _const.CHARS.charAt(ord & 63)].join('');
});
}

var _default = typeof window !== 'undefined' && window.btoa ? window.btoa : btoaPolyfill;

exports.default = _default;
33 changes: 33 additions & 0 deletions packages/base64/build/cjs/util/btou.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
"use strict";

Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = btou;

var _const = require("../const");

/* eslint-disable no-bitwise */
var fromCharCode = String.fromCharCode;
/**
* unicode 版编码
*/

function btou(b) {
return b.replace(_const.REG_BTOU, function (cccc) {
switch (cccc.length) {
case 4:
{
var cp = (0x07 & cccc.charCodeAt(0)) << 18 | (0x3f & cccc.charCodeAt(1)) << 12 | (0x3f & cccc.charCodeAt(2)) << 6 | 0x3f & cccc.charCodeAt(3);
var offset = cp - 0x10000;
return fromCharCode((offset >>> 10) + 0xD800) + fromCharCode((offset & 0x3FF) + 0xDC00);
}

case 3:
return fromCharCode((0x0f & cccc.charCodeAt(0)) << 12 | (0x3f & cccc.charCodeAt(1)) << 6 | 0x3f & cccc.charCodeAt(2));

default:
return fromCharCode((0x1f & cccc.charCodeAt(0)) << 6 | 0x3f & cccc.charCodeAt(1));
}
});
}
26 changes: 26 additions & 0 deletions packages/base64/build/cjs/util/decode.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");

Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = decode;

var _atob = _interopRequireDefault(require("./atob"));

var _btou = _interopRequireDefault(require("./btou"));

function _decode(a) {
return (0, _btou.default)((0, _atob.default)(a));
}
/**
* 支持 unicode 的 base64 解码
*/


function decode(str) {
return _decode(String(str).replace(/[-_]/g, function (m0) {
return m0 === '-' ? '+' : '/';
}).replace(/[^A-Za-z0-9+/]/g, ''));
}
Loading

0 comments on commit 51b5586

Please sign in to comment.