Sha256: e97ed43f77aac5c8faa3689ab3620360ba3c51e422f419bf04093385caedef2d

Contents?: true

Size: 1.53 KB

Versions: 264

Compression:

Stored size: 1.53 KB

Contents

var assignValue = require('./_assignValue'),
    copyObject = require('./_copyObject'),
    createAssigner = require('./_createAssigner'),
    isArrayLike = require('./isArrayLike'),
    isPrototype = require('./_isPrototype'),
    keys = require('./keys');

/** Used for built-in method references. */
var objectProto = Object.prototype;

/** Used to check objects for own properties. */
var hasOwnProperty = objectProto.hasOwnProperty;

/**
 * Assigns own enumerable string keyed properties of source objects to the
 * destination object. Source objects are applied from left to right.
 * Subsequent sources overwrite property assignments of previous sources.
 *
 * **Note:** This method mutates `object` and is loosely based on
 * [`Object.assign`](https://mdn.io/Object/assign).
 *
 * @static
 * @memberOf _
 * @since 0.10.0
 * @category Object
 * @param {Object} object The destination object.
 * @param {...Object} [sources] The source objects.
 * @returns {Object} Returns `object`.
 * @see _.assignIn
 * @example
 *
 * function Foo() {
 *   this.a = 1;
 * }
 *
 * function Bar() {
 *   this.c = 3;
 * }
 *
 * Foo.prototype.b = 2;
 * Bar.prototype.d = 4;
 *
 * _.assign({ 'a': 0 }, new Foo, new Bar);
 * // => { 'a': 1, 'c': 3 }
 */
var assign = createAssigner(function(object, source) {
  if (isPrototype(source) || isArrayLike(source)) {
    copyObject(source, keys(source), object);
    return;
  }
  for (var key in source) {
    if (hasOwnProperty.call(source, key)) {
      assignValue(object, key, source[key]);
    }
  }
});

module.exports = assign;

Version data entries

264 entries across 262 versions & 29 rubygems

Version Path
appmap-0.71.0 ./node_modules/lodash/assign.js
disco_app-0.16.1 test/dummy/node_modules/lodash/assign.js
appmap-0.70.2 ./node_modules/lodash/assign.js
sumomo-0.8.14 data/sumomo/api_modules/node_modules/lodash/assign.js
appmap-0.70.1 ./node_modules/lodash/assign.js
appmap-0.70.0 ./node_modules/lodash/assign.js
appmap-0.69.0 ./node_modules/lodash/assign.js
sumomo-0.8.13 data/sumomo/api_modules/node_modules/lodash/assign.js
appmap-0.68.2 ./node_modules/lodash/assign.js
appmap-0.68.1 ./node_modules/lodash/assign.js
disco_app-0.15.2 test/dummy/node_modules/lodash/assign.js
appmap-0.68.0 ./node_modules/lodash/assign.js
appmap-0.67.1 ./node_modules/lodash/assign.js
trusty-cms-5.0.3 node_modules/lodash/assign.js
trusty-cms-5.0.2 node_modules/lodash/assign.js
appmap-0.67.0 ./node_modules/lodash/assign.js
disco_app-0.18.4 test/dummy/node_modules/lodash/assign.js
disco_app-0.18.1 test/dummy/node_modules/lodash/assign.js
disco_app-0.12.7.pre.puma.pre.3 test/dummy/node_modules/lodash/assign.js
disco_app-0.14.0 test/dummy/node_modules/lodash/assign.js