GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — lib: extract validateString validator by maclover7 · Pull Request #22101 · nodejs/node

Conversation

@maclover7

@maclover7 maclover7 commented Aug 3, 2018

Copy link
Copy Markdown
Contributor

Pulls out a common argument validator to internal/validators

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows commit guidelines

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

bricss reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
@nodejs-github-bot

This comment has been minimized.

Sign in to view
@nodejs-github-bot nodejs-github-bot added the lib / src Issues and PRs involving general changes in the lib/ or src/ directories. label Aug 3, 2018
ghost
ghost reviewed Aug 3, 2018
View reviewed changes

@ghost ghost left a comment •
edited by ghost
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

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.

What about trying to create another new function called "isEmptyString" to check whether your string value is empty:

function isEmptyString (s){
   return (typeof s === 'string' && s.trim() === '');
}

Most of your functions requires a param value that isn't null or empty.
Maybe when both of the things meet, we can continue going on.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@maclover7

maclover7 commented Aug 3, 2018

Copy link
Copy Markdown
Contributor Author

Most of your functions requires a param value that isn't null or empty.

@Maledong Not sure if this is the case -- where do you see this check? I'd rather not add new validations in this PR, since that would be a semver-major change

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@joyeecheung

joyeecheung commented Aug 3, 2018 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

@Maledong Arguably s.trim() === '' is ERR_INVALID_ARG_VALUE and type of s !== 'string' is ERR_INVALID_ARG_TYPE so it may not make sense to mix the validations together. And yeah that'd be semver-major for a couple of APIs.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

joyeecheung
joyeecheung approved these changes Aug 3, 2018
View reviewed changes
@joyeecheung

joyeecheung commented Aug 3, 2018

Copy link
Copy Markdown
Member

CI: https://ci.nodejs.org/job/node-test-pull-request/16171/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

targos
targos approved these changes Aug 3, 2018
View reviewed changes
Comment thread lib/net.js Outdated

@targos targos Aug 3, 2018

Copy link
Copy Markdown
Member

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.

Name changed from "options.path" to "path". I'm on mobile so can't check which one is correct.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@lpinca lpinca Aug 3, 2018

Copy link
Copy Markdown
Member

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.

Technically both are valid.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@maclover7 maclover7 Aug 4, 2018

Copy link
Copy Markdown
Contributor Author

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.

I think changing the name was a mistake, but going to put this back to options.path instead of path to make sure this is definitely not semver-major :)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
trivikr
trivikr approved these changes Aug 3, 2018
View reviewed changes
cjihrig
cjihrig approved these changes Aug 3, 2018
View reviewed changes
apapirovski
apapirovski approved these changes Aug 3, 2018
View reviewed changes
lpinca
lpinca approved these changes Aug 3, 2018
View reviewed changes
jasnell
jasnell approved these changes Aug 3, 2018
View reviewed changes
@Trott

Trott commented Aug 4, 2018

Copy link
Copy Markdown
Member

CI again: https://ci.nodejs.org/job/node-test-pull-request/16182/

