-
Notifications
You must be signed in to change notification settings - Fork 154
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TypeError: to is not a function #51
Comments
indeed. I added a Lines 11 to 12 in ed778a0
Tested with Node v16.14.2 |
still a problem two years later, please update the readme file or fix |
这是来自QQ邮箱的假期自动回复邮件。你好,我最近正在休假中,无法亲自回复你的邮件。我将在假期结束后,尽快给你回复。
|
Solved creating a local file async function to (promise) {
return promise
.then(data => [null, data])
.catch(err => [err, null])
}
export default to and used as follow import to from './await-to-js.js'
const [err] = await to(anyPromiseFunction()) |
When using this library, I needed to import with the following pattern:
Instead of the approach in the README:
Otherwise I would get an error:
From adding logging to the library, it appears that the import statement is using await-to-js.umd.js and not await-to-js.es5.js.
Tested with Node v14.17.0 running as
node index.mjs
.The text was updated successfully, but these errors were encountered: