Commit e1dc94f
committed
fix: rgbToHsl no longer mutates its input array
rgbToHsl aliased its argument with colorHsl = colorRgb instead of
copying it, then overwrote colorHsl in place and returned that same
array, destroying the caller's original RGB values. Copy the input
with [...colorRgb] instead, and add a regression test asserting the
input is left unchanged.1 parent 5c39e87 commit e1dc94f
2 files changed
Lines changed: 8 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
| 25 | + | |
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
43 | 50 | | |
0 commit comments