Truncate a semver version:
1.2.3
→1.2.0
$ npm install --save semver-truncate
const semverTruncate = require('semver-truncate');
semverTruncate('1.2.3-foo', 'patch');
//=> '1.2.3'
semverTruncate('1.2.3', 'minor');
//=> '1.2.0'
semverTruncate('1.2.3', 'major');
//=> '1.0.0'
Type: string
Semver version.
Type: string
Values: patch
minor
major
Version type to truncate to.
MIT © Sindre Sorhus
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.