Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
public
/
sequelize
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
不要怂,就是干,撸起袖子干!
Commit 46c2f566
authored
Mar 16, 2016
by
Kyle Hotchkiss
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cast value as string to pass new Validator.js string requirement
1 parent
2693238a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
1 deletions
lib/instance-validator.js
lib/instance-validator.js
View file @
46c2f56
...
...
@@ -254,12 +254,14 @@ InstanceValidator.prototype._invokeCustomValidator = Promise.method(function(val
*/
InstanceValidator
.
prototype
.
_invokeBuiltinValidator
=
Promise
.
method
(
function
(
value
,
test
,
validatorType
,
field
)
{
var
self
=
this
;
// Cast value as string to pass new Validator.js string requirement
var
valueString
=
String
(
value
);
// check if Validator knows that kind of validation test
if
(
typeof
validator
[
validatorType
]
!==
'function'
)
{
throw
new
Error
(
'Invalid validator function: '
+
validatorType
);
}
var
validatorArgs
=
self
.
_extractValidatorArgs
(
test
,
validatorType
,
field
);
if
(
!
validator
[
validatorType
].
apply
(
validator
,
[
value
].
concat
(
validatorArgs
)))
{
if
(
!
validator
[
validatorType
].
apply
(
validator
,
[
value
String
].
concat
(
validatorArgs
)))
{
// extract the error msg
throw
new
Error
(
test
.
msg
||
'Validation '
+
validatorType
+
' failed'
);
}
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment