From e26eb02756885c1c078ded56d93c35150ec37f6f Mon Sep 17 00:00:00 2001 From: nickmelnikov82 Date: Fri, 27 May 2022 10:17:43 +0300 Subject: [PATCH] minore codestyle fixes --- src/plots/cartesian/axes.js | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/src/plots/cartesian/axes.js b/src/plots/cartesian/axes.js index 1eb470f8ce2..9bb7e8f3490 100644 --- a/src/plots/cartesian/axes.js +++ b/src/plots/cartesian/axes.js @@ -2652,25 +2652,20 @@ axes.drawOne = function(gd, ax, opts) { function filterPush(push, automargin) { if(!push) return push; - var keepMargin = []; - - Object.keys(MARGIN_MAPPING).forEach(function(key) { - if(automargin.indexOf(key) !== -1) { - MARGIN_MAPPING[key].forEach(function(item) { - keepMargin.push(item); - }); + var keepMargin = Object.keys(MARGIN_MAPPING).reduce(function(data, nextKey) { + if(automargin.indexOf(nextKey) !== -1) { + MARGIN_MAPPING[nextKey].forEach(function(key) { data[key] = 1;}); } - }); + return data; + }, {}); Object.keys(push).forEach(function(key) { - if(keepMargin.indexOf(key) === -1) { - if(key.length === 1) { - push[key] = 0; - } else { - delete push[key]; - } + if(!keepMargin[key]) { + if(key.length === 1) push[key] = 0; + else delete push[key]; } }); + return push; }