Skip to content

Commit aa8fb3d

Browse files
minore codestyle fixes
1 parent ee97962 commit aa8fb3d

File tree

1 file changed

+7
-14
lines changed

1 file changed

+7
-14
lines changed

Diff for: src/plots/cartesian/axes.js

+7-14
Original file line numberDiff line numberDiff line change
@@ -2652,25 +2652,18 @@ 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-
});
2662-
}
2663-
});
2655+
var keepMargin = Object.keys(MARGIN_MAPPING).reduce(function(data, nextKey) {
2656+
if(automargin.indexOf(nextKey) === -1) return data;
2657+
return data.concat(MARGIN_MAPPING[nextKey]);
2658+
}, []);
26642659

26652660
Object.keys(push).forEach(function(key) {
26662661
if(keepMargin.indexOf(key) === -1) {
2667-
if(key.length === 1) {
2668-
push[key] = 0;
2669-
} else {
2670-
delete push[key];
2671-
}
2662+
if(key.length === 1) push[key] = 0;
2663+
else delete push[key];
26722664
}
26732665
});
2666+
26742667
return push;
26752668
}
26762669

0 commit comments

Comments
 (0)