forked from plotly/plotly.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathis_plain_object.js
More file actions
27 lines (22 loc) · 837 Bytes
/
Copy pathis_plain_object.js
File metadata and controls
27 lines (22 loc) · 837 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/**
* Copyright 2012-2016, Plotly, Inc.
* All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
'use strict';
// 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) === Object.prototype
);
};