diff --git a/src/Interactable.js b/src/Interactable.js index c48593b11..7f6d2d6b9 100644 --- a/src/Interactable.js +++ b/src/Interactable.js @@ -59,7 +59,7 @@ class Interactable { actionOptions[optionName] = arr.from(optionValue); } // if the option value is an object - else if (!isArray && is.object(optionValue)) { + else if (!isArray && is.plainObject(optionValue)) { // copy the object actionOptions[optionName] = extend( actionOptions[optionName] || {}, diff --git a/src/utils/clone.js b/src/utils/clone.js index 4a4c80122..ce77da54d 100644 --- a/src/utils/clone.js +++ b/src/utils/clone.js @@ -3,7 +3,7 @@ const is = require('./is'); module.exports = function clone (source) { const dest = {}; for (const prop in source) { - if (is.object(source[prop])) { + if (is.plainObject(source[prop])) { dest[prop] = clone(source[prop]); } else { dest[prop] = source[prop]; diff --git a/src/utils/is.js b/src/utils/is.js index a6f02ae34..c4ebbb878 100644 --- a/src/utils/is.js +++ b/src/utils/is.js @@ -27,6 +27,8 @@ const is = { ? thing instanceof _window.Element //DOM2 : thing.nodeType === 1 && typeof thing.nodeName === 'string'); }, + + plainObject: thing => is.object(thing) && thing.constructor.name === 'Object', }; is.array = thing => (is.object(thing)