-
Notifications
You must be signed in to change notification settings - Fork 126
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
internals.isFunction returns false if the provided functionToCheck is an async function #243
Comments
@carnesen how are you creating your |
Thanks for the reply. To answer your question, I prefer async function declarations
Seems to me though I'd say the fix here is to add a Shall I submit a PR for it? |
@carnesen For the record I like the functionality, and if anyone has time to PR an update to our |
@nelsonic I don't know why that Mozilla page still says async/await is in "draft" status. The finalized spec was accepted into the the 2017 standard of the language last month http://2ality.com/2016/02/ecmascript-2017.html . Furthermore it's definitely implemented in the "current" version of Node.js (8), which is all we really care about here. In fact async/await has been enabled by default in the Chrome V8 engine that powers Node.js since last November. In other words, the paint is dry on async/await. |
@carnesen I think the reason that |
Everything I've heard about async/await says that it's really truly part of the language spec now, e.g. https://hackernoon.com/es8-was-released-and-here-are-its-main-new-features-ee9c394adf66 . In Node.js async/await has been available (and not behind a flag) since 7.6+. I try to stick to the "long-term support" versions of Node.js, and waited until Node.js 8 was released a month or so ago. |
@carnesen node v.8.x will enter "LTS" in October 2017. see: https://github.com/nodejs/LTS Again, if you have time please Pull Request an update to |
The function internals.isFunction
hapi-auth-jwt2/lib/index.js
Line 38 in f2560e6
uses an expression like this
({}).toString.call(functionToCheck)
to determine whether the provided functionToCheck is a function. IffunctionToCheck
is an async function (e.g.async function () {}
), the expression evaluates to'[object AsyncFunction]'
, which is not equal to'[object Function]'
so isFunction returnsfalse
. It should returntrue
for an async function too.The text was updated successfully, but these errors were encountered: