-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Have assertString.js provide the invalid type passed to validator. #895
Conversation
src/lib/util/assertString.js
Outdated
invalidType = `a ${invalidType}`; | ||
} | ||
} | ||
let message = 'This library (validator.js) validates strings only, '; |
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 the message just be this, to make it less verbose:
`Expected string but received ${invalidType}`
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.
...
Thanks for your contribution @DCtheTall 🎉 Please check my comments above. |
@profnandaa ready for another look when you can. |
Sure, will be on it in the morning. Thx
On Tue, Sep 25, 2018 at 1:47 AM Dylan Cutler ***@***.***> wrote:
@profnandaa <https://github.com/ProfNandaa> ready for another look when
you can.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#895 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAP8kWWMXAsRr1GfBn1Vl03F3oukVrajks5ueWEIgaJpZM4Ws8QD>
.
--
Sent from a tiny device while on the move.
|
@DCtheTall -- thanks for getting your first contribution in! 🎉 |
As discussed in issue #894 I thought it would be useful for
assertString.js
to provide which invalid type was used as an input.It checks explicitly for
null
, otherwise it will usetypeof input
. Iftypeof input === 'object'
it will use the object's constructor's name (since'object'
alone is rarely helpful), though if that seems like overkill I can take that out.