Skip to content

Commit

Permalink
fix: remove constructor from excluded properties
Browse files Browse the repository at this point in the history
  • Loading branch information
wdavidw committed Sep 21, 2021
1 parent 17a6d1a commit cf6af53
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 9 deletions.
7 changes: 5 additions & 2 deletions dist/mixme.cjs.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ function _typeof(obj) {
return _typeof(obj);
}

// Generated by CoffeeScript 2.5.1
// Generated by CoffeeScript 2.6.0
var _snake_case; exports.clone = void 0; exports.compare = void 0; exports.is_object = void 0; exports.is_object_literal = void 0; exports.merge = void 0; exports.mutate = void 0; exports.snake_case = void 0;

exports.merge = function merge() {
Expand Down Expand Up @@ -50,10 +50,13 @@ exports.mutate = function mutate() {
}

for (name in source) {
if (/__proto__|constructor|prototype|eval|function|\*|\+|;|\s|\(|\)|!/.test(name)) {
if (/__proto__|prototype/.test(name)) {
// See
// https://github.com/adaltas/node-mixme/issues/1
// https://github.com/adaltas/node-mixme/issues/2
// continue if /__proto__|constructor|prototype|eval|function|\*|\+|;|\s|\(|\)|!/.test name
// Unless proven wrong, I consider ok to copy any properties named eval
// or function, we are not executing those, only copying.
continue;
}

Expand Down
7 changes: 5 additions & 2 deletions dist/mixme.esm.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ function _typeof(obj) {
return _typeof(obj);
}

// Generated by CoffeeScript 2.5.1
// Generated by CoffeeScript 2.6.0
var _snake_case, _clone, _compare, is_object, is_object_literal, merge, _mutate, _snake_case2;

merge = function merge() {
Expand Down Expand Up @@ -46,10 +46,13 @@ _mutate = function mutate() {
}

for (name in source) {
if (/__proto__|constructor|prototype|eval|function|\*|\+|;|\s|\(|\)|!/.test(name)) {
if (/__proto__|prototype/.test(name)) {
// See
// https://github.com/adaltas/node-mixme/issues/1
// https://github.com/adaltas/node-mixme/issues/2
// continue if /__proto__|constructor|prototype|eval|function|\*|\+|;|\s|\(|\)|!/.test name
// Unless proven wrong, I consider ok to copy any properties named eval
// or function, we are not executing those, only copying.
continue;
}

Expand Down
7 changes: 5 additions & 2 deletions dist/mixme.umd.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
return _typeof(obj);
}

// Generated by CoffeeScript 2.5.1
// Generated by CoffeeScript 2.6.0
var _snake_case; exports.clone = void 0; exports.compare = void 0; exports.is_object = void 0; exports.is_object_literal = void 0; exports.merge = void 0; exports.mutate = void 0; exports.snake_case = void 0;

exports.merge = function merge() {
Expand Down Expand Up @@ -52,10 +52,13 @@
}

for (name in source) {
if (/__proto__|constructor|prototype|eval|function|\*|\+|;|\s|\(|\)|!/.test(name)) {
if (/__proto__|prototype/.test(name)) {
// See
// https://github.com/adaltas/node-mixme/issues/1
// https://github.com/adaltas/node-mixme/issues/2
// continue if /__proto__|constructor|prototype|eval|function|\*|\+|;|\s|\(|\)|!/.test name
// Unless proven wrong, I consider ok to copy any properties named eval
// or function, we are not executing those, only copying.
continue;
}

Expand Down
7 changes: 5 additions & 2 deletions lib/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/index.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ mutate = ->
# continue if /__proto__|constructor|prototype|eval|function|\*|\+|;|\s|\(|\)|!/.test name
# Unless proven wrong, I consider ok to copy any properties named eval
# or function, we are not executing those, only copying.
continue if /__proto__|constructor|prototype/.test name
continue if /__proto__|prototype/.test name
target[name] = mutate target[name], source[name]
else if Array.isArray source
target = for v in source
Expand Down

0 comments on commit cf6af53

Please sign in to comment.