Skip to content

Commit 4c6a9e4

Browse files
committed
Implement contains and lookup functions
1 parent 6c481d8 commit 4c6a9e4

2 files changed

Lines changed: 18 additions & 2 deletions

File tree

‎Sprint-2/implement/contains.js‎

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1-
function contains() {}
1+
function contains(obj, property) {
2+
if (
3+
obj === null ||
4+
typeof obj !== "object" ||
5+
Array.isArray(obj)
6+
) {
7+
return false;
8+
}
9+
}
10+
11+
return property in obj;
212

313
module.exports = contains;

‎Sprint-2/implement/lookup.js‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
function createLookup() {
2-
// implementation here
2+
const lookup = {};
3+
4+
countryCurrencyPairs.forEach(pair => {
5+
lookup[pair[0]] = pair[1];
6+
});
7+
8+
return lookup;
39
}
410

511
module.exports = createLookup;

0 commit comments

Comments
 (0)