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 2067d2cb
authored
Apr 18, 2015
by
Ruben Bridgewater
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use stricter object comparison (check for !== null)
1 parent
ee509090
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
7 additions
and
7 deletions
lib/instance.js
lib/model.js
lib/sql-string.js
lib/utils.js
lib/instance.js
View file @
2067d2c
...
...
@@ -265,7 +265,7 @@ module.exports = (function() {
,
i
,
length
;
if
(
typeof
key
===
'object'
)
{
if
(
typeof
key
===
'object'
&&
key
!==
null
)
{
values
=
key
;
options
=
value
||
{};
...
...
lib/model.js
View file @
2067d2c
...
...
@@ -537,7 +537,7 @@ module.exports = (function() {
self
.
scoped
=
true
;
// Set defaults
scopeOptions
=
(
typeof
lastArg
===
'object'
&&
!
Array
.
isArray
(
lastArg
)
?
lastArg
:
{})
||
{};
// <-- for no arguments
scopeOptions
=
(
typeof
lastArg
===
'object'
&&
!
Array
.
isArray
(
lastArg
)
&&
lastArg
!==
null
?
lastArg
:
{})
||
{};
// <-- for no arguments
scopeOptions
.
silent
=
(
scopeOptions
!==
null
&&
scopeOptions
.
hasOwnProperty
(
'silent'
)
?
scopeOptions
.
silent
:
true
);
// Clear out any predefined scopes...
...
...
lib/sql-string.js
View file @
2067d2c
...
...
@@ -31,14 +31,14 @@ SqlString.escapeId = function(val, forbidQualified) {
};
SqlString
.
escape
=
function
(
val
,
stringifyObjects
,
timeZone
,
dialect
,
field
)
{
if
(
arguments
.
length
===
1
&&
typeof
arguments
[
0
]
===
'object'
)
{
if
(
arguments
.
length
===
1
&&
typeof
val
===
'object'
&&
val
!==
null
)
{
val
=
val
.
val
||
val
.
value
||
null
;
stringifyObjects
=
val
.
stringifyObjects
||
val
.
objects
||
undefined
;
timeZone
=
val
.
timeZone
||
val
.
zone
||
null
;
dialect
=
val
.
dialect
||
null
;
field
=
val
.
field
||
null
;
}
else
if
(
arguments
.
length
<
3
&&
typeof
arguments
[
1
]
===
'object'
)
{
else
if
(
arguments
.
length
===
2
&&
typeof
stringifyObjects
===
'object'
&&
stringifyObjects
!==
null
)
{
timeZone
=
stringifyObjects
.
timeZone
||
stringifyObjects
.
zone
||
null
;
dialect
=
stringifyObjects
.
dialect
||
null
;
field
=
stringifyObjects
.
field
||
null
;
...
...
@@ -73,7 +73,7 @@ SqlString.escape = function(val, stringifyObjects, timeZone, dialect, field) {
return
SqlString
.
arrayToList
(
val
,
timeZone
,
dialect
,
field
);
}
if
(
typeof
val
===
'object'
)
{
if
(
typeof
val
===
'object'
&&
val
!==
null
)
{
if
(
stringifyObjects
)
{
val
=
val
.
toString
();
}
else
{
...
...
lib/utils.js
View file @
2067d2c
...
...
@@ -130,7 +130,7 @@ var Utils = module.exports = {
if
(
merge
===
true
&&
!!
scope
.
where
&&
!!
self
.
scopeObj
.
where
)
{
var
scopeKeys
=
Object
.
keys
(
scope
.
where
);
self
.
scopeObj
.
where
=
self
.
scopeObj
.
where
.
map
(
function
(
scopeObj
)
{
if
(
!
Array
.
isArray
(
scopeObj
)
&&
typeof
scopeObj
===
'object'
)
{
if
(
!
Array
.
isArray
(
scopeObj
)
&&
typeof
scopeObj
===
'object'
&&
scopeObj
!==
null
)
{
return
lodash
.
omit
.
apply
(
undefined
,
[
scopeObj
].
concat
(
scopeKeys
));
}
else
{
return
scopeObj
;
...
...
@@ -270,7 +270,7 @@ var Utils = module.exports = {
_where
.
_
.
bindings
=
_where
.
_
.
bindings
.
concat
(
values
);
}
}
else
if
(
typeof
where
===
'object'
)
{
else
if
(
typeof
where
===
'object'
&&
where
!==
null
)
{
// First iteration is trying to compress IN and NOT IN as much as possible...
// .. reason being is that WHERE username IN (?) AND username IN (?) != WHERE username IN (?,?)
Object
.
keys
(
where
).
forEach
(
function
(
i
)
{
...
...
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