util-to

1.0.2 • Public • Published

util-to

It is just simple util that helps you to write less code

So instead of writing:
try{
    const response = await this.instance.post(url, params)
}
catch(err){
    throw "Some error"
} 
You could write like that:
import to from 'util-to'

const [err, response] = await to(this.instance.post(url, params))
if(err) throw "Some error"

return response

Package Sidebar

Install

npm i util-to

Weekly Downloads

8

Version

1.0.2

License

ISC

Unpacked Size

895 B

Total Files

3

Last publish

Collaborators

  • pavliha