Skip to content

[FEATURE] decrement/truncate #48

Description

@isaacs

Not pressing or urgent, but mostly for API symmetry, it'd be nice to have truncate/decrement functions.

  1. semver.truncate('1.2.3-foo', 'patch') == '1.2.3'
  2. semver.truncate('1.2.3', 'minor') == '1.2.0'
  3. semver.truncate('1.2.3', 'major') == '1.0.0'
  4. semver.dec('1.2.3-foo', 'patch') == '1.2.2'
  5. semver.dec('1.2.3', 'minor') == '1.1.0'
  6. semver.dec('1.2.3', 'major') == '0.0.0'

Re #46, but the use case presented there turned out to not require this functionality. It's still probably useful, though.

cc @ronkorving

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Enhancementnew feature or improvement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions