We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 24412bd commit 8e3cc4aCopy full SHA for 8e3cc4a
index.js
@@ -37,7 +37,7 @@ function extend(target, obj) {
37
assignSymbols(target, obj);
38
39
for (var key in obj) {
40
- if (key !== '__proto__' && hasOwn(obj, key)) {
+ if (isValidKey(key) && hasOwn(obj, key)) {
41
var val = obj[key];
42
if (isObject(val)) {
43
if (typeOf(target[key]) === 'undefined' && typeOf(val) === 'function') {
@@ -68,6 +68,14 @@ function hasOwn(obj, key) {
68
return Object.prototype.hasOwnProperty.call(obj, key);
69
}
70
71
+/**
72
+ * Returns true if the given `key` is a valid key that can be used for assigning properties.
73
+ */
74
+
75
+function isValidKey(key) {
76
+ return key !== '__proto__' && key !== 'constructor' && key !== 'prototype';
77
+}
78
79
/**
80
* Expose `assign`
81
*/
0 commit comments