-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement _check_2 #2225
base: Lavnish0101
Are you sure you want to change the base?
Implement _check_2 #2225
Conversation
Thank you for the submission, @Lavnish0101! I'll review your code shortly, hang tight. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a great attempt, @Lavnish0101!
I would like to request a few changes before merging your work. Please review my comments below and make the appropriate changes to your code.
After you update your code locally, follow the instructions to save your changes locally and push your changes to your fork.
When you push your changes to your fork, I'll come back for another review.
There are 2 style guide violations in your contribution. I've marked them with inline comments for your convenience.
Please revisit your code and follow the style guide best practices.
Hint: You might be able to fix some issues automatically by running npm run lint -- --fix
There are 5 tests still pending. In your test file, change describe.skip
to describe
and ensure they pass.
src/calculator.js
Outdated
@@ -1,4 +1,4 @@ | |||
exports._check = () => { | |||
exports._check = (x,y) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A space is required after ','.
(learn more)
src/calculator.js
Outdated
@@ -1,4 +1,4 @@ | |||
exports._check = () => { | |||
exports._check = (x,y) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'y' is defined but never used.
(learn more)
Thanks for the changes, @Lavnish0101. I'm reviewing them now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a great attempt, @Lavnish0101!
I would like to request a few changes before merging your work. Please review my comments below and make the appropriate changes to your code.
After you update your code locally, follow the instructions to save your changes locally and push your changes to your fork.
When you push your changes to your fork, I'll come back for another review.
There are 10 style guide violations in your contribution. I've marked them with inline comments for your convenience.
Please revisit your code and follow the style guide best practices.
Hint: You might be able to fix some issues automatically by running npm run lint -- --fix
All the tests are passing. Nice job!
// DRY up the codebase with this function | ||
// First, move the duplicate error checking code here | ||
// Then, invoke this function inside each of the others | ||
// HINT: you can invoke this function with exports._check() | ||
|
||
if (typeof x !== "number") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Strings must use singlequote.
(learn more)
throw new TypeError(`${x} is not a number`); | ||
} | ||
|
||
if (typeof y !== "number") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Strings must use singlequote.
(learn more)
}; | ||
|
||
exports.add = (x, y) => { | ||
if (typeof x !== 'number') { | ||
if (typeof x !== "number") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Strings must use singlequote.
(learn more)
throw new TypeError(`${x} is not a number`); | ||
} | ||
if (typeof y !== 'number') { | ||
if (typeof y !== "number") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Strings must use singlequote.
(learn more)
return x + y; | ||
}; | ||
|
||
exports.subtract = (x, y) => { | ||
if (typeof x !== 'number') { | ||
if (typeof x !== "number") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Strings must use singlequote.
(learn more)
throw new TypeError(`${x} is not a number`); | ||
} | ||
if (typeof y !== 'number') { | ||
if (typeof y !== "number") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Strings must use singlequote.
(learn more)
return x - y; | ||
}; | ||
|
||
exports.multiply = (x, y) => { | ||
if (typeof x !== 'number') { | ||
if (typeof x !== "number") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Strings must use singlequote.
(learn more)
throw new TypeError(`${x} is not a number`); | ||
} | ||
if (typeof y !== 'number') { | ||
if (typeof y !== "number") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Strings must use singlequote.
(learn more)
return x * y; | ||
}; | ||
|
||
exports.divide = (x, y) => { | ||
if (typeof x !== 'number') { | ||
if (typeof x !== "number") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Strings must use singlequote.
(learn more)
throw new TypeError(`${x} is not a number`); | ||
} | ||
if (typeof y !== 'number') { | ||
if (typeof y !== "number") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Strings must use singlequote.
(learn more)
Thanks for the changes, @Lavnish0101. I'm reviewing them now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a great attempt, @Lavnish0101!
I would like to request a few changes before merging your work. Please review my comments below and make the appropriate changes to your code.
After you update your code locally, follow the instructions to save your changes locally and push your changes to your fork.
When you push your changes to your fork, I'll come back for another review.
There are 13 style guide violations in your contribution. I've marked them with inline comments for your convenience.
Please revisit your code and follow the style guide best practices.
Hint: You might be able to fix some issues automatically by running npm run lint -- --fix
All the tests are passing. Nice job!
// DRY up the codebase with this function | ||
// First, move the duplicate error checking code here | ||
// Then, invoke this function inside each of the others | ||
// HINT: you can invoke this function with exports._check() | ||
|
||
if (typeof x !== "number") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Strings must use singlequote.
(learn more)
throw new TypeError(`${x} is not a number`); | ||
} | ||
|
||
if (typeof y !== "number") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Strings must use singlequote.
(learn more)
}; | ||
|
||
exports.add = (x, y) => { | ||
if (typeof x !== 'number') { | ||
if (typeof x !== "number") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Strings must use singlequote.
(learn more)
throw new TypeError(`${x} is not a number`); | ||
} | ||
if (typeof y !== 'number') { | ||
if (typeof y !== "number") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Strings must use singlequote.
(learn more)
throw new TypeError(`${y} is not a number`); | ||
} | ||
exports._check(x, y); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trailing spaces not allowed.
(learn more)
throw new TypeError(`${x} is not a number`); | ||
} | ||
if (typeof y !== 'number') { | ||
if (typeof y !== "number") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Strings must use singlequote.
(learn more)
return x * y; | ||
}; | ||
|
||
exports.divide = (x, y) => { | ||
if (typeof x !== 'number') { | ||
if (typeof x !== "number") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Strings must use singlequote.
(learn more)
throw new TypeError(`${x} is not a number`); | ||
} | ||
if (typeof y !== 'number') { | ||
if (typeof y !== "number") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Strings must use singlequote.
(learn more)
beforeEach(() => { | ||
sinon.spy(calculator, '_check'); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trailing spaces not allowed.
(learn more)
beforeEach(() => { | ||
sinon.spy(calculator, '_check'); | ||
|
||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Block must not be padded by blank lines.
(learn more)
Delete me and write your Pull Request message here!