All notable changes to this project will be documented in this file.
- Added .js extensions which is necessary when using moduleResolution: "node16" or "nodenext" in TypeScript.
- .cjs extension to CommonJS output files
- a plugin to fix require() statements to reference .cjs files
- 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.
- Fixed the error type to make it more generic and consistent with TS: #20
- Removed
NotUndefinedtype. #20
- The either type now accepts type without promise and returns the awaited type.
build.tsto 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.
MightandFailfunctions- new docs page in the readme
mightFailandmightFailSyncnow return an object tuple so you can destructure it as an object or a tuple, your choice.- removed the
/tuplefolder since the normalmight-failimport will work the same.
mightFail.anysupportmightFail.racesupportmightFail.allsupportmightFail.allSettledsupport
/gofolder for a Go-style tuple implementation.const [result, error] = mightFail(promise)/tuplefolder 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
mightFailSyncandmakeMightFailSyncfunctions. - A new
publishscript inpackage.jsonto 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.tsto streamline the type definition for a more straightforward implementation.
- Initial support for async error handling with
mightFailandmakeMightFailfunctions. - Comprehensive documentation in the README, illustrating the use of the library with practical examples.
- Implementation of the
Eithertype to support the async error handling pattern.
- Various internal improvements for better performance and reliability.