Skip to content

#762 : fix float number sorting#763

Open
xi-jjun wants to merge 2 commits into
javve:developfrom
xi-jjun:762_fix_float_number_sotring
Open

#762 : fix float number sorting#763
xi-jjun wants to merge 2 commits into
javve:developfrom
xi-jjun:762_fix_float_number_sotring

Conversation

@xi-jjun
Copy link
Copy Markdown

@xi-jjun xi-jjun commented Jun 3, 2023

Issues

Implements Descriptions

  1. if item value is float type string
  2. then check floating number length for multiply own number
  3. after number is multiplied, then we make it to integer
  4. parse integer to string for using naturalSort

Example

  • 0.5 , 0.26
  • --> max floating number length is 2 (0.26 has 2)
  • multiply each
    • 0.5 --> 50
    • 0.26 --> 26
  • Then, we can sort these values like integer!

Test results

image

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Jun 3, 2023

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.67%. Comparing base (862caa2) to head (6db40c2).

Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #763      +/-   ##
===========================================
+ Coverage    93.54%   93.67%   +0.12%     
===========================================
  Files           19       19              
  Lines          837      854      +17     
  Branches       199      201       +2     
===========================================
+ Hits           783      800      +17     
  Misses          38       38              
  Partials        16       16              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Comment thread src/sort.js
}

function isFloatString(value) {
if (value === undefined || value === null || !value || typeof value !== 'string' || value.split(".").length !== 2) {
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

    value.split(".").length !== 2

--> just check value(string type) has only one . because of ip sorting test case.

@lovasoa
Copy link
Copy Markdown

lovasoa commented Aug 3, 2023

Thanks. I merged that in https://www.npmjs.com/package/list.js-fixed

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.

3 participants