ethers.js/packages/base64/lib/browser.js

22 lines
632 B
JavaScript
Raw Normal View History

2019-05-15 01:48:48 +03:00
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var bytes_1 = require("@ethersproject/bytes");
function decode(textData) {
textData = atob(textData);
var data = [];
for (var i = 0; i < textData.length; i++) {
data.push(textData.charCodeAt(i));
}
return bytes_1.arrayify(data);
}
exports.decode = decode;
function encode(data) {
data = bytes_1.arrayify(data);
var textData = "";
for (var i = 0; i < data.length; i++) {
textData += String.fromCharCode(data[i]);
}
return btoa(textData);
}
exports.encode = encode;
2020-07-13 15:03:56 +03:00
//# sourceMappingURL=browser.js.map