Skip to content

Commit

Permalink
Implement _check
Browse files Browse the repository at this point in the history
  • Loading branch information
John-Chen92 committed Mar 18, 2024
1 parent 4b720b3 commit 90fac3e
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/calculator.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
exports._check = (x,y) => {
exports._check = (x, y) => {
// DRY up the codebase with this function
// First, move the duplicate error checking code here
// Then, invoke this function inside each of the others
Expand All @@ -12,22 +12,22 @@ exports._check = (x,y) => {
};

exports.add = (x, y) => {
exports._check(x,y);
exports._check(x, y);
return x + y;
};

exports.subtract = (x, y) => {
exports._check(x,y);
exports._check(x, y);
return x - y;
};

exports.multiply = (x, y) => {
exports._check(x,y);
exports._check(x, y);
return x * y;
};

exports.divide = (x, y) => {
exports._check(x,y);
exports._check(x, y);
return x / y;
};

Expand Down

0 comments on commit 90fac3e

Please sign in to comment.