Simple email application for Android. Original source code: https://framagit.org/dystopia-project/simple-email
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.

14 lines
540 B

  1. 'use strict';
  2. const semverRegex = require('semver-regex');
  3. const arrayUniq = require('array-uniq');
  4. module.exports = (input, options = {}) => {
  5. if (typeof input !== 'string') {
  6. throw new TypeError(`Expected a string, got ${typeof input}`);
  7. }
  8. const reLoose = new RegExp(`(?:${semverRegex().source})|(?:v?(?:\\d+\\.\\d+)(?:\\.\\d+)?)`, 'g');
  9. const matches = input.match(options.loose === true ? reLoose : semverRegex()) || [];
  10. return arrayUniq(matches.map(match => match.trim().replace(/^v/, '').replace(/^\d+\.\d+$/, '$&.0')));
  11. };