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 f3795742
authored
Sep 09, 2014
by
José Moreira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Instance.get: Patch
1 parent
5acd3542
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
5 deletions
lib/instance.js
test/dao.test.js
lib/instance.js
View file @
f379574
...
@@ -182,10 +182,12 @@ module.exports = (function() {
...
@@ -182,10 +182,12 @@ module.exports = (function() {
if
(
options
&&
options
.
plain
&&
this
.
options
.
include
&&
this
.
options
.
includeNames
.
indexOf
(
key
)
!==
-
1
)
{
if
(
options
&&
options
.
plain
&&
this
.
options
.
include
&&
this
.
options
.
includeNames
.
indexOf
(
key
)
!==
-
1
)
{
if
(
Array
.
isArray
(
this
.
dataValues
[
key
]))
{
if
(
Array
.
isArray
(
this
.
dataValues
[
key
]))
{
return
this
.
dataValues
[
key
].
map
(
function
(
instance
)
{
return
this
.
dataValues
[
key
].
map
(
function
(
instance
)
{
return
instance
.
get
({
plain
:
options
.
plain
})
;
return
instance
instanceof
Instance
?
instance
.
get
({
plain
:
options
.
plain
})
:
instance
;
});
});
}
else
{
}
else
if
(
this
.
dataValues
[
key
]
instanceof
Instance
)
{
return
this
.
dataValues
[
key
].
get
({
plain
:
options
.
plain
});
return
this
.
dataValues
[
key
].
get
({
plain
:
options
.
plain
});
}
else
{
return
this
.
dataValues
[
key
];
}
}
}
}
return
this
.
dataValues
[
key
];
return
this
.
dataValues
[
key
];
...
@@ -208,10 +210,12 @@ module.exports = (function() {
...
@@ -208,10 +210,12 @@ module.exports = (function() {
if
(
options
&&
options
.
plain
&&
this
.
options
.
include
&&
this
.
options
.
includeNames
.
indexOf
(
_key
)
!==
-
1
)
{
if
(
options
&&
options
.
plain
&&
this
.
options
.
include
&&
this
.
options
.
includeNames
.
indexOf
(
_key
)
!==
-
1
)
{
if
(
Array
.
isArray
(
this
.
dataValues
[
_key
]))
{
if
(
Array
.
isArray
(
this
.
dataValues
[
_key
]))
{
values
[
_key
]
=
this
.
dataValues
[
_key
].
map
(
function
(
instance
)
{
values
[
_key
]
=
this
.
dataValues
[
_key
].
map
(
function
(
instance
)
{
return
instance
.
get
({
plain
:
options
.
plain
})
;
return
instance
instanceof
Instance
?
instance
.
get
({
plain
:
options
.
plain
})
:
instance
;
});
});
}
else
{
}
else
if
(
this
.
dataValues
[
_key
]
instanceof
Instance
)
{
values
[
_key
]
=
this
.
dataValues
[
_key
].
get
({
plain
:
options
.
plain
});
values
[
_key
]
=
this
.
dataValues
[
_key
].
get
({
plain
:
options
.
plain
});
}
else
{
values
[
_key
]
=
this
.
dataValues
[
_key
];
}
}
}
else
{
}
else
{
values
[
_key
]
=
this
.
dataValues
[
_key
];
values
[
_key
]
=
this
.
dataValues
[
_key
];
...
...
test/dao.test.js
View file @
f379574
...
@@ -1200,7 +1200,7 @@ describe(Support.getTestDialectTeaser("DAO"), function () {
...
@@ -1200,7 +1200,7 @@ describe(Support.getTestDialectTeaser("DAO"), function () {
})
})
})
})
it
.
only
(
'dont return instance that is not defined'
,
function
(
done
)
{
it
(
'dont return instance that is not defined'
,
function
(
done
)
{
var
self
=
this
;
var
self
=
this
;
self
.
Project
.
create
({
lovelyUserId
:
null
})
self
.
Project
.
create
({
lovelyUserId
:
null
})
...
...
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