🔨unwrap
<T>(opt?: WrapOption) => T | neverTry to get the value, will panic when the wrapped value is an error.
const wrapper = await wrap(Promise.resolve(1))
const json = wrapper.unwrap() // 1In Node.js, you can specify {panic: true} to let the program exit instead of throwing an error.
// this will exit the program in Node.js
(await wrap(Promise.reject(1))).unwrap({panic: true})Exit code
If you need to specify an exit code in Node.js, you can pass the exitCode to unwrap method.
(await wrap(Promise.reject(1))).unwrap({panic: true, exitCode: 2})Last updated