arb / celebrate

A joi validation middleware for Express.
MIT License
1.33k stars 66 forks source link

Update schema.js #209

Closed 7006 closed 3 years ago

7006 commented 3 years ago

use Array.prototype.filter to collect an array of error status codes

arb commented 3 years ago

Thanks for the PR! However, this change forces two loops to happen over the status codes where, as the way it is currently, it does everything in a single pass.

codecov-io commented 3 years ago

Codecov Report

Merging #209 (396dcc2) into master (5227973) will not change coverage. The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##            master      #209   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            1         1           
  Lines            4         4           
=========================================
  Hits             4         4           

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 5227973...396dcc2. Read the comment docs.

7006 commented 3 years ago

@arb how do you feel if we use this package https://github.com/jshttp/statuses to get an array of status codes in the form of numbers ?

7006 commented 3 years ago

I have updated pull request

arb commented 3 years ago

I'm very reluctant to add a new dependency, especially for something this small. I'm a little confused now around what problem or feature you're trying to solve for?