All notable changes to this project will be documented in this file.
- The either type now accepts type without promise and returns the awaited type.
build.ts
to build the project with esbuild
- the build process for npm uses a build.ts file to build the project with esbuild. This gives esm js files the .js extension which is needed for some environments.
Might
andFail
functions- new docs page in the readme
mightFail
andmightFailSync
now return an object tuple so you can destructure it as an object or a tuple, your choice.- removed the
/tuple
folder since the normalmight-fail
import will work the same.
mightFail.any
supportmightFail.race
supportmightFail.all
supportmightFail.allSettled
support
/go
folder for a Go-style tuple implementation.const [result, error] = mightFail(promise)
/tuple
folder for a tuple implementation.const [error, result] = mightFail(promise)
- If a function throws a string, the string will be the message of the new Error object.
- If a function throws an object with a message property, the message will be the message of the new Error object.
- If a function throws an object it will be passed to the Error object constructor as is.
- Support for synchronous error handling with
mightFailSync
andmakeMightFailSync
functions. - A new
publish
script inpackage.json
to streamline the build and publish process.
- The library now officially supports both async and sync error handling. This change is reflected in the README to emphasize the library's versatility in handling errors in different contexts.
- Updated
Either.ts
to streamline the type definition for a more straightforward implementation.
- Initial support for async error handling with
mightFail
andmakeMightFail
functions. - Comprehensive documentation in the README, illustrating the use of the library with practical examples.
- Implementation of the
Either
type to support the async error handling pattern.
- Various internal improvements for better performance and reliability.