Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

find-versions

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

find-versions - npm Package Compare versions

Comparing version 5.1.0 to 6.0.0

4

index.d.ts

@@ -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"
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc