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

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