Added number support to version text formatter (#1620)
This commit is contained in:
@@ -68,6 +68,7 @@ function omitv(version) {
|
||||
// - it is a date (yyyy-mm-dd)
|
||||
const ignoredVersionPatterns = /^[^0-9]|[0-9]{4}-[0-9]{2}-[0-9]{2}/;
|
||||
function addv(version) {
|
||||
version = '' + version;
|
||||
if (version.startsWith('v') || ignoredVersionPatterns.test(version)) {
|
||||
return version;
|
||||
} else {
|
||||
|
||||
@@ -56,6 +56,8 @@ describe('Text formatters', function() {
|
||||
});
|
||||
|
||||
test(addv, () => {
|
||||
given(9).expect('v9');
|
||||
given(0.1).expect('v0.1');
|
||||
given('1.0.0').expect('v1.0.0');
|
||||
given('v0.6').expect('v0.6');
|
||||
given('hello').expect('hello');
|
||||
|
||||
Reference in New Issue
Block a user