Added number support to version text formatter (#1620)

This commit is contained in:
Pyves
2018-03-29 18:08:23 +01:00
committed by Paul Melnikow
parent 16eea6d7db
commit 1dff491a24
2 changed files with 3 additions and 0 deletions

View File

@@ -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 {

View File

@@ -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');