GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||
GeezerVison is showing github.com — feat: Add `truncate` function by pjohnmeyer · Pull Request #855 · npm/node-semver Conversation
|
|
FWIW: I don't have a stake in whether or not Also, I will note that |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
You could add some cases with prerelease and build to the fixtures, but LGTM 👍
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
This is great. I like the idea from @mbtools to add some prerelease+build fixtures. I'd like to see a test that verifies/catches the mutation i think happens.
orig = new SemVer('1.2.3-alpha+build') snapshot = { orig stuff } truncate(orig, 'major') org === snapshot truncate(orig, 'patch') // second call should start from the orig
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
| return null | ||
| } | ||
|
|
||
| const parsed = parse(version, options) |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
i think this returns the same instance of the SemVer class so you'll be mutating the caller's object.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Good point! I saw how inc does it and didn't understand why it didn't use parse -- now it makes sense.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Co-authored-by: Michael Smith <[email protected]>
@owlstronaut yeah I agree. I covered that functionality with the |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@mbtools I added some fixtures to address your concern. @owlstronaut I fixed the inadvertent mutation of input. Rather than add an explicit test for this, I used |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
This is excellent, thank you!
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
🤖 I have created a release *beep* *boop* --- ## [7.8.0](v7.7.4...v7.8.0) (2026-05-08) ### Features * [`0d0a0a2`](0d0a0a2) [#855](#855) Add `truncate` function (#855) (@pjohnmeyer, @owlstronaut) ### Bug Fixes * [`3905343`](3905343) [#859](#859) Warn when defaulting to --inc=patch in CLI (@pjohnmeyer) ### Documentation * [`c368af6`](c368af6) [#853](#853) fix typos in documentation (#853) (@ankitkumar572005) * [`37776c3`](37776c3) [#846](#846) fix BNF grammar to distinguish prerelease from build identifiers (#846) (@abhu85, @claude) ### Chores * [`9542e09`](9542e09) [#860](#860) template-oss-apply (@owlstronaut) * [`937bc2c`](937bc2c) [#860](#860) `[email protected]` (@owlstronaut) * [`6946fef`](6946fef) [#852](#852) bump @npmcli/template-oss from 4.29.0 to 4.30.0 (#852) (@dependabot[bot], @npm-cli-bot) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.