mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-12 03:47:50 +00:00
Add _.get test for empty paths.
This commit is contained in:
@@ -6033,6 +6033,11 @@
|
|||||||
strictEqual(_.get(object, 'a.b.c'), 3);
|
strictEqual(_.get(object, 'a.b.c'), 3);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('should handle empty paths', 2, function() {
|
||||||
|
strictEqual(_.get({}, ''), undefined);
|
||||||
|
strictEqual(_.get({ '': 3 }, ''), 3);
|
||||||
|
});
|
||||||
|
|
||||||
test('should return `undefined` when `object` is nullish', 2, function() {
|
test('should return `undefined` when `object` is nullish', 2, function() {
|
||||||
strictEqual(_.get(null, 'a'), undefined);
|
strictEqual(_.get(null, 'a'), undefined);
|
||||||
strictEqual(_.get(undefined, 'a'), undefined);
|
strictEqual(_.get(undefined, 'a'), undefined);
|
||||||
|
|||||||
Reference in New Issue
Block a user