| Leo Repp | 58b9f11 | 2021-11-22 11:57:47 +0100 | [diff] [blame^] | 1 | declare namespace findVersions { |
| 2 | interface Options { |
| 3 | /** |
| 4 | Also match non-semver versions like `1.88`. They're coerced into semver compliant versions. |
| 5 | |
| 6 | @default false |
| 7 | */ |
| 8 | readonly loose?: boolean; |
| 9 | } |
| 10 | } |
| 11 | |
| 12 | /** |
| 13 | Find semver versions in a string: `unicorn v1.2.3` → `1.2.3`. |
| 14 | |
| 15 | @example |
| 16 | ``` |
| 17 | import findVersions = require('find-versions'); |
| 18 | |
| 19 | findVersions('unicorn v1.2.3 rainbow 2.3.4+build.1'); |
| 20 | //=> ['1.2.3', '2.3.4+build.1'] |
| 21 | |
| 22 | findVersions('cp (GNU coreutils) 8.22', {loose: true}); |
| 23 | //=> ['8.22.0'] |
| 24 | ``` |
| 25 | */ |
| 26 | declare function findVersions( |
| 27 | stringWithVersions: string, |
| 28 | options?: findVersions.Options |
| 29 | ): string[]; |
| 30 | |
| 31 | export = findVersions; |