diff --git a/.travis.yml b/.travis.yml index b41bd9f..ea3ec10 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,4 +17,5 @@ node_js: matrix: fast_finish: true allow_failures: + - node_js: 'node' - node_js: '0.8' diff --git a/index.js b/index.js index 16b4690..08db87a 100644 --- a/index.js +++ b/index.js @@ -32,7 +32,7 @@ module.exports = function mergeDeep(orig, objects) { function merge(target, obj) { for (var key in obj) { - if (key === '__proto__' || !hasOwn(obj, key)) { + if (!isValidKey(key) || !hasOwn(obj, key)) { continue; } @@ -57,3 +57,7 @@ function hasOwn(obj, key) { function isObject(val) { return typeOf(val) === 'object' || typeOf(val) === 'function'; } + +function isValidKey(key) { + return key !== '__proto__' && key !== 'constructor' && key !== 'prototype'; +} \ No newline at end of file