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 04f1e1f0
authored
Mar 24, 2015
by
Jan Aagaard Meier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix for isEmail validator in iojs / node 0.12
1 parent
5346495c
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
3 deletions
lib/instance-validator.js
lib/instance-validator.js
View file @
04f1e1f
...
...
@@ -219,6 +219,7 @@ InstanceValidator.prototype._builtinValidators = function() {
*/
InstanceValidator
.
prototype
.
_customValidators
=
function
()
{
var
validators
=
[];
var
self
=
this
;
Utils
.
_
.
each
(
this
.
modelInstance
.
__options
.
validate
,
function
(
validator
,
...
...
@@ -254,8 +255,9 @@ InstanceValidator.prototype._builtinAttrValidate = function(value, field) {
var
validators
=
[];
Utils
.
_
.
forIn
(
this
.
modelInstance
.
validators
[
field
],
function
(
test
,
validatorType
)
{
if
([
'isUrl'
,
'isURL'
].
indexOf
(
validatorType
)
!==
-
1
&&
test
===
true
)
{
// Preserve backwards compat. Validator.js now expects the second param to isURL to be an object
if
([
'isUrl'
,
'isURL'
,
'isEmail'
].
indexOf
(
validatorType
)
!==
-
1
&&
test
===
true
)
{
// Preserve backwards compat. Validator.js now expects the second param to isURL and isEmail to be an object
test
=
{};
}
...
...
@@ -328,7 +330,6 @@ InstanceValidator.prototype._invokeCustomValidator = Promise.method(function(val
* @private
*/
InstanceValidator
.
prototype
.
_invokeBuiltinValidator
=
Promise
.
method
(
function
(
value
,
test
,
validatorType
,
field
)
{
// check if Validator knows that kind of validation test
if
(
typeof
Validator
[
validatorType
]
!==
'function'
)
{
throw
new
Error
(
'Invalid validator function: '
+
validatorType
);
...
...
@@ -347,6 +348,7 @@ InstanceValidator.prototype._invokeBuiltinValidator = Promise.method(function(va
validatorArgs
=
validatorArgs
.
slice
(
0
);
}
validatorArgs
.
push
(
field
);
if
(
!
Validator
[
validatorType
].
apply
(
Validator
,
[
value
].
concat
(
validatorArgs
)))
{
throw
errorMessage
;
}
...
...
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