Add _.setWith tests.

This commit is contained in:
John-David Dalton
2015-07-26 10:32:32 -07:00
parent f1597386ef
commit 48a6c4f2bf
2 changed files with 24 additions and 3 deletions

View File

@@ -9453,12 +9453,12 @@
* @returns {Object} Returns `object`.
* @example
*
* _.setWith({ '0': {} }, '[0][1][2]', 3, function(value) {
* _.setWith({ '0': { 'length': 2 } }, '[0][1][2]', 3, function(value) {
* if (!_.isObject(value)) {
* return {};
* }
* });
* // => { '0': { '1': { '2': 3 } } }
* // => { '0': { '1': { '2': 3 }, 'length': 2 } }
*/
function setWith(object, path, value, customizer) {
customizer = typeof customizer == 'function' ? customizer : undefined;