Socket
Socket
Sign inDemoInstall

lodash.assign

Package Overview
Dependencies
Maintainers
5
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lodash.assign - npm Package Compare versions

Comparing version 3.0.0 to 3.1.0

133

index.js
/**
* lodash 3.0.0 (Custom Build) <https://lodash.com/>
* lodash 3.1.0 (Custom Build) <https://lodash.com/>
* Build: `lodash modern modularize exports="npm" -o ./`
* Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/>
* Based on Underscore.js 1.7.0 <http://underscorejs.org/LICENSE>
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
* Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors

@@ -10,11 +10,104 @@ * Available under MIT license <https://lodash.com/license>

var baseAssign = require('lodash._baseassign'),
createAssigner = require('lodash._createassigner');
createAssigner = require('lodash._createassigner'),
isNative = require('lodash.isnative'),
keys = require('lodash.keys');
/** Used for native method references. */
var arrayProto = Array.prototype;
/** Native method references. */
var getOwnPropertySymbols = isNative(getOwnPropertySymbols = Object.getOwnPropertySymbols) && getOwnPropertySymbols,
push = arrayProto.push;
/**
* A specialized version of `_.assign` for customizing assigned values without
* support for argument juggling, multiple sources, and `this` binding `customizer`
* functions.
*
* @private
* @param {Object} object The destination object.
* @param {Object} source The source object.
* @param {Function} customizer The function to customize assigned values.
* @returns {Object} Returns `object`.
*/
function assignWith(object, source, customizer) {
var props = keys(source);
push.apply(props, getSymbols(source));
var index = -1,
length = props.length;
while (++index < length) {
var key = props[index],
value = object[key],
result = customizer(value, source[key], key, object, source);
if ((result === result ? (result !== value) : (value === value)) ||
(value === undefined && !(key in object))) {
object[key] = result;
}
}
return object;
}
/**
* Creates an array of the own symbols of `object`.
*
* @private
* @param {Object} object The object to query.
* @returns {Array} Returns the array of symbols.
*/
var getSymbols = !getOwnPropertySymbols ? constant([]) : function(object) {
return getOwnPropertySymbols(toObject(object));
};
/**
* Converts `value` to an object if it is not one.
*
* @private
* @param {*} value The value to process.
* @returns {Object} Returns the object.
*/
function toObject(value) {
return isObject(value) ? value : Object(value);
}
/**
* Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`.
* (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
*
* @static
* @memberOf _
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an object, else `false`.
* @example
*
* _.isObject({});
* // => true
*
* _.isObject([1, 2, 3]);
* // => true
*
* _.isObject(1);
* // => false
*/
function isObject(value) {
// Avoid a V8 JIT bug in Chrome 19-20.
// See https://code.google.com/p/v8/issues/detail?id=2291 for more details.
var type = typeof value;
return type == 'function' || (!!value && type == 'object');
}
/**
* Assigns own enumerable properties of source object(s) to the destination
* object. Subsequent sources overwrite property assignments of previous sources.
* If `customizer` is provided it is invoked to produce the assigned values.
* The `customizer` is bound to `thisArg` and invoked with five arguments;
* The `customizer` is bound to `thisArg` and invoked with five arguments:
* (objectValue, sourceValue, key, object, source).
*
* **Note:** This method mutates `object` and is based on
* [`Object.assign`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.assign).
*
*
* @static

@@ -26,3 +119,3 @@ * @memberOf _

* @param {...Object} [sources] The source objects.
* @param {Function} [customizer] The function to customize assigning values.
* @param {Function} [customizer] The function to customize assigned values.
* @param {*} [thisArg] The `this` binding of `customizer`.

@@ -37,3 +130,3 @@ * @returns {Object} Returns `object`.

* var defaults = _.partialRight(_.assign, function(value, other) {
* return typeof value == 'undefined' ? other : value;
* return _.isUndefined(value) ? other : value;
* });

@@ -44,4 +137,30 @@ *

*/
var assign = createAssigner(baseAssign);
var assign = createAssigner(function(object, source, customizer) {
return customizer
? assignWith(object, source, customizer)
: baseAssign(object, source);
});
/**
* Creates a function that returns `value`.
*
* @static
* @memberOf _
* @category Utility
* @param {*} value The value to return from the new function.
* @returns {Function} Returns the new function.
* @example
*
* var object = { 'user': 'fred' };
* var getter = _.constant(object);
*
* getter() === object;
* // => true
*/
function constant(value) {
return function() {
return value;
};
}
module.exports = assign;

2

LICENSE.txt
Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/>
Based on Underscore.js 1.7.0, copyright 2009-2015 Jeremy Ashkenas,
Based on Underscore.js, copyright 2009-2015 Jeremy Ashkenas,
DocumentCloud and Investigative Reporters & Editors <http://underscorejs.org/>

@@ -4,0 +4,0 @@

{
"name": "lodash.assign",
"version": "3.0.0",
"version": "3.1.0",
"description": "The modern build of lodash’s `_.assign` as a module.",

@@ -21,4 +21,6 @@ "homepage": "https://lodash.com/",

"lodash._baseassign": "^3.0.0",
"lodash._createassigner": "^3.0.0"
"lodash._createassigner": "^3.0.0",
"lodash.isnative": "^3.0.0",
"lodash.keys": "^3.0.0"
}
}

@@ -1,2 +0,2 @@

# lodash.assign v3.0.0
# lodash.assign v3.1.0

@@ -20,2 +20,2 @@ The [modern build](https://github.com/lodash/lodash/wiki/Build-Differences) of [lodash’s](https://lodash.com/) `_.assign` exported as a [Node.js](http://nodejs.org/)/[io.js](https://iojs.org/) module.

See the [documentation](https://lodash.com/docs#assign) or [package source](https://github.com/lodash/lodash/blob/3.0.0-npm-packages/lodash.assign) for more details.
See the [documentation](https://lodash.com/docs#assign) or [package source](https://github.com/lodash/lodash/blob/3.1.0-npm-packages/lodash.assign) for more details.
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc