diff options
Diffstat (limited to 'node_modules/yargs/build/lib/utils/maybe-async-result.js')
-rw-r--r-- | node_modules/yargs/build/lib/utils/maybe-async-result.js | 17 |
1 files changed, 0 insertions, 17 deletions
diff --git a/node_modules/yargs/build/lib/utils/maybe-async-result.js b/node_modules/yargs/build/lib/utils/maybe-async-result.js deleted file mode 100644 index 8c6a40c..0000000 --- a/node_modules/yargs/build/lib/utils/maybe-async-result.js +++ /dev/null @@ -1,17 +0,0 @@ -import { isPromise } from './is-promise.js'; -export function maybeAsyncResult(getResult, resultHandler, errorHandler = (err) => { - throw err; -}) { - try { - const result = isFunction(getResult) ? getResult() : getResult; - return isPromise(result) - ? result.then((result) => resultHandler(result)) - : resultHandler(result); - } - catch (err) { - return errorHandler(err); - } -} -function isFunction(arg) { - return typeof arg === 'function'; -} |