feat(core): improve hex utils (#268)#391
Conversation
✅ Deploy Preview for apiccc ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for docsccc ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for appccc ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
🦋 Changeset detectedLatest commit: a32fb27 The changes in this PR will be included in the next version bump. This PR includes changesets to release 20 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
✅ Deploy Preview for liveccc ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
Pull request overview
This PR updates core hex/number utilities to introduce stricter hex validation, avoid unnecessary re-normalization when input hex is already normalized, and adjust numToHex’s behavior/documentation toward a “normalized” hex format.
Changes:
- Adds
isHex(unknown): v is Hexas a validator for (normalized) hex strings. - Updates
hexFromto return early when given an already-normalized hex string. - Updates
numToHexto add a non-negative guard and (currently) pad output to even-length hex.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| packages/core/src/num/index.ts | Changes numToHex semantics + JSDoc (non-negative guard; new normalization behavior). |
| packages/core/src/hex/index.ts | Adds isHex and uses it to fast-path hexFrom for already-normalized hex strings. |
| .changeset/shiny-ants-say.md | Declares a minor release for the hex utility behavior changes. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
* feat(core): `hexFrom` passthru normalized hex and `numToHex` enforce hex normalization * feat(core): improve `isHex` * feat(core): improve `isHex` parameter

Cherry-pick #268