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 24fcc7a3
authored
Jul 31, 2015
by
Fräntz Miccoli
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixing string validation, it was failing when using `new String(someValue)`
1 parent
e11392e9
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
1 deletions
lib/data-types.js
test/unit/sql/data-types.test.js
lib/data-types.js
View file @
24fcc7a
...
@@ -83,7 +83,7 @@ STRING.prototype.toSql = function() {
...
@@ -83,7 +83,7 @@ STRING.prototype.toSql = function() {
return
'VARCHAR('
+
this
.
_length
+
')'
+
((
this
.
_binary
)
?
' BINARY'
:
''
);
return
'VARCHAR('
+
this
.
_length
+
')'
+
((
this
.
_binary
)
?
' BINARY'
:
''
);
};
};
STRING
.
prototype
.
validate
=
function
(
value
)
{
STRING
.
prototype
.
validate
=
function
(
value
)
{
if
(
typeof
value
!==
'string
'
)
{
if
(
Object
.
prototype
.
toString
.
call
(
myvar
)
!=
'[object String]
'
)
{
if
(
this
.
options
.
binary
)
{
if
(
this
.
options
.
binary
)
{
if
(
Buffer
.
isBuffer
(
value
))
{
if
(
Buffer
.
isBuffer
(
value
))
{
return
true
;
return
true
;
...
...
test/unit/sql/data-types.test.js
View file @
24fcc7a
...
@@ -63,6 +63,7 @@ suite(Support.getTestDialectTeaser('SQL'), function() {
...
@@ -63,6 +63,7 @@ suite(Support.getTestDialectTeaser('SQL'), function() {
var
type
=
DataTypes
.
STRING
();
var
type
=
DataTypes
.
STRING
();
expect
(
type
.
validate
(
'foobar'
)).
to
.
equal
(
true
);
expect
(
type
.
validate
(
'foobar'
)).
to
.
equal
(
true
);
expect
(
type
.
validate
(
new
String
(
'foobar'
))).
to
.
equal
(
true
);
});
});
});
});
});
});
...
...
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