-
Notifications
You must be signed in to change notification settings - Fork 37
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
add optional parameter to skip schema validate #38
Conversation
Codecov Report
@@ Coverage Diff @@
## master #38 +/- ##
==========================================
- Coverage 83.4% 83.33% -0.08%
==========================================
Files 8 8
Lines 464 468 +4
Branches 105 106 +1
==========================================
+ Hits 387 390 +3
- Misses 77 78 +1
Continue to review full report at Codecov.
|
lib/read.js
Outdated
* @param {ReadableStream} | ||
*/ | ||
module.exports = (file, callback) => { | ||
module.exports = (file, callback, validate = true) => { |
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.
typically, the callback
is the last argument in a function. you can make validate
an optional param by doing something like
if (typeof validate === 'function') {
callback = validate
validate = true
}
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.
has been done
Codecov Report
@@ Coverage Diff @@
## master #38 +/- ##
==========================================
- Coverage 83.4% 83.33% -0.08%
==========================================
Files 8 8
Lines 464 468 +4
Branches 105 106 +1
==========================================
+ Hits 387 390 +3
- Misses 77 78 +1
Continue to review full report at Codecov.
|
Codecov Report
@@ Coverage Diff @@
## master #38 +/- ##
==========================================
+ Coverage 83.4% 83.43% +0.03%
==========================================
Files 8 8
Lines 464 471 +7
Branches 105 107 +2
==========================================
+ Hits 387 393 +6
- Misses 77 78 +1
Continue to review full report at Codecov.
|
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.
sorry for taking long to review this
* @param {ReadableStream} | ||
*/ | ||
module.exports = (file, callback) => { | ||
module.exports = (file, validate = true, callback) => { |
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.
no need to have the = true
part here since this optional param is checked below
module.exports = (file, validate = true, callback) => { | |
module.exports = (file, validate, callback) => { |
module.exports = (file, validate = true, callback) => { | ||
if (typeof validate === 'function') { | ||
callback = validate; | ||
validate = true |
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.
add semicolon
validate = true | |
validate = true; |
lib/read.js
Outdated
schema.validate(result, callback); | ||
if (validate) { | ||
schema.validate(result, callback); | ||
return |
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.
add semicolon
return | |
return; |
Co-Authored-By: fent <fentbox@gmail.com>
Thank you! I'll publish soon |
closes #38