$ npm install semver-truncate
Truncate a semver version:
1.2.3
→1.2.0
$ npm install semver-truncate
import semverTruncate from '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: 'patch' | 'minor' | 'major'
Version type to truncate to.
0.0.1
0.0.2
→ patch
© 2010 - cnpmjs.org x YWFE | Home | YWFE