find-versions
Advanced tools
Comparing version 3.0.0 to 3.1.0
@@ -5,11 +5,11 @@ 'use strict'; | ||
module.exports = (input, options = {}) => { | ||
if (typeof input !== 'string') { | ||
throw new TypeError(`Expected a string, got ${typeof input}`); | ||
module.exports = (stringWithVersions, options = {}) => { | ||
if (typeof stringWithVersions !== 'string') { | ||
throw new TypeError(`Expected a string, got ${typeof stringWithVersions}`); | ||
} | ||
const reLoose = new RegExp(`(?:${semverRegex().source})|(?:v?(?:\\d+\\.\\d+)(?:\\.\\d+)?)`, 'g'); | ||
const matches = input.match(options.loose === true ? reLoose : semverRegex()) || []; | ||
const matches = stringWithVersions.match(options.loose === true ? reLoose : semverRegex()) || []; | ||
return arrayUniq(matches.map(match => match.trim().replace(/^v/, '').replace(/^\d+\.\d+$/, '$&.0'))); | ||
}; |
{ | ||
"name": "find-versions", | ||
"version": "3.0.0", | ||
"version": "3.1.0", | ||
"description": "Find semver versions in a string: `unicorn v1.2.3` → `1.2.3`", | ||
@@ -16,6 +16,7 @@ "license": "MIT", | ||
"scripts": { | ||
"test": "xo && ava" | ||
"test": "xo && ava && tsd" | ||
}, | ||
"files": [ | ||
"index.js" | ||
"index.js", | ||
"index.d.ts" | ||
], | ||
@@ -36,9 +37,10 @@ "keywords": [ | ||
"dependencies": { | ||
"array-uniq": "^2.0.0", | ||
"array-uniq": "^2.1.0", | ||
"semver-regex": "^2.0.0" | ||
}, | ||
"devDependencies": { | ||
"ava": "^1.0.0-rc.1", | ||
"xo": "^0.23.0" | ||
"ava": "^1.4.1", | ||
"tsd": "^0.7.2", | ||
"xo": "^0.24.0" | ||
} | ||
} |
@@ -28,5 +28,5 @@ # find-versions [![Build Status](https://travis-ci.com/sindresorhus/find-versions.svg?branch=master)](https://travis-ci.com/sindresorhus/find-versions) | ||
### findVersions(input, [options]) | ||
### findVersions(stringWithVersions, [options]) | ||
#### input | ||
#### stringWithVersions | ||
@@ -33,0 +33,0 @@ Type: `string` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4016
5
36
3
Updatedarray-uniq@^2.1.0