Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

move to TypeScript #72

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft

move to TypeScript #72

wants to merge 4 commits into from

Conversation

LitoMore
Copy link
Collaborator

@LitoMore LitoMore commented Feb 13, 2025

Changes

Some lines are theoretically unreachable (unless the regex pattern has a bug). For TypeScript to determine the type, I wrote a polite condition such as if (!r || !g || !b) return undefined and ignored its coverage.

Notable changes

  • Now all get and to function parameters will be clamped
  • Fix some issues with negative numbers
     colorString.to.hex(255, 10, 35, -1)
     //=> FF0A23-FF
     
     toHex(255, 10, 35, -1)
     //=> FF0A2300
    
     colorString.to.rgb(-255, -10, -35)
     //=> rgb(-255, -10, -35)
    
     toRgb(-255, -10, -35)
     //=> rgb(0, 0, 0)

@LitoMore LitoMore requested a review from Qix- February 13, 2025 00:32
@LitoMore LitoMore marked this pull request as draft February 14, 2025 12:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant