Skip to content

Commit 2d8ed7f

Browse files
committed
make makeComputeError more readable
1 parent 007b8d1 commit 2d8ed7f

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

src/components/errorbars/compute_error.js

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,30 +33,36 @@ module.exports = function makeComputeError(opts) {
3333
var array = opts.array,
3434
arrayminus = opts.arrayminus;
3535

36-
return (symmetric || arrayminus === undefined) ?
37-
function computeError(dataPt, index) {
36+
if(symmetric || arrayminus === undefined) {
37+
return function computeError(dataPt, index) {
3838
var val = +(array[index]);
3939
return [val, val];
40-
} :
41-
function computeError(dataPt, index) {
40+
};
41+
}
42+
else {
43+
return function computeError(dataPt, index) {
4244
return [+arrayminus[index], +array[index]];
4345
};
46+
}
4447
}
4548
else {
4649
var value = opts.value,
4750
valueminus = opts.valueminus;
4851

49-
return (symmetric || valueminus === undefined) ?
50-
function computeError(dataPt) {
52+
if(symmetric || valueminus === undefined) {
53+
return function computeError(dataPt) {
5154
var val = getErrorVal(type, dataPt, value);
5255
return [val, val];
53-
} :
54-
function computeError(dataPt) {
56+
};
57+
}
58+
else {
59+
return function computeError(dataPt) {
5560
return [
5661
getErrorVal(type, dataPt, valueminus),
5762
getErrorVal(type, dataPt, value)
5863
];
5964
};
65+
}
6066
}
6167
};
6268

0 commit comments

Comments
 (0)