try-catch

functional try-catch wrapper

Usage no npm install needed!

<script type="module">
  import tryCatch from 'https://cdn.skypack.dev/try-catch';
</script>

README

Try Catch License NPM version Dependency Status Build Status Coverage Status

Functional try-catch wrapper

Install

npm i try-catch

Example

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

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

Related

License

MIT