plotly.js
Version:
The open source javascript graphing library that powers plotly
18 lines (15 loc) • 654 B
JavaScript
// more info: http://stackoverflow.com/questions/18531624/isplainobject-thing
module.exports = function isPlainObject(obj) {
// We need to be a little less strict in the `imagetest` container because
// of how async image requests are handled.
//
// N.B. isPlainObject(new Constructor()) will return true in `imagetest`
if(window && window.process && window.process.versions) {
return Object.prototype.toString.call(obj) === '[object Object]';
}
return (
Object.prototype.toString.call(obj) === '[object Object]' &&
Object.getPrototypeOf(obj).hasOwnProperty('hasOwnProperty')
);
};
;