try-typescript
Advanced tools
Comparing version
@@ -24,3 +24,3 @@ export declare class Try<T> { | ||
mapFailure<E extends Error, N extends Error>(errorType: new (...args: any[]) => E, newErrorType: new (...args: any[]) => N, ...args: any[]): Try<T>; | ||
mapFailureWith<E extends Error, N extends Error>(errorType: new (...args: any[]) => E, fn: (error: E) => N): Try<T>; | ||
mapFailureWith<E extends Error, N extends Error>(errorType: new (...args: any[]) => E, fn: (error: E) => N | Promise<N>): Try<T>; | ||
filter(predicateFunc: (value: T) => boolean | Promise<boolean>, throwbackFunction?: (value: T) => void): Try<T>; | ||
@@ -27,0 +27,0 @@ filterNot(predicateFunc: (value: T) => boolean | Promise<boolean>, throwbackFunction?: (value: T) => void): Try<T>; |
@@ -148,3 +148,3 @@ "use strict"; | ||
if (this.internalError instanceof executionElement.functionData.errorType) { | ||
this.internalError = executionElement.functionData.func(this.internalError); | ||
this.internalError = yield executionElement.functionData.func(this.internalError); | ||
} | ||
@@ -151,0 +151,0 @@ } |
{ | ||
"name": "try-typescript", | ||
"version": "0.6.0", | ||
"version": "0.6.1", | ||
"description": "This repository implements a Try class inspired by the Vavr library in Java. The Try class is a functional programming construct for handling computations that may succeed or fail. It encapsulates exceptions and streamlines error handling, reducing boilerplate code and enhancing code readability. ", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -258,3 +258,3 @@ # Try-Typescript | ||
### `mapFailureWith<E extends Error, N extends Error>(errorType: new (...args: any[]) => E, fn: (error: E) => N): Try<T>` | ||
### `mapFailureWith<E extends Error, N extends Error>(errorType: new (...args: any[]) => E, fn: (error: E) => N | Promise<N>): Try<T>` | ||
Maps a failure of the Try instance using a function provided with the previous error if it is a Failure, otherwise returns the Success instance. | ||
@@ -261,0 +261,0 @@ ```typescript |
46901
0.07%