feat: introduce FRESH version regex

This commit is contained in:
hacksalot 2018-02-09 21:32:44 -05:00
parent 17e5c6c172
commit 58fe46dc83
No known key found for this signature in database
GPG Key ID: 2F343EC247CA4B06
2 changed files with 37 additions and 0 deletions

14
dist/utils/fresh-version-regex.js vendored Normal file
View File

@ -0,0 +1,14 @@
/**
Defines a regex suitable for matching FRESH versions.
@module file-contains.js
*/
(function() {
module.exports = function() {
return RegExp('^(FRESH|FRESCA|JRS)(?:@(\\d+(?:\\.\\d+)?(?:\\.\\d+)?))?$');
};
}).call(this);
//# sourceMappingURL=fresh-version-regex.js.map

View File

@ -0,0 +1,23 @@
###*
Defines a regex suitable for matching FRESH versions.
@module file-contains.js
###
# Set up a regex that matches all of the following:
#
# - FRESH
# - JRS
# - FRESCA
# - FRESH@1.0.0
# - FRESH@1.0
# - FRESH@1
# - JRS@0.16.0
# - JRS@0.16
# - JRS@0
#
# Don't use a SEMVER regex (eg, NPM's semver-regex) because a) we want to
# support partial semvers like "0" or "1.2" and b) we'll expand this later to
# support fully scoped FRESH versions.
module.exports = () ->
RegExp '^(FRESH|FRESCA|JRS)(?:@(\\d+(?:\\.\\d+)?(?:\\.\\d+)?))?$'