Add _.get test for empty paths.

This commit is contained in:
jdalton
2015-04-05 08:38:51 -05:00
parent a6f3e0b6af
commit 81c24a8478

View File

@@ -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);