Skip to content

Commit e26eb02

Browse files
minore codestyle fixes
1 parent ee97962 commit e26eb02

File tree

1 file changed

+9
-14
lines changed

1 file changed

+9
-14
lines changed

src/plots/cartesian/axes.js

+9-14
Original file line numberDiff line numberDiff line change
@@ -2652,25 +2652,20 @@ axes.drawOne = function(gd, ax, opts) {
26522652
function filterPush(push, automargin) {
26532653
if(!push) return push;
26542654

2655-
var keepMargin = [];
2656-
2657-
Object.keys(MARGIN_MAPPING).forEach(function(key) {
2658-
if(automargin.indexOf(key) !== -1) {
2659-
MARGIN_MAPPING[key].forEach(function(item) {
2660-
keepMargin.push(item);
2661-
});
2655+
var keepMargin = Object.keys(MARGIN_MAPPING).reduce(function(data, nextKey) {
2656+
if(automargin.indexOf(nextKey) !== -1) {
2657+
MARGIN_MAPPING[nextKey].forEach(function(key) { data[key] = 1;});
26622658
}
2663-
});
2659+
return data;
2660+
}, {});
26642661

26652662
Object.keys(push).forEach(function(key) {
2666-
if(keepMargin.indexOf(key) === -1) {
2667-
if(key.length === 1) {
2668-
push[key] = 0;
2669-
} else {
2670-
delete push[key];
2671-
}
2663+
if(!keepMargin[key]) {
2664+
if(key.length === 1) push[key] = 0;
2665+
else delete push[key];
26722666
}
26732667
});
2668+
26742669
return push;
26752670
}
26762671

0 commit comments

Comments
 (0)