Releases: seangwright/typescript-functional-extensions
v2.0.0 - Expand fetch helpers, new Result methods
What's Changed
- Feature: Improve API helpers and error handling callbacks by @seangwright in #18
- Feature: Result.tapEither/Async by @seangwright in #19
- feat(api): add bindFailure & bindFailureAsync by @GregOnNet in #22
fetchResponse
fetchResponse
now returns the Response
instead of Unit
, giving the consumer more context to inform their next steps. This is a breaking change.
The error handlers for fetchResponse
and fetchJsonResponse
can now return Promise
s. This can be helpful if, for example, an API request returns a 400 response with a JSON body that needs to be unwrapped with response.json()
.
tapEither
Result.tapEither
, Result.tapEitherAsync
, and ResultAsync.tapEither
can all be used to perform a side effect action independent of the result succeeding or failing. This can be useful if, for example, the state of a component (ex: isLoading
) should be toggled when the result of an operation completes - either in a success or failure scenario.
bindFailure
Result.bindFailure
, Result.bindFailureAsync
, and ResultAsync.bindFailure
can be used to convert a failed result to another result. This covers the combination of bind
and mapFailure
.
Full Changelog: v1.4.0...v2.0.0
v1.4.0 - Native ESM support 🧘🏽♀️, Vitest, and Utility Functions
What's Changed
- Feature: Better docs and utility functions by @seangwright in #12
- Feature: Native ES Module support & Vitest by @seangwright in #15
You can now use typescript-functional-extensions
directly from Unpkg as mentioned in the README
Docs have been updated in the README to include the full list of module exports, the size of these modules, and better examples of how the monads in the library might be used.
Work has also begun on more detailed docs for each monad that complement the library's unit tests.
All unit tests have been migrated from Jest to Vitest for faster test runs and a much simpler test configuration when using ESM.
A few new utilities have been added to the library as pure functions instead of methods on the monads so that bundlers can more easily tree-shake them away if they are unused.
import {
noop,
zeroAsNone,
emptyStringAsNone,
emptyOrWhiteSpaceStringAsNone,
} from 'typescript-functional-extensions';
A few methods missing from MaybeAsync
have been added:
getValueOrDefault
getValueOrThrow
Full Changelog: v1.3.0...v1.4.0
v1.3.0 - 🛡 Type Guards for Result to access error and value
What's Changed
- feat(Result): Expose value or error if it is safe to expose by @GregOnNet in #10
To see how this feature works, check out the new tests for Result
Full Changelog: v1.2.0...v1.3.0
v1.2.0 - Result.Combine 🐱🏍
What's Changed
- feat(result): support combining multiple results by @GregOnNet in #8
New Contributors
- @GregOnNet made their first contribution in #8
Full Changelog: v1.1.1...v1.2.0
v1.1.1 - GitHub Actions integration ⚙
This is a non-functional update that adds GitHub Actions publishing to the repository and updates the npm package metadata.
v1.1.0 - Pipe operator
v1.1.0-beta.2 - Pipe operator
Test release for adding .pipe()
method to all monads
#6
v1.0.1 - CommonJs support
What's Changed
- Feature: Add CommonJS support by @seangwright in #5
New Contributors
- @seangwright made their first contribution in #5
Full Changelog: v1.0.0...v1.0.1
v1.0.0 - Initial Release 🎉
- Add tests for all types/methods
- Add jsdoc comments for all public methods for all types
- Update README.md with examples
v1.0.0-beta.4
- Add
Maybe.tryLast
static tryLast<TValue>(values: TValue[]): Maybe<TValue>;
static tryLast<TValue>(values: Some<TValue>[], predicate: PredicateOfT<Some<TValue>>): Maybe<TValue>;