mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-07-19 17:35:34 +00:00
chore(validate) es2015-ify
This commit is contained in:
parent
a4b2e18052
commit
807813ecdb
1 changed files with 15 additions and 15 deletions
|
|
@ -1,38 +1,38 @@
|
|||
'use strict';
|
||||
|
||||
var exit = require('./exit');
|
||||
const exit = require('./exit');
|
||||
|
||||
module.exports.root = root;
|
||||
module.exports.editor = editor;
|
||||
module.exports.packer = packer;
|
||||
|
||||
function root(dir, fn) {
|
||||
var fs;
|
||||
|
||||
if (typeof dir !== 'string')
|
||||
throw Error('dir should be a string');
|
||||
|
||||
if (dir !== '/') {
|
||||
fs = require('fs');
|
||||
fs.stat(dir, function(error) {
|
||||
if (error)
|
||||
return exit('cloudcmd --root: %s', error.message);
|
||||
|
||||
if (typeof fn === 'function')
|
||||
fn('root:', dir);
|
||||
});
|
||||
}
|
||||
if (dir === '/')
|
||||
return;
|
||||
|
||||
const fs = require('fs');
|
||||
|
||||
fs.stat(dir, (error) => {
|
||||
if (error)
|
||||
return exit('cloudcmd --root: %s', error.message);
|
||||
|
||||
if (typeof fn === 'function')
|
||||
fn('root:', dir);
|
||||
});
|
||||
}
|
||||
|
||||
function editor(name) {
|
||||
var reg = /^(dword|edward|deepword)$/;
|
||||
const reg = /^(dword|edward|deepword)$/;
|
||||
|
||||
if (!reg.test(name))
|
||||
exit('cloudcmd --editor: could be "dword", "edward" or "deepword" only');
|
||||
}
|
||||
|
||||
function packer(name) {
|
||||
var reg = /^(tar|zip)$/;
|
||||
const reg = /^(tar|zip)$/;
|
||||
|
||||
if (!reg.test(name))
|
||||
exit('cloudcmd --packer: could be "tar" or "zip" only');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue