Ensure _.get can return null values. [closes #1216]

This commit is contained in:
jdalton
2015-05-19 08:18:01 -07:00
parent 882d84f1e6
commit c6f8896826
2 changed files with 11 additions and 3 deletions

View File

@@ -2259,11 +2259,11 @@
if (pathKey !== undefined && pathKey in object) {
path = [pathKey];
}
var index = -1,
var index = 0,
length = path.length;
while (object != null && ++index < length) {
object = toObject(object)[path[index]];
while (object != null && index < length) {
object = toObject(object)[path[index++]];
}
return (index && index == length) ? object : undefined;
}