formacao
This commit is contained in:
+3
-12
@@ -9,12 +9,7 @@ export const makeCommand = (syncFile, asyncFile, syncNoFile, asyncNoFile, valida
|
||||
cb = entries;
|
||||
entries = undefined;
|
||||
}
|
||||
if (!entries) {
|
||||
entries = [];
|
||||
}
|
||||
else {
|
||||
entries = Array.from(entries);
|
||||
}
|
||||
entries = !entries ? [] : Array.from(entries);
|
||||
const opt = dealias(opt_);
|
||||
validate?.(opt, entries);
|
||||
if (isSyncFile(opt)) {
|
||||
@@ -25,9 +20,7 @@ export const makeCommand = (syncFile, asyncFile, syncNoFile, asyncNoFile, valida
|
||||
}
|
||||
else if (isAsyncFile(opt)) {
|
||||
const p = asyncFile(opt, entries);
|
||||
// weirdness to make TS happy
|
||||
const c = cb ? cb : undefined;
|
||||
return c ? p.then(() => c(), c) : p;
|
||||
return cb ? p.then(() => cb(), cb) : p;
|
||||
}
|
||||
else if (isSyncNoFile(opt)) {
|
||||
if (typeof cb === 'function') {
|
||||
@@ -42,9 +35,7 @@ export const makeCommand = (syncFile, asyncFile, syncNoFile, asyncNoFile, valida
|
||||
return asyncNoFile(opt, entries);
|
||||
/* c8 ignore start */
|
||||
}
|
||||
else {
|
||||
throw new Error('impossible options??');
|
||||
}
|
||||
throw new Error('impossible options??');
|
||||
/* c8 ignore stop */
|
||||
}, {
|
||||
syncFile,
|
||||
|
||||
Reference in New Issue
Block a user