Skip to content

Commit e1f6818

Browse files
committed
enfore isPlainObject in src files
1 parent c09cbb3 commit e1f6818

File tree

5 files changed

+11
-14
lines changed

5 files changed

+11
-14
lines changed

src/components/colorbar/has_colorbar.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,9 @@
99

1010
'use strict';
1111

12+
var Lib = require('../../lib');
13+
1214

1315
module.exports = function hasColorbar(container) {
14-
return (
15-
typeof container.colorbar === 'object' &&
16-
container.colorbar !== null
17-
);
16+
return Lib.isPlainObject(container.colorbar);
1817
};

src/components/colorscale/has_colorscale.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,12 @@ module.exports = function hasColorscale(trace, containerStr) {
3333
}
3434

3535
return (
36-
(typeof container === 'object' && container !== null) && (
36+
Lib.isPlainObject(container) && (
3737
isArrayWithOneNumber ||
3838
container.showscale === true ||
3939
(isNumeric(container.cmin) && isNumeric(container.cmax)) ||
4040
isValidScale(container.colorscale) ||
41-
(typeof container.colorbar === 'object' && container.colorbar !== null)
41+
Lib.isPlainObject(container.colorbar)
4242
)
4343
);
4444
};

src/components/rangeslider/defaults.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,9 @@ var attributes = require('./attributes');
1313

1414

1515
module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, axName, counterAxes) {
16-
1716
if(!layoutIn[axName].rangeslider) return;
1817

19-
var containerIn = typeof layoutIn[axName].rangeslider === 'object' ?
18+
var containerIn = Lib.isPlainObject(layoutIn[axName].rangeslider) ?
2019
layoutIn[axName].rangeslider : {},
2120
containerOut = layoutOut[axName].rangeslider = {};
2221

src/plots/mapbox/layers.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,11 +131,8 @@ proto.dispose = function dispose() {
131131
function isVisible(opts) {
132132
var source = opts.source;
133133

134-
// For some weird reason Lib.isPlainObject fails
135-
// to detect `source` as a plain object in nw.js 0.12.
136-
137134
return (
138-
typeof source === 'object' ||
135+
Lib.isPlainObject(source) ||
139136
(typeof source === 'string' && source.length > 0)
140137
);
141138
}

src/traces/scatter/subtypes.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99

1010
'use strict';
1111

12+
var Lib = require('../../lib');
13+
1214
module.exports = {
1315
hasLines: function(trace) {
1416
return trace.visible && trace.mode &&
@@ -26,7 +28,7 @@ module.exports = {
2628
},
2729

2830
isBubble: function(trace) {
29-
return (typeof trace.marker === 'object' &&
30-
Array.isArray(trace.marker.size));
31+
return Lib.isPlainObject(trace.marker) &&
32+
Array.isArray(trace.marker.size);
3133
}
3234
};

0 commit comments

Comments
 (0)