Skip to content
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

Merged
merged 5 commits into from
Feb 28, 2024
Merged

update for Fastify v5 #30

merged 5 commits into from
Feb 28, 2024

Conversation

gurgunday
Copy link
Member

@gurgunday gurgunday commented Feb 25, 2024

Resolves #26

index.js Outdated
@@ -8,7 +8,7 @@ function Negotiator (options) {
const {
supportedValues = [],
cache
} = (options && typeof options === 'object' && options) || {}
} = (typeof options === 'object' && options) || {}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why?

Copy link
Member Author

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

Copy link
Contributor

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. ;)

Copy link
Member Author

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

Copy link
Member Author

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

Copy link
Contributor

@Uzlopak Uzlopak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@gurgunday
Copy link
Member Author

gurgunday commented Feb 25, 2024

Removed the engines field for consistency with other plugins and #26 (comment)

Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@gurgunday gurgunday merged commit 60edb77 into fastify:next Feb 28, 2024
20 checks passed
@gurgunday gurgunday deleted the v5 branch February 28, 2024 14:23
jsumners pushed a commit that referenced this pull request Jul 3, 2024
* update for v5

* add pre-commit

* package-manager v4

* revert change

* remove engines field
jsumners added a commit that referenced this pull request Jul 5, 2024
* 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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants