mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 02:35:49 +00:00
chore: lint
This commit is contained in:
parent
13279299c4
commit
24dcf78be8
16 changed files with 25 additions and 26 deletions
|
|
@ -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');
|
||||
|
|
|
|||
|
|
@ -249,7 +249,7 @@ function updateField(file) {
|
|||
function getAttribute(type) {
|
||||
if (type === 'directory')
|
||||
return '';
|
||||
|
||||
|
||||
return 'target="_blank" ';
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ module.exports = (date) => {
|
|||
const addZero = (a) => {
|
||||
if (a > 9)
|
||||
return a;
|
||||
|
||||
|
||||
return `0${a}`;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -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) => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue