Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
f9d44f5
Fixes for Sprint 1 (#47)
illicitonion Oct 10, 2024
30e08c8
Misc tweaks to sprint 2 (#48)
illicitonion Oct 15, 2024
5359028
replace style guide link
SallyMcGrath Oct 27, 2024
99f4464
Add .idea (IntelliJ) to gitignore (#389)
tyzia Mar 17, 2025
1abb794
Update tests for Sprint 1 'fix median' task (#452)
tyzia Mar 29, 2025
f36fd7f
Update pull_request_template.md (#516)
cjyuan May 6, 2025
57e405f
Add test cases to check if array is sorted by numeric values
cjyuan Jul 6, 2025
2797246
Fix the link to Style Guide in PR template
cjyuan Jul 8, 2025
cd4c69f
Update repo metadata
illicitonion Jul 14, 2025
ce620b7
Move Jest configuration to root of Sprint-3 directory (#570)
textbook Jul 31, 2025
ce28c77
Add initial implementation
Aug 4, 2025
39afe22
Set up Validate PR Metadata action
illicitonion Aug 13, 2025
5aa1295
Update PR template
illicitonion Aug 27, 2025
bef4d1c
Merge branch 'main' of https://github.com/cjyuan/Module-Data-Groups i…
Oct 1, 2025
5fd6602
Update instructions and improve code
Oct 1, 2025
e92e4c9
Update Sprint-3/todo-list/00-what_is_ES_modules.md
cjyuan Oct 2, 2025
0ef86a4
Update Sprint-3/todo-list/01-using_esm_with_nodejs_and_jest.md
cjyuan Oct 2, 2025
d6f24dc
Update Sprint-3/todo-list/02-guide_to_modularize_code.md
cjyuan Oct 2, 2025
53c0adf
Update files based on Daniel feedback
Oct 3, 2025
59006e0
Use span instead of i for icon
cjyuan Oct 3, 2025
aa7da66
Merge pull request #790 from cjyuan/todo-new
cjyuan Oct 3, 2025
cbcdcc9
Refactor: set before-changed todos to deep copy of todos
cjyuan Oct 31, 2025
2c5d12f
use synchronous .click() in unit tests (#872)
jennetturkkan Nov 21, 2025
cfd674c
Remove old issue templates (#943)
cifarquhar Jan 22, 2026
23d646e
Remove PR template
illicitonion Feb 4, 2026
96d077b
Merge pull request #950 from CodeYourFuture/rm-pr-template
cifarquhar Feb 5, 2026
10b3ac9
Clarify dedupe() should return a new array
cjyuan Mar 17, 2026
4222cda
Update querystring.test.js to clarify spec (#1224)
cjyuan May 11, 2026
de6889c
correct task instructions (#1274)
Liam310 Jul 21, 2026
d49e0c2
Sprint 1: sync exercises with error-handling prep
abdishakoor-dev Sep 7, 2026
b2bed22
Address review: split median tests, clearer mean example, drop redund…
abdishakoor-dev Sep 7, 2026
4a13588
Merge pull request #1460 from CodeYourFuture/error-handling-exercises
Liam310 Sep 7, 2026
53942c6
Make Sprint 2 exercises throw on bad input
abdishakoor-dev Sep 7, 2026
d4189cd
Merge pull request #1461 from CodeYourFuture/sprint-2-error-handling
Liam310 Sep 7, 2026
38f06fb
Bring solutions branch up to date
abdishakoor-dev Sep 8, 2026
dd51010
Add solutions for mean, describe-median, querystring and mode
abdishakoor-dev Sep 8, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,2 @@
# These are supported funding model platforms

github: CodeYourFuture
patreon: # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
custom: https://codeyourfuture.io/donate
14 changes: 0 additions & 14 deletions .github/ISSUE_TEMPLATE/config.yml

This file was deleted.

59 changes: 0 additions & 59 deletions .github/ISSUE_TEMPLATE/pd-assignment.yml

This file was deleted.

80 changes: 0 additions & 80 deletions .github/ISSUE_TEMPLATE/tech-ed-assignment.yml

This file was deleted.

32 changes: 0 additions & 32 deletions .github/pull_request_template.md

This file was deleted.

18 changes: 18 additions & 0 deletions .github/workflows/validate-pr-metadata.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Validate PR Metadata
on:
pull_request_target:
types:
- labeled
- unlabeled
- opened
- edited
- reopened

jobs:
validate_pr_metadata:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: CodeYourFuture/actions/validate-pr-metadata@main
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
node_modules
.DS_Store
.vscode
**/.DS_Store
**/.DS_Store
.idea
package-lock.json
3 changes: 2 additions & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"streetsidesoftware.code-spell-checker",
"eamodio.gitlens",
"ritwickdey.LiveServer",
"vsliveshare.vsliveshare"
"vsliveshare.vsliveshare",
"Orta.vscode-jest"
]
}
52 changes: 0 additions & 52 deletions HOW_TO_REVIEW.md

This file was deleted.

50 changes: 21 additions & 29 deletions Sprint-1/fix/median.js
Original file line number Diff line number Diff line change
@@ -1,43 +1,35 @@
// Fix this implementation
// Start by running the tests for this function
// If you're in the week-1 directory, you can run npm test -- fix to run the tests in the fix directory
// If you're in the Sprint-1 directory, you can run `npm test -- fix` to run the tests in the fix directory

// Old Code:

// function calculateMedian(list) {
// const middleIndex = Math.floor(list.length / 2);
// const median = list.splice(middleIndex, 1)[0];
// return median;
// }
// Hint: Please consider scenarios when 'list' isn't an array, is empty,
// or contains values that aren't numbers (the function is expected to throw - see the tests).

// Explanation:
// The original implementation has several mistakes:
// 1 - .splice() mutates or changes the original array. We don't want this to happen.
// 2 - We actually don't need .splice() or any other method to find a median.
// 3 - We must sort the array before we search for the median.
// 4 - We should check if the 'list' parameter actually has numbers, otherwise try to filter
// out all non-numeric values and throw an error or return null if there are no numeric values.


// Example of a function calculating median and returning null in case no numeric values provided.
// Check the input first and throw if there is no sensible median to return.
// Sort a copy so the caller's array is not mutated, then read the middle
// element, or the average of the two middle elements when the length is even.

function calculateMedian(list) {
if (!Array.isArray(list)) {
return null;
throw new Error("calculateMedian requires an array of numbers");
}
const onlyNumberList = list.filter(item => typeof item === 'number' && !isNaN(item));

if (!onlyNumberList.length) {
return null;
} else {
const sortedList = onlyNumberList.sort((current, next) => current - next);
const indexNearMiddleOfArray = Math.floor(sortedList.length / 2);
if (sortedList.length % 2 === 0) {
return (sortedList[indexNearMiddleOfArray - 1] + sortedList[indexNearMiddleOfArray]) / 2;
} else {
return sortedList[indexNearMiddleOfArray];
for (const item of list) {
if (typeof item !== "number") {
throw new Error("calculateMedian requires an array of numbers");
}
}
if (list.length === 0) {
throw new Error("calculateMedian requires a non-empty array");
}

const sorted = [...list].sort((a, b) => a - b);
const middleIndex = Math.floor(sorted.length / 2);

if (sorted.length % 2 === 0) {
return (sorted[middleIndex - 1] + sorted[middleIndex]) / 2;
}
return sorted[middleIndex];
}

module.exports = calculateMedian;
Loading