fp-toolkit
Advanced tools
Comparing version 1.2.3 to 1.3.0
@@ -5,2 +5,9 @@ # Changelog | ||
## [1.3.0](https://github.com/fp-toolkit/fp-toolkit/compare/v1.2.3...v1.3.0) (2023-03-30) | ||
### Features | ||
* **AsyncResult:** add tee and teeErr fns ([3309d63](https://github.com/fp-toolkit/fp-toolkit/commit/3309d635eecb5b4b8d84e4114a1adcf8276c950d)) | ||
### [1.2.3](https://github.com/fp-toolkit/fp-toolkit/compare/v1.2.2...v1.2.3) (2023-03-28) | ||
@@ -7,0 +14,0 @@ |
@@ -22,3 +22,3 @@ { | ||
], | ||
"version": "1.2.3", | ||
"version": "1.3.0", | ||
"main": "./src/index.ts", | ||
@@ -25,0 +25,0 @@ "scripts": { |
@@ -302,2 +302,36 @@ /** | ||
/** | ||
* Execute an arbitrary side-effect on the inner `Ok` value of an `AsyncResult` | ||
* within a pipeline of functions. Useful for logging and debugging. Passes | ||
* the inner value through unchanged. Sometimes referred to as `do` or `tap`. | ||
* | ||
* The side-effect will be invoked once the underlying `Promise` has resolved. | ||
* | ||
* @param f The side-effect to execute. Should not mutate its arguments. | ||
* @returns The `AsyncResult`, unchanged. | ||
* | ||
* @group Utils | ||
*/ | ||
export const tee = | ||
<A>(f: (a: A) => void) => | ||
<E>(async: AsyncResult<A, E>): AsyncResult<A, E> => | ||
Async.tee<Result<A, E>>(Result.tee(f))(async) | ||
/** | ||
* Execute an arbitrary side-effect on the inner `Err` value of an `AsyncResult` | ||
* within a pipeline of functions. Useful for logging and debugging. Passes | ||
* the inner value through unchanged. Sometimes referred to as `do` or `tap`. | ||
* | ||
* The side-effect will be invoked once the underlying `Promise` has resolved. | ||
* | ||
* @param f The side-effect to execute. Should not mutate its arguments. | ||
* @returns The `AsyncResult`, unchanged. | ||
* | ||
* @group Utils | ||
*/ | ||
export const teeErr = | ||
<E>(f: (a: E) => void) => | ||
<A>(async: AsyncResult<A, E>): AsyncResult<A, E> => | ||
Async.tee<Result<A, E>>(Result.teeErr(f))(async) | ||
/* c8 ignore start */ | ||
@@ -320,3 +354,5 @@ /** @ignore */ | ||
start, | ||
tee, | ||
teeErr, | ||
} | ||
/* c8 ignore end */ |
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
198230
5608