mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-09 18:37:50 +00:00
Add _.has tests for deep paths.
This commit is contained in:
12
test/test.js
12
test/test.js
@@ -6152,7 +6152,17 @@
|
|||||||
strictEqual(_.has(object, 'a'), true);
|
strictEqual(_.has(object, 'a'), true);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should not check for inherited properties', 1, function() {
|
test('should support deep paths', 1, function() {
|
||||||
|
var object = { 'a': { 'b': { 'c': 3 } } };
|
||||||
|
strictEqual(_.has(object, 'a.b.c'), true);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('should check for a key over a path', 1, function() {
|
||||||
|
var object = { 'a.b.c': 3, 'a': { 'b': {} } };
|
||||||
|
strictEqual(_.has(object, 'a.b.c'), true);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('should return `false` for inherited properties', 1, function() {
|
||||||
function Foo() {}
|
function Foo() {}
|
||||||
Foo.prototype.a = 1;
|
Foo.prototype.a = 1;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user