mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-05 01:17:50 +00:00
Added default value to _.result
This commit is contained in:
11
test/test.js
11
test/test.js
@@ -6600,6 +6600,17 @@
|
||||
|
||||
deepEqual(actual, expected);
|
||||
});
|
||||
|
||||
test('should return the default value if key is not found', 2, function() {
|
||||
var object = {
|
||||
'a': 1,
|
||||
'b': 2
|
||||
}
|
||||
|
||||
strictEqual(_.result(object, 'c', 3), 3);
|
||||
strictEqual(_.result(object, 'c'), undefined);
|
||||
});
|
||||
|
||||
}());
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
Reference in New Issue
Block a user