Title: fix: improve mean function with input validation and extended tests by FatihBARACKILIC · Pull Request #1785 · TheAlgorithms/JavaScript · GitHub
Open Graph Title: fix: improve mean function with input validation and extended tests by FatihBARACKILIC · Pull Request #1785 · TheAlgorithms/JavaScript
X Title: fix: improve mean function with input validation and extended tests by FatihBARACKILIC · Pull Request #1785 · TheAlgorithms/JavaScript
Description: know more Describe your change: Fix a bug or typo in an existing algorithm This PR improves the mean function by: Adding input validation: Throws TypeError if input is not an array or contains non-number elements Throws Error if array is empty Adding a comprehensive test suite using Vitest, which includes: Empty arrays Invalid elements like null, true, 'string' Floating-point numbers, negative values, large values Mixed integer and float arrays The function now adheres more strictly to the expected behavior and is more robust against invalid input. Checklist: I have read CONTRIBUTING.md. This pull request is all my own work -- I have not plagiarized. I know that pull requests will not be merged if they fail the automated tests. This PR only changes one algorithm file. To ease review, please open separate PRs for separate algorithms. All new JavaScript files are placed inside an existing directory. All filenames use the UpperCamelCase (PascalCase) style. All new algorithms have a URL in their comments that points to Wikipedia or another similar explanation.
Open Graph Description: know more Describe your change: Fix a bug or typo in an existing algorithm This PR improves the mean function by: Adding input validation: Throws TypeError if input is not an array or contain...
X Description: know more Describe your change: Fix a bug or typo in an existing algorithm This PR improves the mean function by: Adding input validation: Throws TypeError if input is not an array or contain...
Opengraph URL: https://github.com/TheAlgorithms/JavaScript/pull/1785
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:09ca88dd-9c64-b2a8-ee13-ec9595c7531c |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | ABBC:BE940:5712350:759B5A1:696E1A74 |
| html-safe-nonce | dab27b0080ab1105ede017d918fc6b641d11cf77d1ed87a8caf5a2072b783cb9 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBQkJDOkJFOTQwOjU3MTIzNTA6NzU5QjVBMTo2OTZFMUE3NCIsInZpc2l0b3JfaWQiOiIzMzM5OTY2ODU4MzQ4MzM3NzgwIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 924ec40bf5f5f08a4db3bd73ffa5ffcfabde1c5630c9818b6a838f13fa357726 |
| hovercard-subject-tag | pull_request:2679698562 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/TheAlgorithms/JavaScript/pull/1785/files |
| twitter:image | https://avatars.githubusercontent.com/u/24433692?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/24433692?s=400&v=4 |
| og:image:alt | know more Describe your change: Fix a bug or typo in an existing algorithm This PR improves the mean function by: Adding input validation: Throws TypeError if input is not an array or contain... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 113cc336e7105fbb9f2ee8beb67c6cc584d65fa66a8a1a5dd236ba66db174af7 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/TheAlgorithms/JavaScript git https://github.com/TheAlgorithms/JavaScript.git |
| octolytics-dimension-user_id | 20487725 |
| octolytics-dimension-user_login | TheAlgorithms |
| octolytics-dimension-repository_id | 97086543 |
| octolytics-dimension-repository_nwo | TheAlgorithms/JavaScript |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 97086543 |
| octolytics-dimension-repository_network_root_nwo | TheAlgorithms/JavaScript |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 1d23f8b0bc31294c6a73ba2f3adfdd8c7052ca1e |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width