@augment-vir/common
Advanced tools
Comparing version 23.4.0 to 24.0.0
@@ -55,5 +55,5 @@ "use strict"; | ||
exports.ensureErrorAndPrependMessage = ensureErrorAndPrependMessage; | ||
function wrapInTry(inputs) { | ||
function wrapInTry(callback, inputs) { | ||
try { | ||
const returnValue = inputs.callback(); | ||
const returnValue = callback(); | ||
if (returnValue instanceof Promise) { | ||
@@ -60,0 +60,0 @@ return returnValue.catch((error) => { |
@@ -54,3 +54,2 @@ "use strict"; | ||
__exportStar(require("./augments/string/suffixes"), exports); | ||
__exportStar(require("./augments/string/url"), exports); | ||
__exportStar(require("./augments/string/uuid"), exports); | ||
@@ -57,0 +56,0 @@ __exportStar(require("./augments/time"), exports); |
@@ -47,5 +47,5 @@ import { isTruthy } from './boolean'; | ||
} | ||
export function wrapInTry(inputs) { | ||
export function wrapInTry(callback, inputs) { | ||
try { | ||
const returnValue = inputs.callback(); | ||
const returnValue = callback(); | ||
if (returnValue instanceof Promise) { | ||
@@ -52,0 +52,0 @@ return returnValue.catch((error) => { |
@@ -38,3 +38,2 @@ export * from './augments/ansi'; | ||
export * from './augments/string/suffixes'; | ||
export * from './augments/string/url'; | ||
export * from './augments/string/uuid'; | ||
@@ -41,0 +40,0 @@ export * from './augments/time'; |
@@ -12,10 +12,8 @@ import { RequireExactlyOne } from 'type-fest'; | ||
export declare function ensureErrorAndPrependMessage(maybeError: unknown, prependMessage: string): Error; | ||
export type TryWrapInputs<CallbackReturn, FallbackReturn> = { | ||
callback: () => CallbackReturn; | ||
} & RequireExactlyOne<{ | ||
export type TryWrapConfig<FallbackReturn> = RequireExactlyOne<{ | ||
fallbackValue: FallbackReturn; | ||
catchCallback: (error: unknown) => FallbackReturn; | ||
}>; | ||
export declare function wrapInTry<CallbackReturn, FallbackReturn>(inputs: TryWrapInputs<CallbackReturn, FallbackReturn>): FallbackReturn | CallbackReturn; | ||
export declare function wrapInTry<CallbackReturn, FallbackReturn>(callback: () => CallbackReturn, inputs: TryWrapConfig<FallbackReturn>): FallbackReturn | CallbackReturn; | ||
export declare function executeAndReturnError<CallbackGeneric extends NoInputsFunction<PromiseLike<any>>>(callback: CallbackGeneric): Promise<Error | Awaited<ReturnType<CallbackGeneric>>>; | ||
export declare function executeAndReturnError<CallbackGeneric extends NoInputsFunction>(callback: CallbackGeneric): Error | ReturnType<CallbackGeneric>; |
@@ -38,3 +38,2 @@ export * from './augments/ansi'; | ||
export * from './augments/string/suffixes'; | ||
export * from './augments/string/url'; | ||
export * from './augments/string/uuid'; | ||
@@ -41,0 +40,0 @@ export * from './augments/time'; |
{ | ||
"name": "@augment-vir/common", | ||
"version": "23.4.0", | ||
"version": "24.0.0", | ||
"homepage": "https://github.com/electrovir/augment-vir/tree/main/packages/common", | ||
@@ -29,3 +29,3 @@ "bugs": { | ||
"run-time-assertions": "^1.0.0", | ||
"type-fest": "^4.10.2" | ||
"type-fest": "^4.12.0" | ||
}, | ||
@@ -32,0 +32,0 @@ "devDependencies": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
183964
131
4449
Updatedtype-fest@^4.12.0