refactoring

This commit is contained in:
Dobromir Popov
2024-05-06 21:24:24 +03:00
parent 92a745b581
commit 145e71834d

View File

@ -913,15 +913,17 @@ function adjustDateForDST(date, timezone) {
exports.adjustDateForDST = adjustDateForDST;
export function base64ToUint8Array(base64) {
const padding = '='.repeat((4 - (base64.length % 4)) % 4);
const b64 = (base64 + padding).replace(/-/g, '+').replace(/_/g, '/');
const rawData = window.atob(b64);
const outputArray = new Uint8Array(rawData.length);
exports.base64ToUint8Array = function (base64String) {
const padding = '='.repeat((4 - base64String.length % 4) % 4);
const base64 = (base64String + padding)
.replace(/-/g, '+')
.replace(/_/g, '/');
const rawData = atob(base64);
const buffer = new Uint8Array(rawData.length);
for (let i = 0; i < rawData.length; ++i) {
outputArray[i] = rawData.charCodeAt(i);
buffer[i] = rawData.charCodeAt(i);
}
return outputArray;
return buffer;
}
// exports.getInitials = function (names) {
// const parts = names.split(' '); // Split the full name into parts