npm.io
4.0.9 • Published 5 months ago

try-catch

Licence
MIT
Version
4.0.9
Deps
0
Size
5 kB
Vulns
0
Weekly
0
Stars
19

Try Catch License NPM version Build Status Coverage Status

Functional try-catch wrapper

Install

npm i try-catch

Example

import {tryCatch} from 'try-catch';

const {parse} = JSON;
const [error, result] = tryCatch(parse, 'hello');

if (error)
    console.error(error.message);

License

MIT