Trim tags and flavor inputs

Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
CrazyMax
2021-10-22 13:50:28 +02:00
parent 110426b173
commit b69dce7fed
4 changed files with 55 additions and 26 deletions

View File

@@ -93,12 +93,15 @@ export function Parse(s: string): Tag {
const tag = new Tag();
for (const field of fields) {
const parts = field.toString().split('=', 2);
const parts = field
.toString()
.split('=')
.map(item => item.trim());
if (parts.length == 1) {
tag.attrs['value'] = parts[0].trim();
tag.attrs['value'] = parts[0];
} else {
const key = parts[0].trim().toLowerCase();
const value = parts[1].trim();
const key = parts[0].toLowerCase();
const value = parts[1];
switch (key) {
case 'type': {
if (!Object.values(Type).includes(value)) {