summaryrefslogtreecommitdiff
path: root/tools/eslint/node_modules/lodash/assign.js
diff options
context:
space:
mode:
authorsilverwind <me@silverwind.io>2016-04-09 14:11:01 +0200
committerJames M Snell <jasnell@gmail.com>2016-04-26 12:15:57 -0700
commit128f58255809c785d097ee98bb24dfb2b870a537 (patch)
treea9a8568c451de82ca10042c362abb0bd17d0ed89 /tools/eslint/node_modules/lodash/assign.js
parentd66d028edc2292955f4fce92516018524e66c664 (diff)
downloadnode-new-128f58255809c785d097ee98bb24dfb2b870a537.tar.gz
tools: update ESLint to 2.7.0
PR-URL: https://github.com/nodejs/node/pull/6132 Reviewed-By: Brian White <mscdex@mscdex.net> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: thefourtheye <thechargingvolcano@gmail.com>
Diffstat (limited to 'tools/eslint/node_modules/lodash/assign.js')
-rw-r--r--tools/eslint/node_modules/lodash/assign.js34
1 files changed, 29 insertions, 5 deletions
diff --git a/tools/eslint/node_modules/lodash/assign.js b/tools/eslint/node_modules/lodash/assign.js
index d766dd0c4a..281e8acf14 100644
--- a/tools/eslint/node_modules/lodash/assign.js
+++ b/tools/eslint/node_modules/lodash/assign.js
@@ -1,17 +1,33 @@
-var copyObject = require('./_copyObject'),
+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;
+
+/** Built-in value references. */
+var propertyIsEnumerable = objectProto.propertyIsEnumerable;
+
+/** Detect if properties shadowing those on `Object.prototype` are non-enumerable. */
+var nonEnumShadows = !propertyIsEnumerable.call({ 'valueOf': 1 }, 'valueOf');
+
/**
- * Assigns own enumerable properties of source objects to the destination
- * object. Source objects are applied from left to right. Subsequent sources
- * overwrite property assignments of previous sources.
+ * 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.
@@ -33,7 +49,15 @@ var copyObject = require('./_copyObject'),
* // => { 'a': 1, 'c': 3, 'e': 5 }
*/
var assign = createAssigner(function(object, source) {
- copyObject(source, keys(source), object);
+ if (nonEnumShadows || 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;