-
-
Notifications
You must be signed in to change notification settings - Fork 3
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
update for Fastify v5 #30
Conversation
index.js
Outdated
@@ -8,7 +8,7 @@ function Negotiator (options) { | |||
const { | |||
supportedValues = [], | |||
cache | |||
} = (options && typeof options === 'object' && options) || {} | |||
} = (typeof options === 'object' && options) || {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does it do? It looks funny 😄
But I see it's irrelevant
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
first you have the null check, then you check if is an object, if true return that object. seems odd, but it should be faster than having the string comparison first. ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think typeof
no longer does string comparison, it has specific bytecode so it's as fast as it gets
Will check it again though
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI:
function isString(exp) {
return typeof exp === "string";
}
console.log(isString("hello"));
27 S> 0xeb02adde136 @ 0 : 0b 03 Ldar a0
0xeb02adde138 @ 2 : 20 01 TestTypeOf #1
58 S> 0xeb02adde13a @ 4 : a9 Return
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Removed the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
* update for v5 * add pre-commit * package-manager v4 * revert change * remove engines field
* update for Fastify v5 (#30) * update for v5 * add pre-commit * package-manager v4 * revert change * remove engines field * workflows: extend the test range (#32) * test for lts from 14 to 20 * test from 16 * update * update for Fastify v5 (#30) * update for v5 * add pre-commit * package-manager v4 * revert change * remove engines field * workflows: extend the test range (#32) * test for lts from 14 to 20 * test from 16 * update * update ci --------- Co-authored-by: Gürgün Dayıoğlu <[email protected]>
Resolves #26