(Didn't use Resume Build because windows-fanned failed and Resume Build does not cooperate with windows-fanned.)

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@maclover7

maclover7 commented Aug 4, 2018

Copy link
Copy Markdown
Contributor Author

CI: https://ci.nodejs.org/job/node-test-pull-request/16197/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@maclover7

maclover7 commented Aug 7, 2018

Copy link
Copy Markdown
Contributor Author

updated @targos @lpinca PTAL

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

targos
targos approved these changes Aug 7, 2018
View reviewed changes
@lpinca

lpinca commented Aug 7, 2018

Copy link
Copy Markdown
Member

Still LGMT.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@maclover7
lib: extract validateString validator
fc8d944
Pulls out a common argument validator to `internal/validators`
@maclover7

maclover7 commented Aug 7, 2018

Copy link
Copy Markdown
Contributor Author

Landed in e570ae7, thank you for the reviews!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@maclover7 maclover7 closed this Aug 7, 2018
@maclover7
maclover7 deleted the jm-validatestring branch August 7, 2018 15:04
maclover7 added a commit that referenced this pull request Aug 7, 2018
@maclover7
lib: extract validateString validator
e570ae7
Pulls out a common argument validator to `internal/validators`

PR-URL: #22101
Reviewed-By: Joyee Cheung <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: Trivikram Kamat <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Anatoli Papirovski <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: James M Snell <[email protected]>
targos pushed a commit that referenced this pull request Aug 11, 2018
@maclover7 @targos
lib: extract validateString validator
193a048
Pulls out a common argument validator to `internal/validators`

PR-URL: #22101
Reviewed-By: Joyee Cheung <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: Trivikram Kamat <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Anatoli Papirovski <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: James M Snell <[email protected]>
@rvagg rvagg mentioned this pull request Aug 13, 2018
Release proposal: v10.9.0 #22295
Merged
This was referenced Aug 16, 2018
2018-08-15 Version 10.9.0 (Current) @rvagg beevelop/docker-android-nodejs#230
Closed
2018-08-15 Version 10.9.0 (Current) @rvagg beevelop/docker-nodejs#215
Closed
2018-08-15 Version 10.9.0 (Current) @rvagg beevelop/docker-android-nodejs#231
Closed
2018-08-15 Version 10.9.0 (Current) @rvagg beevelop/docker-nodejs#216
Closed
This was referenced Aug 16, 2018
2018-08-15 Version 10.9.0 (Current) @rvagg beevelop/docker-android-nodejs#232
Closed
2018-08-15 Version 10.9.0 (Current) @rvagg beevelop/docker-nodejs#217
Closed
2018-08-15 Version 10.9.0 (Current) @rvagg beevelop/docker-android-nodejs#233
Closed
2018-08-15 Version 10.9.0 (Current) @rvagg beevelop/docker-nodejs#218
Closed
2018-08-15 Version 10.9.0 (Current) @rvagg beevelop/docker-android-nodejs#234
Closed
2018-08-15 Version 10.9.0 (Current) @rvagg beevelop/docker-nodejs#219
Closed
@ZYSzys ZYSzys mentioned this pull request Dec 6, 2018
module: use validateString in modules/cjs #24863
Closed
2 tasks done
Trott pushed a commit to Trott/io.js that referenced this pull request Dec 9, 2018
@ZYSzys @Trott
module: use validateString in modules/cjs
4dc10ac
PR-URL: nodejs#24863
Refs: nodejs#22101
Reviewed-By: Richard Lau <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Trivikram Kamat <[email protected]>
@ZYSzys ZYSzys mentioned this pull request Dec 11, 2018
lib: refactor argument validation using validateString #24960
Closed
2 tasks done
Trott pushed a commit to Trott/io.js that referenced this pull request Dec 14, 2018
@ZYSzys @Trott
lib: refactor argument validation using validateString
a35bd62
PR-URL: nodejs#24960
Refs: nodejs#22101
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Richard Lau <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
BethGriggs pushed a commit that referenced this pull request Dec 17, 2018
@ZYSzys @BethGriggs
module: use validateString in modules/cjs
2a11e6a
PR-URL: #24863
Refs: #22101
Reviewed-By: Richard Lau <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Trivikram Kamat <[email protected]>
MylesBorins pushed a commit that referenced this pull request Dec 25, 2018
@ZYSzys @MylesBorins
lib: refactor argument validation using validateString
96bdd47
PR-URL: #24960
Refs: #22101
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Richard Lau <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
refack pushed a commit to refack/node that referenced this pull request Jan 14, 2019
@ZYSzys @refack
module: use validateString in modules/cjs
70adfe1
PR-URL: nodejs#24863
Refs: nodejs#22101
Reviewed-By: Richard Lau <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Trivikram Kamat <[email protected]>
refack pushed a commit to refack/node that referenced this pull request Jan 14, 2019
@ZYSzys @refack
lib: refactor argument validation using validateString
6033f5f
PR-URL: nodejs#24960
Refs: nodejs#22101
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Richard Lau <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
BethGriggs pushed a commit that referenced this pull request Feb 12, 2019
@ZYSzys @BethGriggs
module: use validateString in modules/cjs
229f901
PR-URL: #24863
Refs: #22101
Reviewed-By: Richard Lau <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Trivikram Kamat <[email protected]>
BethGriggs pushed a commit that referenced this pull request Feb 20, 2019
@ZYSzys @BethGriggs
module: use validateString in modules/cjs
153f501
PR-URL: #24863
Refs: #22101
Reviewed-By: Richard Lau <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Trivikram Kamat <[email protected]>
rvagg pushed a commit that referenced this pull request Feb 28, 2019
@ZYSzys @rvagg
module: use validateString in modules/cjs
6cede0c
PR-URL: #24863
Refs: #22101
Reviewed-By: Richard Lau <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Trivikram Kamat <[email protected]>
firass111 pushed a commit to firass111/Project_node1 that referenced this pull request Apr 16, 2025
@maclover7 @rvagg
lib: extract validateString validator
3f729aa
Pulls out a common argument validator to `internal/validators`

PR-URL: nodejs/node#22101
Reviewed-By: Joyee Cheung <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: Trivikram Kamat <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Anatoli Papirovski <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@jasnell jasnell jasnell approved these changes
@lpinca lpinca lpinca approved these changes
@cjihrig cjihrig cjihrig approved these changes
@joyeecheung joyeecheung joyeecheung approved these changes
@trivikr trivikr trivikr approved these changes
+3 more reviewers
@apapirovski apapirovski apapirovski approved these changes
@targos targos targos approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

lib / src Issues and PRs involving general changes in the lib/ or src/ directories.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

10 participants

@maclover7 @nodejs-github-bot @joyeecheung @Trott @lpinca @apapirovski @jasnell @targos @cjihrig @trivikr
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.