generated from CodeYourFuture/Module-Template
-
-
Notifications
You must be signed in to change notification settings - Fork 220
London|ITP-September-2025|Alexandru Pocovnicu|Sprint 1|Implement #806
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
Closed
alexandru-pocovnicu
wants to merge
27
commits into
CodeYourFuture:main
from
alexandru-pocovnicu:Sprint-1
Closed
Changes from all commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
71fa218
Add initial test file for mean calculations
alexandru-pocovnicu 927769b
Add mean.js file for mean calculations
alexandru-pocovnicu a393af9
Remove mean.js and mean.test.js files
alexandru-pocovnicu 057a7dd
Update dependencies in package-lock.json to latest versions
alexandru-pocovnicu bc5e43c
Refactor calculateMedian function to handle mixed values and improve …
alexandru-pocovnicu b13a731
Add workspace configuration for project structure and Jest settings
alexandru-pocovnicu 552eb4c
Refactor calculateMedian function to filter non-numeric values and im…
alexandru-pocovnicu 1e0393e
Refactor calculateMedian function to improve null checks and remove r…
alexandru-pocovnicu b78089c
Refactor calculateMedian function to streamline sorting and improve m…
alexandru-pocovnicu 4f6b45e
Add tests for findMax function to cover various input scenarios
alexandru-pocovnicu 5d670ec
Refactor findMax function to enhance readability and maintainability
alexandru-pocovnicu 879eb0e
Implement tests for sum function to validate various input scenarios
alexandru-pocovnicu 157b5f7
Implement sum function to calculate the sum of an array of numbers
alexandru-pocovnicu c85cfda
Implement tests for dedupe function to validate various input scenarios
alexandru-pocovnicu 5619c22
Implement dedupe function to remove duplicate values from an array
alexandru-pocovnicu abd3a43
Format code for consistency and readability in dedupe function
alexandru-pocovnicu ee2fd08
Format dedupe tests for consistency and readability
alexandru-pocovnicu 584bd6f
Fix spacing in comment for consistency in includes tests
alexandru-pocovnicu 908c81e
Refactor includes function to use for...of loop for improved readability
alexandru-pocovnicu 05a2a70
updated the median variable to be more compact
alexandru-pocovnicu 29f30d2
removed unnecessary copy of array
alexandru-pocovnicu 235fbc6
add test to check that dedupe returns a copy and not the original array
alexandru-pocovnicu 9fefde9
Refactor sum function to improve NaN handling and streamline number f…
alexandru-pocovnicu c230c17
changed test for decimal numbers from toEqual to toBeCloseTo
alexandru-pocovnicu 843f101
deleted unnecessary code
alexandru-pocovnicu 49a93ca
updated test to check if dedupe returns a copy of the original array
alexandru-pocovnicu 3d8bc26
filtered out NaN from the elements
alexandru-pocovnicu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| { | ||
| "folders": [ | ||
| { | ||
| "name": "Sprint-1", | ||
| "path": "./Sprint-1" | ||
| }, | ||
| { | ||
| "name": "Sprint-2", | ||
| "path": "./Sprint-2" | ||
| }, | ||
| { | ||
| "name": "Sprint-3", | ||
| "path": "./Sprint-3" | ||
| } | ||
| ], | ||
| "settings": { | ||
| "jest.disabledWorkspaceFolders": ["Sprint-2", "Sprint-3"], | ||
| "jest.jestCommandLine": "npm test --" | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,8 @@ | ||
| function dedupe() {} | ||
| function dedupe(arr) { | ||
| if (arr.length === 0) { | ||
| return []; | ||
| } | ||
|
|
||
| return [...new Set(arr)]; | ||
| } | ||
| module.exports = dedupe; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,17 @@ | ||
| function findMax(elements) { | ||
| if (elements.length === 0) { | ||
| return -Infinity; | ||
| } else if (elements.length === 1) { | ||
| return elements[0]; | ||
| } | ||
| if (elements.every((element) => typeof element !== "number")) { | ||
| return NaN; | ||
| } | ||
| let filteredElements = elements.filter( | ||
| (element) => typeof element === "number" | ||
| ); | ||
| let orderedElements = filteredElements.sort((a, b) => a - b); | ||
| return orderedElements[orderedElements.length - 1]; | ||
| } | ||
|
|
||
| module.exports = findMax; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,19 @@ | ||
| function sum(elements) { | ||
| } | ||
| if (elements.length === 0) { | ||
| return 0; | ||
| } | ||
|
|
||
| const filteredElements = elements.filter( | ||
| (element) => typeof element === "number" && !Number.isNaN(element) | ||
| ); | ||
| if (filteredElements.length === 0) { | ||
| return NaN; | ||
| } | ||
| let addElements = 0; | ||
| for (let element of filteredElements) { | ||
| addElements = addElements + element; | ||
| } | ||
|
|
||
| return addElements; | ||
| } | ||
| module.exports = sum; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.