This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export function b64toBlob(data, contentType = '', sliceSize = 512) { | |
const byteCharacters = atob(data) | |
const byteArrays = [] | |
for (let offset = 0; offset < byteCharacters.length; offset += sliceSize) { | |
const slice = byteCharacters.slice(offset, offset + sliceSize) | |
const byteNumbers = new Array(slice.length) | |
for (let i = 0; i < slice.length; i++) { | |
byteNumbers[i] = slice.charCodeAt(i) | |
} | |
const byteArray = new Uint8Array(byteNumbers) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"name": { | |
"en": { | |
"official": "Republic of Albania", | |
"common": "Albania" | |
}, | |
"zh": { | |
"official": "阿尔巴尼亚共和国", | |
"common": "阿尔巴尼亚" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"name": { | |
"en": { | |
"official": "Republic of Albania", | |
"common": "Albania" | |
}, | |
"zh": { | |
"official": "阿尔巴尼亚共和国", | |
"common": "阿尔巴尼亚" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function titleCase(str) { | |
str = str.toLowerCase() | |
return str.charAt(0).toUpperCase() + str.slice(1) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<link rel="icon" type="image/png" href="./src/favicon.png"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export function numberWithCommas(num) { | |
return num.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',') | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function parseTime(time, format = 'y-m-d h:i:s') { | |
if (!time) { | |
return '0000-00-00 00:00:00' | |
} | |
const date = time instanceof Date ? time : new Date(parseInt(time, 10)) | |
const formatObj = { | |
y: date.getFullYear(), | |
m: date.getMonth() + 1, |
NewerOlder