try-function
v0.1.0
Published
TODO
Readme
try-function
Installation
npm install try-functionUsage
Convert this:
let payload: string | undefined;
try {
payload = decode("abc123");
} catch (error) {
// ...
}... to this:
const payload = tryFn(
() => decode("abc123"),
(error) => {
// ...
}
);- Functional with no re-assignement (no need for
let) - Less error-prone
- Automatic typing (no need to define
result's type) - Supports
asyncfunctions out-of-the-box - Supports
finallyblocks - No dependencies
- Fully tested
Changelog
For a list of changes and releases, see the changelog.
Contributing
Found a bug, have a question or looking to improve try-function? Open an issue, start a discussion or submit a PR!
