Allow custom value for semver and match type

This commit is contained in:
CrazyMax 2021-03-27 21:46:47 +01:00
parent b171e9c8ea
commit e59258b94d
No known key found for this signature in database
GPG key ID: 3248E46B6BB8C7F7
7 changed files with 179 additions and 20 deletions

View file

@ -104,6 +104,9 @@ export function Parse(s: string): Tag {
if (!tag.attrs.hasOwnProperty('pattern')) {
throw new Error(`Missing pattern attribute for ${s}`);
}
if (!tag.attrs.hasOwnProperty('value')) {
tag.attrs['value'] = '';
}
break;
}
case Type.Match: {
@ -116,6 +119,9 @@ export function Parse(s: string): Tag {
if (isNaN(+tag.attrs['group'])) {
throw new Error(`Invalid match group for ${s}`);
}
if (!tag.attrs.hasOwnProperty('value')) {
tag.attrs['value'] = '';
}
break;
}
case Type.Edge: {