Skip to content
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

Merged
merged 5 commits into from
Jul 21, 2019
Merged

Conversation

purebaba
Copy link
Contributor

@purebaba purebaba commented Jun 24, 2019

closes #38

@codecov
Copy link

codecov bot commented Jun 24, 2019

Codecov Report

Merging #38 into master will decrease coverage by 0.07%.
The diff coverage is 83.33%.

Impacted file tree graph

@@            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
Impacted Files Coverage Δ
lib/read.js 75% <83.33%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a6784b7...2c4bae9. Read the comment docs.

lib/read.js Outdated
* @param {ReadableStream}
*/
module.exports = (file, callback) => {
module.exports = (file, callback, validate = true) => {
Copy link
Owner

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
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

has been done

@codecov-io
Copy link

Codecov Report

Merging #38 into master will decrease coverage by 0.07%.
The diff coverage is 83.33%.

Impacted file tree graph

@@            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
Impacted Files Coverage Δ
lib/read.js 75% <83.33%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a6784b7...1d05853. Read the comment docs.

@codecov-io
Copy link

codecov-io commented Jul 1, 2019

Codecov Report

Merging #38 into master will increase coverage by 0.03%.
The diff coverage is 88.88%.

Impacted file tree graph

@@            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
Impacted Files Coverage Δ
lib/read.js 78.26% <88.88%> (+3.26%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a6784b7...5f51d24. Read the comment docs.

Copy link
Owner

@fent fent left a 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) => {
Copy link
Owner

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

Suggested change
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
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add semicolon

Suggested change
validate = true
validate = true;

lib/read.js Outdated
schema.validate(result, callback);
if (validate) {
schema.validate(result, callback);
return
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add semicolon

Suggested change
return
return;

lib/read.js Outdated Show resolved Hide resolved
Co-Authored-By: fent <fentbox@gmail.com>
@fent fent merged commit 134d1e4 into fent:master Jul 21, 2019
@fent
Copy link
Owner

fent commented Jul 21, 2019

Thank you! I'll publish soon

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants