Skip to content

util/semver: make constraint parsing O(n log(n)) and fix some edge cases - #406

Open
calebbrown wants to merge 2 commits into
mainfrom
fix_npm_constraints
Open

calebbrown wants to merge 2 commits into
mainfrom
fix_npm_constraints

Conversation

@calebbrown

Copy link
Copy Markdown
Collaborator

No description provided.

@calebbrown calebbrown changed the title util/semver: make constraint parsing O(n) and fix some edge cases util/semver: make constraint parsing O(n log(n)) and fix some edge cases Oct 13, 2026
@calebbrown

Copy link
Copy Markdown
Collaborator Author

Code is now more legible and should have no regressions.

canon() is also technically O(n log n) because of the Sort within the function.

There are still quirks and weirdness in the code that can be improved.

The main legibility change is to spread canon out over 3 additional methods:

  • mergeNormalSpans
  • mergePrereleaseSpans
  • tryMergeSpan

@calebbrown
calebbrown requested a review from slugclub October 13, 2026 06:16
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.

2 participants