silverbucket / silverbucket/setlist-roller
Bloat: hex helpers in utils.js share validate→parse pattern
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 1
- Forks
- 0
- Avg merge
- 8h 45m
- Merged PRs (30d)
- 20
Description
`src/lib/utils.js:129-153` — `hexToRgb`, `hexToRgba`, `darkenHex` each repeat the regex validation and per-channel parse. The recursive fallback (`return hexToRgb(DEFAULT_DIE_COLOR)`) makes them harder to read than they need to be.
Fix: extract `parseHex(hex) → [r,g,b] | null`, then write all three formatters as one-liners. Removes ~15 lines and the recursion.
(From comprehensive review, finding B2.)
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in src/lib/utils.js:129-153 and read hexToRgb, hexToRgba, and darkenHex together to compare their validation and channel parsing. Extract the shared parseHex(hex) behavior described in the issue, then verify that the three formatters preserve their existing results without the recursive fallback or repeated logic.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- web-dev
- Issue type
- Refactor
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 70/100