unthen
Convert anything to Promise that resolves to [err, res]
array
Install
npm i unthen
Usage
const unthen = ; { console; //resolves to [null, 1] console; //resolves to [Error: ] console; //resolves to [null, 1] console; //resolves to [Error: ]}
Why?..
Just because [err, res] way is more familiar for many of us, even in promise epoch.
Classic way (from this article):
{ let response try response = await catch err logger return resstatus500 let document try document = await Mongo catch err logger return resstatus500 }
New way with unthen
:
const U = ; { const httpErr response = await if httpErr logger return resstatus500 const mongoErr document = await ifmongoErr logger return resstatus500 }
License
MIT