go-go-try 2.0.1 → 2.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.d.ts +1 -1
- package/index.js +2 -1
- package/package.json +1 -1
package/index.d.ts
CHANGED
package/index.js
CHANGED
|
@@ -22,8 +22,9 @@ function getErrorMessage(error) {
|
|
|
22
22
|
return toErrorWithMessage(error).message;
|
|
23
23
|
}
|
|
24
24
|
export default function goTry(value) {
|
|
25
|
+
let unwrappedValue;
|
|
25
26
|
try {
|
|
26
|
-
|
|
27
|
+
unwrappedValue = typeof value === 'function' ? value() : value;
|
|
27
28
|
if (pIsPromise(unwrappedValue)) {
|
|
28
29
|
return Promise.resolve(unwrappedValue)
|
|
29
30
|
.then((value) => [undefined, value])
|