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

refactor(auth): make Buffer use more idiomatic #4041

Merged
merged 3 commits into from
Oct 9, 2023

Conversation

eventualbuddha
Copy link
Collaborator

Overview

We don't need the numericArray helper or spreading into array literals passed to Buffer.from calls. Instead, we should use the more idiomatic and efficient Buffer.alloc and Buffer.concat calls. This also changes Buffer.from([…]) calls to Buffer.of(…) as the intermediate array is just extra noise (they probably amount to about the same in terms of perf for small N, at any rate).

Demo Video or Screenshot

n/a

Testing Plan

Automated

We don't need the `numericArray` helper or spreading into array literals passed to `Buffer.from` calls. Instead, we should use the more idiomatic and efficient `Buffer.alloc` and `Buffer.concat` calls. This also changes `Buffer.from([…])` calls to `Buffer.of(…)` as the intermediate array is just extra noise (they probably amount to about the same in terms of perf for small N, at any rate).
@eventualbuddha eventualbuddha requested review from arsalansufi and a team as code owners October 5, 2023 17:35
@eventualbuddha eventualbuddha requested review from adghayes and removed request for a team October 5, 2023 17:35
Copy link
Contributor

@arsalansufi arsalansufi left a comment

Choose a reason for hiding this comment

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

Thanks for tweaking!

libs/auth/src/java_card.test.ts Outdated Show resolved Hide resolved
libs/auth/src/java_card.test.ts Outdated Show resolved Hide resolved
@eventualbuddha eventualbuddha enabled auto-merge (squash) October 9, 2023 16:59
@eventualbuddha eventualbuddha enabled auto-merge (squash) October 9, 2023 17:01
@eventualbuddha eventualbuddha merged commit 9b5ccf5 into main Oct 9, 2023
@eventualbuddha eventualbuddha deleted the brian/auth/idiomatic-buffer branch October 9, 2023 17:04
@arsalansufi arsalansufi mentioned this pull request Feb 2, 2024
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants