Initial commit
[yaffs-website] / node_modules / semver-truncate / readme.md
1 # semver-truncate [![Build Status](https://travis-ci.org/sindresorhus/semver-truncate.svg?branch=master)](https://travis-ci.org/sindresorhus/semver-truncate)
2
3 > Truncate a semver version: `1.2.3` → `1.2.0`
4
5
6 ## Install
7
8 ```
9 $ npm install --save semver-truncate
10 ```
11
12
13 ## Usage
14
15 ```js
16 const semverTruncate = require('semver-truncate');
17
18 semverTruncate('1.2.3-foo', 'patch');
19 //=> '1.2.3'
20
21 semverTruncate('1.2.3', 'minor');
22 //=> '1.2.0'
23
24 semverTruncate('1.2.3', 'major');
25 //=> '1.0.0'
26 ```
27
28
29 ## API
30
31 ### truncateSemver(version, type)
32
33 #### version
34
35 Type: `string`
36
37 Semver version.
38
39 #### type
40
41 Type: `string`  
42 Values: `patch` `minor` `major`
43
44 Version type to truncate to.
45
46
47 ## License
48
49 MIT © [Sindre Sorhus](https://sindresorhus.com)