mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-07-18 00:47:01 +00:00
refactor(cloudcmd) defaultValue
This commit is contained in:
parent
8548c72d22
commit
a127ac9b53
1 changed files with 6 additions and 6 deletions
|
|
@ -82,11 +82,8 @@ module.exports = (params) => {
|
|||
config(name, value);
|
||||
});
|
||||
|
||||
const console = config('console');
|
||||
const configDialog = config('configDialog');
|
||||
|
||||
config('console', defaultValue(options.console, console));
|
||||
config('configDialog', defaultValue(options.configDialog, configDialog));
|
||||
config('console', defaultValue('console', options));
|
||||
config('configDialog', defaultValue('configDialog', options));
|
||||
|
||||
if (p.socket)
|
||||
listen(prefix, p.socket);
|
||||
|
|
@ -94,7 +91,10 @@ module.exports = (params) => {
|
|||
return cloudcmd(prefix, plugins, modules);
|
||||
};
|
||||
|
||||
function defaultValue(value, previous) {
|
||||
function defaultValue(name, options) {
|
||||
const value = options[name];
|
||||
const previous = config(name);
|
||||
|
||||
if (typeof value === 'undefined')
|
||||
return previous;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue