From 8eff962cab608341a6f2fedc640a0e32d96f26e2 Mon Sep 17 00:00:00 2001 From: altaf-creator Date: Sun, 9 Nov 2025 11:15:19 +0800 Subject: pain --- .../yargs/build/lib/utils/maybe-async-result.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 frontend-old/node_modules/yargs/build/lib/utils/maybe-async-result.js (limited to 'frontend-old/node_modules/yargs/build/lib/utils/maybe-async-result.js') diff --git a/frontend-old/node_modules/yargs/build/lib/utils/maybe-async-result.js b/frontend-old/node_modules/yargs/build/lib/utils/maybe-async-result.js new file mode 100644 index 0000000..8c6a40c --- /dev/null +++ b/frontend-old/node_modules/yargs/build/lib/utils/maybe-async-result.js @@ -0,0 +1,17 @@ +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'; +} -- cgit v1.2.3