We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
plotly
Learn more about funding links in repositories.
Report abuse
There was an error while loading. Please reload this page.
1 parent ad8db59 commit 09ed024Copy full SHA for 09ed024
src/components/colorscale/is_valid_scale_array.js
@@ -13,10 +13,9 @@ var tinycolor = require('tinycolor2');
13
14
15
module.exports = function isValidScaleArray(scl) {
16
- var isValid = true,
17
- highestVal = 0;
+ var highestVal = 0;
18
19
- if(!Array.isArray(scl) || scl.length === 0) return false;
+ if(!Array.isArray(scl) || scl.length < 2) return false;
20
21
if(!scl[0] || !scl[scl.length - 1]) return false;
22
@@ -26,12 +25,11 @@ module.exports = function isValidScaleArray(scl) {
26
25
var si = scl[i];
27
28
if(si.length !== 2 || +si[0] < highestVal || !tinycolor(si[1]).isValid()) {
29
- isValid = false;
30
- break;
+ return false;
31
}
32
33
highestVal = +si[0];
34
35
36
- return isValid;
+ return true;
37
};
0 commit comments