-
Notifications
You must be signed in to change notification settings - Fork 70
Validate all the things #10
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
Conversation
if (typeof channel !== "string" || channel === "") { | ||
throw new Error("Invalid channel name: '" + channel + "'"); | ||
} | ||
validateSocketId(socketId); |
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.
Could we please have some test cases for validating the socket_id?
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.
Done.
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.
👍
} | ||
|
||
var validateSocketId = function(socketId) { | ||
if (typeof socketId !== "string" || socketId === "" || !socketId.match(/^\d+\.\d+$/)) { |
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.
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.
\A
and \Z
aren't valid in JS. ^
and $
work the same, except in multiline mode. I have checked this.
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.
👍
e55e9b1
to
731c0c8
Compare
Validate all the things
No description provided.