Skip to content

Commit a236a49

Browse files
Add input validation to createLookup function
1 parent 4464835 commit a236a49

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

Sprint-2/implement/lookup.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
function createLookup(countryCurrency) {
2+
if (!Array.isArray(countryCurrency)) {
3+
throw new Error("Argument must be an array");
4+
}
25
let countryCurrencyPairs = {};
36
for (const pair of countryCurrency) {
47
let country = pair[0];

0 commit comments

Comments
 (0)