You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

readme.md 733B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. # semver-truncate [![Build Status](https://travis-ci.org/sindresorhus/semver-truncate.svg?branch=master)](https://travis-ci.org/sindresorhus/semver-truncate)
  2. > Truncate a semver version: `1.2.3` → `1.2.0`
  3. ## Install
  4. ```
  5. $ npm install --save semver-truncate
  6. ```
  7. ## Usage
  8. ```js
  9. const semverTruncate = require('semver-truncate');
  10. semverTruncate('1.2.3-foo', 'patch');
  11. //=> '1.2.3'
  12. semverTruncate('1.2.3', 'minor');
  13. //=> '1.2.0'
  14. semverTruncate('1.2.3', 'major');
  15. //=> '1.0.0'
  16. ```
  17. ## API
  18. ### truncateSemver(version, type)
  19. #### version
  20. Type: `string`
  21. Semver version.
  22. #### type
  23. Type: `string`
  24. Values: `patch` `minor` `major`
  25. Version type to truncate to.
  26. ## License
  27. MIT © [Sindre Sorhus](https://sindresorhus.com)