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

feat(sampleSize): add sampleSize #101

Merged
merged 1 commit into from
Jun 30, 2024
Merged

Conversation

jgjgill
Copy link
Contributor

@jgjgill jgjgill commented Jun 30, 2024

close #87

Add error check

I added the error checking code from the code discussed in the issue.

if (size > array.length) {
  throw new Error('Size must be less than or equal to the length of array.');
}

If the user enter a size greater than the length of the array (e.g. sampleSize([1, 2, 3], 4)) in the absence of error checking code, the following error message is displayed.

Error: Invalid input: The maximum value must be greater than the minimum value.

스크린샷 2024-06-30 오후 6 31 31

I think that error log is less relevant to sampleSize.
Feel free to tell me if you think it's unnecessary. 🙇‍♂️

@jgjgill jgjgill requested a review from raon0211 as a code owner June 30, 2024 09:46
Copy link

vercel bot commented Jun 30, 2024

@jgjgill is attempting to deploy a commit to the Toss Team on Vercel.

A member of the Team first needs to authorize it.

@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 91.66667% with 1 line in your changes missing coverage. Please review.

Project coverage is 99.67%. Comparing base (6c9c0d1) to head (7a88469).

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##              main     #101      +/-   ##
===========================================
- Coverage   100.00%   99.67%   -0.33%     
===========================================
  Files           56       57       +1     
  Lines          299      311      +12     
  Branches        35       37       +2     
===========================================
+ Hits           299      310      +11     
- Misses           0        1       +1     

Copy link

codspeed-hq bot commented Jun 30, 2024

CodSpeed Performance Report

Merging #101 will degrade performances by 73.12%

Comparing jgjgill:feat/sampleSize (7a88469) with main (6c9c0d1)

Summary

⚡ 9 improvements
❌ 8 regressions
✅ 79 untouched benchmarks

🆕 2 new benchmarks

⚠️ Please fix the performance issues or acknowledge them on CodSpeed.

Benchmarks breakdown

Benchmark main jgjgill:feat/sampleSize Change
lodash 207.3 µs 326.5 µs -36.51%
lodash/difference 56.7 µs 210.9 µs -73.12%
lodash/differenceBy 225.9 µs 70.9 µs ×3.2
lodash/differenceWith 345 µs 69.2 µs ×5
es-toolkit/intersection 2.8 ms 7.2 ms -61.07%
lodash/intersectionWith 245.3 µs 92.4 µs ×2.7
lodash/isNil 191.3 µs 35.2 µs ×5.4
lodash/pick 387.4 µs 85.9 µs ×4.5
es-toolkit/range 39.2 µs 48.5 µs -19.12%
lodash/range 33.4 µs 44.4 µs -24.6%
🆕 es-toolkit/sampleSize N/A 35.8 µs N/A
🆕 lodash/sampleSize N/A 37.1 µs N/A
lodash/union 239.3 µs 75.7 µs ×3.2
lodash/unionBy 360.2 µs 75.4 µs ×4.8
lodash/unionWith 84.9 µs 239.2 µs -64.49%
lodash/xorBy 254.1 µs 93.4 µs ×2.7
lodash/xorWith 260.2 µs 405.7 µs -35.88%
lodash/zip 237.8 µs 363 µs -34.49%
lodash/zipWith 408.3 µs 261.3 µs +56.21%

Copy link
Collaborator

@raon0211 raon0211 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 your great contribution!

@raon0211 raon0211 merged commit 02f14b3 into toss:main Jun 30, 2024
7 of 9 checks passed
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.

Support for sampleSize
3 participants