mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-10 19:07:49 +00:00
Ensure _.has returns false for nested inherited properties. [closes #2073]
This commit is contained in:
14
lodash.js
14
lodash.js
@@ -5086,10 +5086,16 @@
|
||||
var result = hasFunc(object, path);
|
||||
if (!result && !isKey(path)) {
|
||||
path = baseCastPath(path);
|
||||
object = parent(object, path);
|
||||
if (object != null) {
|
||||
path = last(path);
|
||||
result = hasFunc(object, path);
|
||||
|
||||
var index = -1,
|
||||
length = path.length;
|
||||
|
||||
while (object != null && ++index < length) {
|
||||
var key = path[index];
|
||||
if (!(result = hasFunc(object, key))) {
|
||||
break;
|
||||
}
|
||||
object = object[key];
|
||||
}
|
||||
}
|
||||
var length = object ? object.length : undefined;
|
||||
|
||||
Reference in New Issue
Block a user