We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7067951 commit ac30336Copy full SHA for ac30336
Conversions/RgbHslConversion.js
@@ -15,16 +15,7 @@
15
* // result = [193, 66, 28]
16
*/
17
18
-const checkRgbFormat = (colorRgb) => {
19
- if (colorRgb[0] <= 255 && colorRgb[0] >= 0) {
20
- if (colorRgb[1] <= 255 && colorRgb[1] >= 0) {
21
- if (colorRgb[2] <= 255 && colorRgb[2] >= 0) {
22
- return true
23
- }
24
25
26
- return false
27
-}
+const checkRgbFormat = (colorRgb) => colorRgb.every(c => c >= 0 && c <= 255);
28
29
const rgbToHsl = (colorRgb) => {
30
if (checkRgbFormat(colorRgb) === false) {
@@ -91,4 +82,4 @@ const rgbToHsl = (colorRgb) => {
91
82
return colorHsl
92
83
}
93
84
94
-export { rgbToHsl }
85
+export { rgbToHsl }
0 commit comments