Initial commit
[yaffs-website] / node_modules / find-versions / readme.md
1 # find-versions [![Build Status](https://travis-ci.org/sindresorhus/find-versions.svg?branch=master)](https://travis-ci.org/sindresorhus/find-versions)
2
3 > Find semver versions in a string: `unicorn 1.0.0` → `1.0.0`
4
5
6 ## Install
7
8 ```
9 $ npm install --save find-versions
10 ```
11
12
13 ## Usage
14
15 ```js
16 var findVersions = require('find-versions');
17
18 findVersions('unicorn 1.0.0 rainbow v2.3.4+build.1');
19 //=> ['1.0.0', '2.3.4+build.1']
20
21 findVersions('cp (GNU coreutils) 8.22', {loose: true});
22 //=> ['8.22.0']
23 ```
24
25
26 ## API
27
28 ### findVersions(input, options)
29
30 #### input
31
32 *Required*  
33 Type: `string`
34
35 #### options.loose
36
37 Type: `boolean`  
38 Default: `false`
39
40 Also match non-semver versions like `1.88`.  
41 They're coerced into semver compliant versions.
42
43
44 ## CLI
45
46 ```
47 $ npm install --global find-versions
48 ```
49
50 ```
51 $ find-versions --help
52
53   Usage
54     $ find-versions <string> [--first] [--loose]
55     $ echo <string> | find-versions
56
57   Example
58     $ find-versions 'unicorns v1.2.3'
59     1.2.3
60
61     $ curl --version | find-versions --first
62     7.30.0
63
64   Options
65     --first  Return the first match
66     --loose  Match non-semver versions like 1.88
67 ```
68
69
70 ## License
71
72 MIT © [Sindre Sorhus](http://sindresorhus.com)