GithubHelp home page GithubHelp logo

find-versions's Introduction

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.

Related

find-versions's People

Contributors

sindresorhus avatar kevva avatar bendingbender avatar jimmywarting avatar watson avatar

Stargazers

Carlos Marte avatar Okiki Ojo avatar Takuya Fukuju avatar  avatar Andres Garcia avatar Gord Lea avatar Thibault Maekelbergh avatar Arthur Guiot avatar Cuvii avatar Ink avatar frankfanslc avatar Mindula Dilthushan Manamperi avatar Tobias Zittlau avatar Andrew Gurylev avatar Cat  avatar Andrii Oriekhov avatar YoungChief avatar Maxim Zaytsev avatar Joey Huang avatar Tarun Chaudhry avatar Enrique Benitez avatar Lucas Bento avatar Daniel Petelin avatar Peter MacDonald avatar Konstantin Büschel avatar Nicola Dal Maso avatar Mathieu M-Gosselin avatar  avatar Branden Dane avatar Gabriel Nobrega avatar Tyler Richards avatar Arti Villa avatar Julien avatar Adrian Perez avatar Vincenzo Ferrari avatar Jonas Mendes avatar Paulo Freitas avatar Alex Zinchenko avatar Afanasii Kurakin avatar Newton avatar Fredrik Forsmo avatar Raymond C. Crandall avatar  avatar Stefan Buck avatar Cristian Douce avatar

Watchers

 avatar  avatar James Cloos avatar Sam Verschueren avatar Arthur Verschaeve avatar Nicola Dal Maso avatar  avatar

find-versions's Issues

Update to remove the vulnerability introduced by semver-regex?

Subject of the issue

[email protected] requires [email protected], which has a security problem (see: SNYK-JS-SEMVERREGEX-1047770):
[email protected][email protected]

I do not know if this vulnerability actually affects find-versions, but it will show up in security reports about dependencies. Since a large number of developers still use [email protected].*(1,762,377 downloads per week), is there any posibility that you could release an update version for 3.2.* (ie 3.2.1) that introduces a patched version(>=3.1.2) of semver-regex?

In [email protected], maybe you can perform the following update:
semver-regex ^2.0.0 ➔ ^3.1.2
where [email protected](>=3.1.2) has fixed the vulnerability SNYK-JS-SEMVERREGEX-1047770.

safari exec error

import "/node_modules/.vite/chunk-R6I3GLEQ.js?v=1eb03933";

// node_modules/semver-regex/index.js
function semverRegex() {
  return /(?<=^v?|\sv?)(?:(?:0|[1-9]\d*)\.){2}(?:0|[1-9]\d*)(?:-(?:0|[1-9]\d*|[\da-z-]*[a-z-][\da-z-]*)(?:\.(?:0|[1-9]\d*|[\da-z-]*[a-z-][\da-z-]*))*)?(?:\+[\da-z-]+(?:\.[\da-z-]+)*)?\b/gi;
}

// node_modules/find-versions/index.js
function findVersions(stringWithVersions, { loose = false } = {}) {
  if (typeof stringWithVersions !== "string") {
    throw new TypeError(`Expected a string, got ${typeof stringWithVersions}`);
  }
  const regex = loose ? new RegExp(`(?:${semverRegex().source})|(?:v?(?:\\d+\\.\\d+)(?:\\.\\d+)?)`, "g") : semverRegex();
  const matches = stringWithVersions.match(regex) || [];
  return [...new Set(matches.map((match) => match.trim().replace(/^v/, "").replace(/^\d+\.\d+$/, "$&.0")))];
}

// dep:find-versions
var find_versions_default = findVersions;
export {
  find_versions_default as default
};

safari can't resolve ?<= ; throw error

SyntaxError: Invalid regular expression: invalid group specifier name

but you package use semver-regex

PHP 7 not recognised

PHP 7 is recognised as 3.0.0-dev, instead of 7.0.0-rc.6

$ php --version
PHP 7.0.0RC6 (cli) (built: Oct 29 2015 13:46:05) ( NTS )
Copyright (c) 1997-2015 The PHP Group
Zend Engine v3.0.0-dev, Copyright (c) 1998-2015 Zend Technologies

This currently breaks grunt-php when PHP 7 is installed, because it has a requirement of >=5.4

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.