Skip to content

Commit c09cbb3

Browse files
committed
isPlainObject: by pass prototype check in nw.js environments
- to make sure that plotly.js is compatible with async request handles (e.g. lash) - side effect: isPlainObject(new Constructor()) now returns true in nw.js
1 parent 5904af2 commit c09cbb3

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/lib/is_plain_object.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,15 @@
1111

1212
// more info: http://stackoverflow.com/questions/18531624/isplainobject-thing
1313
module.exports = function isPlainObject(obj) {
14+
15+
// We need to be a little less strict in the `imagetest` container because
16+
// of how async image requests are handled.
17+
//
18+
// N.B. isPlainObject(new Constructor()) will return true in `imagetest`
19+
if(window && window.process && window.process.versions) {
20+
return Object.prototype.toString.call(obj) === '[object Object]';
21+
}
22+
1423
return (
1524
Object.prototype.toString.call(obj) === '[object Object]' &&
1625
Object.getPrototypeOf(obj) === Object.prototype

0 commit comments

Comments
 (0)