chore: lint

This commit is contained in:
coderaiser 2023-08-07 17:40:25 +03:00
parent 13279299c4
commit 24dcf78be8
16 changed files with 25 additions and 26 deletions

View file

@ -3,7 +3,7 @@
module.exports.btoa = (str) => {
if (typeof btoa === 'function')
return btoa(str);
return Buffer
.from(str)
.toString('base64');
@ -12,7 +12,7 @@ module.exports.btoa = (str) => {
module.exports.atob = (str) => {
if (typeof atob === 'function')
return atob(str);
return Buffer
.from(str, 'base64')
.toString('binary');

View file

@ -249,7 +249,7 @@ function updateField(file) {
function getAttribute(type) {
if (type === 'directory')
return '';
return 'target="_blank" ';
}

View file

@ -15,7 +15,7 @@ module.exports = (date) => {
const addZero = (a) => {
if (a > 9)
return a;
return `0${a}`;
};

View file

@ -1,9 +1,10 @@
'use strict';
const exec = require('execon');
const isString = (a) => typeof a === 'string';
module.exports.escapeRegExp = (str) => {
const isStr = typeof str === 'string';
const isStr = isString(str);
if (isStr)
str = str.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&');
@ -33,7 +34,7 @@ module.exports.exec = exec;
* @return ext
*/
module.exports.getExt = (name) => {
const isStr = typeof name === 'string';
const isStr = isString(name);
if (!isStr)
return '';
@ -58,7 +59,7 @@ module.exports.findObjByNameInArr = (array, name) => {
if (!Array.isArray(array))
throw Error('array should be array!');
if (typeof name !== 'string')
if (!isString(name))
throw Error('name should be string!');
array.some((item) => {