mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-03 00:27: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);
|
||||
});
|
||||
|
||||
test('should handle empty paths', 2, function() {
|
||||
strictEqual(_.get({}, ''), undefined);
|
||||
strictEqual(_.get({ '': 3 }, ''), 3);
|
||||
});
|
||||
|
||||
test('should return `undefined` when `object` is nullish', 2, function() {
|
||||
strictEqual(_.get(null, 'a'), undefined);
|
||||
strictEqual(_.get(undefined, 'a'), undefined);
|
||||
|
||||
Reference in New Issue
Block a user