You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

readme.md 938B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. # find-versions [![Build Status](https://travis-ci.com/sindresorhus/find-versions.svg?branch=master)](https://travis-ci.com/sindresorhus/find-versions)
  2. > Find semver versions in a string: `unicorn v1.2.3` → `1.2.3`
  3. ## Install
  4. ```
  5. $ npm install find-versions
  6. ```
  7. ## Usage
  8. ```js
  9. const findVersions = require('find-versions');
  10. findVersions('unicorn v1.2.3 rainbow 2.3.4+build.1');
  11. //=> ['1.2.3', '2.3.4+build.1']
  12. findVersions('cp (GNU coreutils) 8.22', {loose: true});
  13. //=> ['8.22.0']
  14. ```
  15. ## API
  16. ### findVersions(stringWithVersions, [options])
  17. #### stringWithVersions
  18. Type: `string`
  19. #### options
  20. Type: `Object`
  21. ##### loose
  22. Type: `boolean`
  23. Default: `false`
  24. Also match non-semver versions like `1.88`. They're coerced into semver compliant versions.
  25. ## Related
  26. - [find-versions-cli](https://github.com/sindresorhus/find-versions-cli) - CLI for this module
  27. ## License
  28. MIT © [Sindre Sorhus](https://sindresorhus.com)