Uh oh!
There was an error while loading. Please reload this page.
lib: improve validation utils and refactor vm argument validation - #31480
lib: improve validation utils and refactor vm argument validation#31480lundibundi wants to merge 2 commits into
Conversation
Add common validators: `validateArray`, `validateBoolean`, `validateObject` and appropriate tests.
| return contextOptions; | ||
| } | ||
| function isContext(object) { |
There was a problem hiding this comment.
This is not changed as currently, it skips Arrays to the _isContext function which in turn rejects them. If I use validateObject it would change the error message for Arrays passed to the isContext from expected to be vm.Context to expected to be an Object and since we have explicit tests for this case I decided to not change this for now.
nodejs-github-bot
commented
Jan 23, 2020
lundibundi
commented
Jan 29, 2020
ping @nodejs/vm @BridgeAR (I guess there is no proper group for this one too). |
nodejs-github-bot
commented
Feb 9, 2020
lundibundi
commented
Feb 9, 2020
Started another CI to make sure everything is fine, the previous one is quite old. |
Add common validators: `validateArray`, `validateBoolean`, `validateObject` and appropriate tests. PR-URL: #31480 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Gus Caplan <me@gus.host>
PR-URL: #31480 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Gus Caplan <me@gus.host>
lundibundi
commented
Feb 10, 2020
codebytere
commented
Feb 17, 2020
@lundibundi does this need to be backported to v13.x? it'll need manual if so. |
PR-URL: #31480 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Gus Caplan <me@gus.host>
MylesBorins
commented
Mar 10, 2020
was able to get this backported... must have been some new changes that landed that made this work. removing label |
Add common validators: `validateArray`, `validateBoolean`, `validateObject` and appropriate tests. PR-URL: #31480 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Gus Caplan <me@gus.host>
The first commit adds basic validation utilities like
validateArray,validateBoolean,validateObject.The second commit refactors
vm.jswith the new validators as an example. There are multiple places in the codebase where we manually validate objects and arrays which can be simplified withvalidators.js.Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passes//cc @nodejs/vm