mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-22 18:29:26 +00:00
chore: server: lint
This commit is contained in:
parent
d55b6fb393
commit
20a00481d6
4 changed files with 16 additions and 14 deletions
|
|
@ -1,5 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
const isString = (a) => typeof a === 'string';
|
||||
const {join} = require('path');
|
||||
const {callbackify} = require('util');
|
||||
|
||||
|
|
@ -56,7 +57,7 @@ async function onPUT(request) {
|
|||
}
|
||||
|
||||
function check(name, request) {
|
||||
if (typeof name !== 'string')
|
||||
if (!isString(name))
|
||||
throw Error('name should be string!');
|
||||
|
||||
if (!request)
|
||||
|
|
|
|||
|
|
@ -1,7 +1,9 @@
|
|||
'use strict';
|
||||
|
||||
const isString = (a) => typeof a === 'string';
|
||||
|
||||
module.exports = (value) => {
|
||||
if (typeof value !== 'string')
|
||||
if (!isString(value))
|
||||
return '';
|
||||
|
||||
if (value.length === 1)
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
'use strict';
|
||||
|
||||
const isFn = (a) => typeof a === 'function';
|
||||
const isString = (a) => typeof a === 'string';
|
||||
const DIR = '../';
|
||||
const DIR_COMMON = `${DIR}../common/`;
|
||||
|
||||
|
|
@ -148,7 +150,7 @@ function onGET(params, config, callback) {
|
|||
function getPackReg(packer) {
|
||||
if (packer === 'zip')
|
||||
return /\.zip$/;
|
||||
|
||||
|
||||
return /\.tar\.gz$/;
|
||||
}
|
||||
|
||||
|
|
@ -167,14 +169,11 @@ function streamPack(cmd, response, packer) {
|
|||
function getCMD(cmd) {
|
||||
if (cmd[0] === '/')
|
||||
return cmd.slice(1);
|
||||
|
||||
|
||||
return cmd;
|
||||
}
|
||||
|
||||
const getMoveMsg = (names) => {
|
||||
const msg = formatMsg('move', names);
|
||||
return msg;
|
||||
};
|
||||
const getMoveMsg = (names) => formatMsg('move', names);
|
||||
|
||||
const getRenameMsg = (from, to) => {
|
||||
const msg = formatMsg('rename', {
|
||||
|
|
@ -376,9 +375,8 @@ module.exports._getWin32RootMsg = getWin32RootMsg;
|
|||
|
||||
function getWin32RootMsg() {
|
||||
const message = 'Could not copy from/to root on windows!';
|
||||
const error = Error(message);
|
||||
|
||||
return error;
|
||||
return Error(message);
|
||||
}
|
||||
|
||||
function parseData(data) {
|
||||
|
|
@ -398,12 +396,12 @@ function formatMsg(msg, data, status) {
|
|||
}
|
||||
|
||||
function checkPut(name, body, callback) {
|
||||
if (typeof name !== 'string')
|
||||
if (!isString(name))
|
||||
throw Error('name should be a string!');
|
||||
|
||||
if (typeof body !== 'string')
|
||||
if (!isString(body))
|
||||
throw Error('body should be a string!');
|
||||
|
||||
if (typeof callback !== 'function')
|
||||
if (!isFn(callback))
|
||||
throw Error('callback should be a function!');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,12 +1,13 @@
|
|||
'use strict';
|
||||
|
||||
const isString = (a) => typeof a === 'string';
|
||||
const tryCatch = require('try-catch');
|
||||
|
||||
const exit = require('./exit');
|
||||
const columns = require('./columns');
|
||||
|
||||
module.exports.root = (dir, config) => {
|
||||
if (typeof dir !== 'string')
|
||||
if (!isString(dir))
|
||||
throw Error('dir should be a string');
|
||||
|
||||
if (dir === '/')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue