Sha256: e4a0faeda8f2e830fdbfaf9179286e62dc0863e0c6a9759c04a062ccab6f4382

Contents?: true

Size: 1.05 KB

Versions: 303

Compression:

Stored size: 1.05 KB

Contents

var baseUpdate = require('./_baseUpdate'),
    castFunction = require('./_castFunction');

/**
 * This method is like `_.set` except that accepts `updater` to produce the
 * value to set. Use `_.updateWith` to customize `path` creation. The `updater`
 * is invoked with one argument: (value).
 *
 * **Note:** This method mutates `object`.
 *
 * @static
 * @memberOf _
 * @since 4.6.0
 * @category Object
 * @param {Object} object The object to modify.
 * @param {Array|string} path The path of the property to set.
 * @param {Function} updater The function to produce the updated value.
 * @returns {Object} Returns `object`.
 * @example
 *
 * var object = { 'a': [{ 'b': { 'c': 3 } }] };
 *
 * _.update(object, 'a[0].b.c', function(n) { return n * n; });
 * console.log(object.a[0].b.c);
 * // => 9
 *
 * _.update(object, 'x[0].y.z', function(n) { return n ? n + 1 : 0; });
 * console.log(object.x[0].y.z);
 * // => 0
 */
function update(object, path, updater) {
  return object == null ? object : baseUpdate(object, path, castFunction(updater));
}

module.exports = update;

Version data entries

303 entries across 279 versions & 33 rubygems

Version Path
rapid_stack-0.2.0 templates/frontend/node_modules/lodash/update.js
rapid_stack-0.1.1 templates/FrontEnd/node_modules/lodash/update.js
rapid_stack-0.1.0 templates/FrontEnd/node_modules/lodash/update.js
immosquare-cleaner-0.1.60 node_modules/lodash/update.js
immosquare-cleaner-0.1.59 node_modules/lodash/update.js
immosquare-cleaner-0.1.58 node_modules/lodash/update.js
immosquare-cleaner-0.1.57 node_modules/lodash/update.js
immosquare-cleaner-0.1.56 node_modules/lodash/update.js
immosquare-cleaner-0.1.55 node_modules/lodash/update.js
immosquare-cleaner-0.1.54 node_modules/lodash/update.js
immosquare-cleaner-0.1.53 node_modules/lodash/update.js
immosquare-cleaner-0.1.52 node_modules/lodash/update.js
trusty-cms-6.3.1 node_modules/lodash/update.js
immosquare-cleaner-0.1.51 node_modules/lodash/update.js
boring_generators-0.15.0 tmp/templates/app_template/node_modules/lodash/update.js
clapton-0.0.26 lib/clapton/javascripts/node_modules/lodash/update.js
clapton-0.0.25 lib/clapton/javascripts/node_modules/lodash/update.js
immosquare-cleaner-0.1.50 node_modules/lodash/update.js
clapton-0.0.24 lib/clapton/javascripts/node_modules/lodash/update.js
clapton-0.0.23 lib/clapton/javascripts/node_modules/lodash/update.js