Skip to content

Commit b9fc12f

Browse files
committed
run formatter
1 parent 5714fe1 commit b9fc12f

File tree

1 file changed

+50
-50
lines changed

1 file changed

+50
-50
lines changed

src/components/fx/helpers.js

Lines changed: 50 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,19 @@ var Lib = require('../../lib');
44

55
// look for either subplot or xaxis and yaxis attributes
66
// does not handle splom case
7-
exports.getSubplot = function(trace) {
8-
return trace.subplot || (trace.xaxis + trace.yaxis) || trace.geo;
7+
exports.getSubplot = function (trace) {
8+
return trace.subplot || trace.xaxis + trace.yaxis || trace.geo;
99
};
1010

1111
// is trace in given list of subplots?
1212
// does handle splom case
13-
exports.isTraceInSubplots = function(trace, subplots) {
14-
if(trace.type === 'splom') {
13+
exports.isTraceInSubplots = function (trace, subplots) {
14+
if (trace.type === 'splom') {
1515
var xaxes = trace.xaxes || [];
1616
var yaxes = trace.yaxes || [];
17-
for(var i = 0; i < xaxes.length; i++) {
18-
for(var j = 0; j < yaxes.length; j++) {
19-
if(subplots.indexOf(xaxes[i] + yaxes[j]) !== -1) {
17+
for (var i = 0; i < xaxes.length; i++) {
18+
for (var j = 0; j < yaxes.length; j++) {
19+
if (subplots.indexOf(xaxes[i] + yaxes[j]) !== -1) {
2020
return true;
2121
}
2222
}
@@ -28,31 +28,31 @@ exports.isTraceInSubplots = function(trace, subplots) {
2828
};
2929

3030
// convenience functions for mapping all relevant axes
31-
exports.flat = function(subplots, v) {
31+
exports.flat = function (subplots, v) {
3232
var out = new Array(subplots.length);
33-
for(var i = 0; i < subplots.length; i++) {
33+
for (var i = 0; i < subplots.length; i++) {
3434
out[i] = v;
3535
}
3636
return out;
3737
};
3838

39-
exports.p2c = function(axArray, v) {
39+
exports.p2c = function (axArray, v) {
4040
var out = new Array(axArray.length);
41-
for(var i = 0; i < axArray.length; i++) {
41+
for (var i = 0; i < axArray.length; i++) {
4242
out[i] = axArray[i].p2c(v);
4343
}
4444
return out;
4545
};
4646

47-
exports.getDistanceFunction = function(mode, dx, dy, dxy) {
48-
if(mode === 'closest') return dxy || exports.quadrature(dx, dy);
47+
exports.getDistanceFunction = function (mode, dx, dy, dxy) {
48+
if (mode === 'closest') return dxy || exports.quadrature(dx, dy);
4949
return mode.charAt(0) === 'x' ? dx : dy;
5050
};
5151

52-
exports.getClosest = function(cd, distfn, pointData) {
52+
exports.getClosest = function (cd, distfn, pointData) {
5353
// do we already have a point number? (array mode only)
54-
if(pointData.index !== false) {
55-
if(pointData.index >= 0 && pointData.index < cd.length) {
54+
if (pointData.index !== false) {
55+
if (pointData.index >= 0 && pointData.index < cd.length) {
5656
pointData.distance = 0;
5757
} else pointData.index = false;
5858
} else {
@@ -64,10 +64,10 @@ exports.getClosest = function(cd, distfn, pointData) {
6464
// defined outside the for to improve the garbage collector performance
6565
var newDistance = Infinity;
6666
// the browser engine typically optimizes the length, but it is outside the cycle if it does not
67-
var len = cd.length
68-
for(var i = 0; i < len; i++) {
67+
var len = cd.length;
68+
for (var i = 0; i < len; i++) {
6969
newDistance = distfn(cd[i]);
70-
if(newDistance <= pointData.distance) {
70+
if (newDistance <= pointData.distance) {
7171
pointData.index = i;
7272
pointData.distance = newDistance;
7373
}
@@ -84,12 +84,12 @@ exports.getClosest = function(cd, distfn, pointData) {
8484
* @param {number} v1: signed difference between the current position and the right edge
8585
* @param {number} passVal: the value to return on success
8686
*/
87-
exports.inbox = function(v0, v1, passVal) {
88-
return (v0 * v1 < 0 || v0 === 0) ? passVal : Infinity;
87+
exports.inbox = function (v0, v1, passVal) {
88+
return v0 * v1 < 0 || v0 === 0 ? passVal : Infinity;
8989
};
9090

91-
exports.quadrature = function(dx, dy) {
92-
return function(di) {
91+
exports.quadrature = function (dx, dy) {
92+
return function (di) {
9393
var x = dx(di);
9494
var y = dy(di);
9595
return Math.sqrt(x * x + y * y);
@@ -111,7 +111,7 @@ exports.quadrature = function(dx, dy) {
111111
* @param {object} cd
112112
* @return {object}
113113
*/
114-
exports.makeEventData = function(pt, trace, cd) {
114+
exports.makeEventData = function (pt, trace, cd) {
115115
// hover uses 'index', select uses 'pointNumber'
116116
var pointNumber = 'index' in pt ? pt.index : pt.pointNumber;
117117

@@ -122,10 +122,10 @@ exports.makeEventData = function(pt, trace, cd) {
122122
pointNumber: pointNumber
123123
};
124124

125-
if(trace._indexToPoints) {
125+
if (trace._indexToPoints) {
126126
var pointIndices = trace._indexToPoints[pointNumber];
127127

128-
if(pointIndices.length === 1) {
128+
if (pointIndices.length === 1) {
129129
out.pointIndex = pointIndices[0];
130130
} else {
131131
out.pointIndices = pointIndices;
@@ -134,18 +134,18 @@ exports.makeEventData = function(pt, trace, cd) {
134134
out.pointIndex = pointNumber;
135135
}
136136

137-
if(trace._module.eventData) {
137+
if (trace._module.eventData) {
138138
out = trace._module.eventData(out, pt, trace, cd, pointNumber);
139139
} else {
140-
if('xVal' in pt) out.x = pt.xVal;
141-
else if('x' in pt) out.x = pt.x;
140+
if ('xVal' in pt) out.x = pt.xVal;
141+
else if ('x' in pt) out.x = pt.x;
142142

143-
if('yVal' in pt) out.y = pt.yVal;
144-
else if('y' in pt) out.y = pt.y;
143+
if ('yVal' in pt) out.y = pt.yVal;
144+
else if ('y' in pt) out.y = pt.y;
145145

146-
if(pt.xa) out.xaxis = pt.xa;
147-
if(pt.ya) out.yaxis = pt.ya;
148-
if(pt.zLabelVal !== undefined) out.z = pt.zLabelVal;
146+
if (pt.xa) out.xaxis = pt.xa;
147+
if (pt.ya) out.yaxis = pt.ya;
148+
if (pt.zLabelVal !== undefined) out.z = pt.zLabelVal;
149149
}
150150

151151
exports.appendArrayPointValue(out, trace, pointNumber);
@@ -160,22 +160,22 @@ exports.makeEventData = function(pt, trace, cd) {
160160
* @param {number|Array(number)} pointNumber : point number. May be a length-2 array
161161
* [row, col] to dig into 2D arrays
162162
*/
163-
exports.appendArrayPointValue = function(pointData, trace, pointNumber) {
163+
exports.appendArrayPointValue = function (pointData, trace, pointNumber) {
164164
var arrayAttrs = trace._arrayAttrs;
165165

166-
if(!arrayAttrs) {
166+
if (!arrayAttrs) {
167167
return;
168168
}
169169

170-
for(var i = 0; i < arrayAttrs.length; i++) {
170+
for (var i = 0; i < arrayAttrs.length; i++) {
171171
var astr = arrayAttrs[i];
172172
var key = getPointKey(astr);
173173

174-
if(pointData[key] === undefined) {
174+
if (pointData[key] === undefined) {
175175
var val = Lib.nestedProperty(trace, astr).get();
176176
var pointVal = getPointData(val, pointNumber);
177177

178-
if(pointVal !== undefined) pointData[key] = pointVal;
178+
if (pointVal !== undefined) pointData[key] = pointVal;
179179
}
180180
}
181181
};
@@ -190,22 +190,22 @@ exports.appendArrayPointValue = function(pointData, trace, pointNumber) {
190190
* @param {Array(number)|Array(Array(number))} pointNumbers : Array of point numbers.
191191
* Each entry in the array may itself be a length-2 array [row, col] to dig into 2D arrays
192192
*/
193-
exports.appendArrayMultiPointValues = function(pointData, trace, pointNumbers) {
193+
exports.appendArrayMultiPointValues = function (pointData, trace, pointNumbers) {
194194
var arrayAttrs = trace._arrayAttrs;
195195

196-
if(!arrayAttrs) {
196+
if (!arrayAttrs) {
197197
return;
198198
}
199199

200-
for(var i = 0; i < arrayAttrs.length; i++) {
200+
for (var i = 0; i < arrayAttrs.length; i++) {
201201
var astr = arrayAttrs[i];
202202
var key = getPointKey(astr);
203203

204-
if(pointData[key] === undefined) {
204+
if (pointData[key] === undefined) {
205205
var val = Lib.nestedProperty(trace, astr).get();
206206
var keyVal = new Array(pointNumbers.length);
207207

208-
for(var j = 0; j < pointNumbers.length; j++) {
208+
for (var j = 0; j < pointNumbers.length; j++) {
209209
keyVal[j] = getPointData(val, pointNumbers[j]);
210210
}
211211
pointData[key] = keyVal;
@@ -227,8 +227,8 @@ function getPointKey(astr) {
227227
}
228228

229229
function getPointData(val, pointNumber) {
230-
if(Array.isArray(pointNumber)) {
231-
if(Array.isArray(val) && Array.isArray(val[pointNumber[0]])) {
230+
if (Array.isArray(pointNumber)) {
231+
if (Array.isArray(val) && Array.isArray(val[pointNumber[0]])) {
232232
return val[pointNumber[0]][pointNumber[1]];
233233
}
234234
} else {
@@ -246,12 +246,12 @@ var unifiedHoverMode = {
246246
'y unified': true
247247
};
248248

249-
exports.isUnifiedHover = function(hovermode) {
250-
if(typeof hovermode !== 'string') return false;
249+
exports.isUnifiedHover = function (hovermode) {
250+
if (typeof hovermode !== 'string') return false;
251251
return !!unifiedHoverMode[hovermode];
252252
};
253253

254-
exports.isXYhover = function(hovermode) {
255-
if(typeof hovermode !== 'string') return false;
254+
exports.isXYhover = function (hovermode) {
255+
if (typeof hovermode !== 'string') return false;
256256
return !!xyHoverMode[hovermode];
257257
};

0 commit comments

Comments
 (0)