From 3c388c76c6eb39d1170dca0f69a070654b88f760 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Fri, 24 Jul 2015 08:36:42 -0700 Subject: [PATCH] Add to docs of `_.assignWith` and `_.setWith`. [ci skip] --- lodash.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/lodash.js b/lodash.js index 5acbff92c..19145c072 100644 --- a/lodash.js +++ b/lodash.js @@ -8498,7 +8498,8 @@ /** * This method is like `_.assign` except that it accepts `customizer` which - * is invoked to produce the assigned values. The `customizer` is invoked + * is invoked to produce the assigned values. If `customizer` returns `undefined` + * assignment is handled by the method instead. The `customizer` is invoked * with five arguments: (objectValue, sourceValue, key, object, source). * * **Note:** This method mutates `object`. @@ -9418,8 +9419,9 @@ /** * This method is like `_.set` except that it accepts `customizer` which - * is invoked to produce the namespace objects of `path`. The `customizer` - * is invoked with three arguments: (nsValue, key, nsObject). + * is invoked to produce the namespace objects of `path`. If `customizer` + * returns `undefined` namespace creation is handled by the method instead. + * The `customizer` is invoked with three arguments: (nsValue, key, nsObject). * * @static * @memberOf _ @@ -9431,7 +9433,9 @@ * @returns {Object} Returns `object`. * @example * - * _.setWith({}, '[0][1][2]', 3, Object); + * _.setWith({ '0': {} }, '[0][1][2]', 3, function(value) { + * return _.isObject(value) ? value : {}; + * }); * // => { '0': { '1': { '2': 3 } } } */ function setWith(object, path, value, customizer) {