Fix eslint

This commit is contained in:
Henrik Giesel 2021-07-09 03:12:38 +02:00
parent ef539bcb37
commit 8bcb0635ba

View file

@ -14,15 +14,15 @@ export function replaceWithColon(name: string): string {
export function normalizeTagname(tagname: string): string { export function normalizeTagname(tagname: string): string {
let trimmed = tagname.trim(); let trimmed = tagname.trim();
while (true) { while (trimmed.startsWith(":") || trimmed.startsWith(delimChar)) {
if (trimmed.startsWith(":") || trimmed.startsWith(delimChar)) { trimmed = trimmed.slice(1).trimStart();
trimmed = trimmed.slice(1).trimStart();
} else if (trimmed.endsWith(":") || trimmed.endsWith(delimChar)) {
trimmed = trimmed.slice(0, -1).trimEnd();
} else {
return trimmed;
}
} }
while (trimmed.endsWith(":") || trimmed.endsWith(delimChar)) {
trimmed = trimmed.slice(0, -1).trimEnd();
}
return trimmed;
} }
export interface Tag { export interface Tag {
@ -32,14 +32,14 @@ export interface Tag {
flash: () => void; flash: () => void;
} }
const noop = () => {};
export function attachId(name: string): Tag { export function attachId(name: string): Tag {
return { return {
id: Math.random().toString(36).substring(2), id: Math.random().toString(36).substring(2),
name, name,
selected: false, selected: false,
flash: noop, flash: () => {
/* noop */
},
}; };
} }