2.0.6 • Published 3 years ago
ntn-try-me v2.0.6
ntn-try-me
try-me is a tiny utility.
try-me help Eliminate regular, tangled and heavy try-catch-finally.
With the aim to help you with error handling.
You will be able to gain the following:
- Less code
- A more intelligent code
- More flexibility
- All in Typescript
- With ESM \ ES Modules
Get ready
npm i ntn-try-me
unpkg.com/ntn-try-me/bundle/bundle
API
Need an Example ?
import { tryMe } from 'ntn-try-me';
tryMe(() => { });
import { _try } from 'ntn-try-me'; // Lighter
_try(() => { });
import { tryMe } from 'ntn-try-me';
tryMe<MyErr>(() => Number['myFn'](), {
valid: () => console.log('Great!'),
fail: (e: MyErr) => console.log('Bummer...'),
ifFailFireErr: true,
fireErrUniqType: TypeError,
finalize: () => console.log('We did it.')
});
In the future
- Async
- Fluent API