maintain (eslint): linting on frontend

This commit is contained in:
Mickael Kerjean
2021-12-21 01:32:37 +11:00
parent 48a6763380
commit 5156432b52
62 changed files with 1920 additions and 1655 deletions

View File

@ -1,13 +1,16 @@
export function leftPad(str, length, pad = "0"){
if(typeof str !== 'string' || typeof pad !== 'string' || str.length >= length || !pad.length > 0) return str;
export function leftPad(str, length, pad = "0") {
if (typeof str !== "string" || typeof pad !== "string" || str.length >= length ||
!pad.length > 0) {
return str;
}
return leftPad(pad + str, length, pad);
}
export function copyToClipboard (str){
if(!str) return
let $input = document.createElement("input");
export function copyToClipboard(str) {
if (!str) return;
const $input = document.createElement("input");
$input.setAttribute("type", "text");
$input.setAttribute("style", "position: absolute; top:0;left:0;background:red")
$input.setAttribute("style", "position: absolute; top:0;left:0;background:red");
$input.setAttribute("display", "none");
document.body.appendChild($input);
$input.value = str;
@ -16,11 +19,11 @@ export function copyToClipboard (str){
$input.remove();
}
export function format(str = ""){
if(str.length === 0) return str;
export function format(str = "") {
if (str.length === 0) return str;
return str.split("_")
.map((word, index) => {
if(index != 0) return word;
if (index != 0) return word;
return word[0].toUpperCase() + word.substring(1);
})
.join(" ");