find-versions

Find semver versions in a string: `unicorn v1.2.3` → `1.2.3`

MIT 17 个版本
安装
npm install find-versions
yarn add find-versions
pnpm add find-versions
bun add find-versions
README

find-versions

Find semver versions in a string: unicorn v1.2.31.2.3

Install

npm install find-versions

Usage

import findVersions from 'find-versions';

findVersions('unicorn v1.2.3 rainbow 2.3.4+build.1');
//=> ['1.2.3', '2.3.4+build.1']

findVersions('cp (GNU coreutils) 8.22', {loose: true});
//=> ['8.22.0']

API

findVersions(stringWithVersions, options?)

stringWithVersions

Type: string

options

Type: object

loose

Type: boolean
Default: false

Also match non-semver versions like 1.88. They're coerced into semver compliant versions.

版本列表
6.0.0 2024-04-03
5.1.0 2022-06-09
5.0.0 2021-04-28
4.0.0 2020-12-29
3.2.0 2019-11-22
3.1.0 2019-04-15
3.0.0 2018-11-06
2.0.0 2015-11-19
1.2.1 2015-11-18
1.2.0 2015-11-14
1.1.3 2015-05-19
1.1.2 2015-02-16
1.1.1 2014-09-08
1.1.0 2014-09-07
1.0.0 2014-08-14
0.1.1 2014-06-25
0.1.0 2014-06-13