blob: 6fb0deb3a95574d789749b9b29a68b6e87bff0a3 [file] [log] [blame]
Leo Repp58b9f112021-11-22 11:57:47 +01001declare 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/**
13Find semver versions in a string: `unicorn v1.2.3` → `1.2.3`.
14
15@example
16```
17import findVersions = require('find-versions');
18
19findVersions('unicorn v1.2.3 rainbow 2.3.4+build.1');
20//=> ['1.2.3', '2.3.4+build.1']
21
22findVersions('cp (GNU coreutils) 8.22', {loose: true});
23//=> ['8.22.0']
24```
25*/
26declare function findVersions(
27 stringWithVersions: string,
28 options?: findVersions.Options
29): string[];
30
31export = findVersions;