Skip to content

Commit c15204d

Browse files
committed
test: implement input validation for calculateMean function
1 parent 44859cb commit c15204d

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

‎Sprint-1/implement/mean.js‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1-
function calculateMean(list) {}
1+
function calculateMean(list) {
2+
if (!Array.isArray(list)) {
3+
throw new Error("calculateMean requires an array of numbers");
4+
}
5+
}
26

37
module.exports = calculateMean;

0 commit comments

Comments
 (0)