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

Add edge case checks and rework logic friendlysize #4666

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

brettgilio
Copy link

@brettgilio brettgilio commented Dec 24, 2022

Follows #4662

@brettgilio brettgilio changed the title Add edge case checks and rework logic Add edge case checks and rework logic friendlysize Dec 24, 2022
@brunnre8
Copy link
Member

why are you rewriting this code?

@brettgilio
Copy link
Author

why are you rewriting this code?

Largely to handle edge cases. I noticed them when I was viewing the file to extend @4662.


const i = Math.floor(Math.log(size) / Math.log(1024));

if (i >= sizes.length) {
Copy link
Member

Choose a reason for hiding this comment

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

this must not error, simply emit a large number

Copy link
Author

Choose a reason for hiding this comment

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

To be clear you just want it to emit the KB value?

Copy link
Member

Choose a reason for hiding this comment

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

why KB?
You are guarding the index value, simply pick the highest available one namely sizes.length and do the dance same as you did in the other patch.

@brunnre8 brunnre8 added Meta: Internal This is an internal codebase change (testing, linting, etc.). Status: changes-requested Review happened but some changes need to be made labels Dec 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Meta: Internal This is an internal codebase change (testing, linting, etc.). Status: changes-requested Review happened but some changes need to be made
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants