find-versions
Advanced tools
Comparing version 5.1.0 to 6.0.0
@@ -1,2 +0,2 @@ | ||
export interface Options { | ||
export type Options = { | ||
/** | ||
@@ -8,3 +8,3 @@ Also match non-semver versions like `1.88`. They're coerced into semver compliant versions. | ||
readonly loose?: boolean; | ||
} | ||
}; | ||
@@ -11,0 +11,0 @@ /** |
import semverRegex from 'semver-regex'; | ||
import {matches} from 'super-regex'; | ||
@@ -9,5 +10,5 @@ export default function findVersions(stringWithVersions, {loose = false} = {}) { | ||
const regex = loose ? new RegExp(`(?:${semverRegex().source})|(?:v?(?:\\d+\\.\\d+)(?:\\.\\d+)?)`, 'g') : semverRegex(); | ||
const matches = stringWithVersions.match(regex) || []; | ||
const versions = [...matches(regex, stringWithVersions)].map(({match}) => match.trim().replace(/^v/, '').replace(/^\d+\.\d+$/, '$&.0')); // TODO: Remove the `...` when https://github.com/tc39/proposal-iterator-helpers is available. | ||
return [...new Set(matches.map(match => match.trim().replace(/^v/, '').replace(/^\d+\.\d+$/, '$&.0')))]; | ||
return [...new Set(versions)]; | ||
} |
{ | ||
"name": "find-versions", | ||
"version": "5.1.0", | ||
"version": "6.0.0", | ||
"description": "Find semver versions in a string: `unicorn v1.2.3` → `1.2.3`", | ||
@@ -14,5 +14,9 @@ "license": "MIT", | ||
"type": "module", | ||
"exports": "./index.js", | ||
"exports": { | ||
"types": "./index.d.ts", | ||
"default": "./index.js" | ||
}, | ||
"sideEffects": false, | ||
"engines": { | ||
"node": ">=12" | ||
"node": ">=18" | ||
}, | ||
@@ -40,9 +44,10 @@ "scripts": { | ||
"dependencies": { | ||
"semver-regex": "^4.0.5" | ||
"semver-regex": "^4.0.5", | ||
"super-regex": "^1.0.0" | ||
}, | ||
"devDependencies": { | ||
"ava": "^4.3.0", | ||
"tsd": "^0.20.0", | ||
"xo": "^0.49.0" | ||
"ava": "^6.1.2", | ||
"tsd": "^0.31.0", | ||
"xo": "^0.58.0" | ||
} | ||
} |
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
4008
32
2
+ Addedsuper-regex@^1.0.0
+ Addedconvert-hrtime@5.0.0(transitive)
+ Addedfunction-timeout@1.0.2(transitive)
+ Addedsuper-regex@1.0.0(transitive)
+ Addedtime-span@5.1.0(transitive)