mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 22:12:21 -04:00
Fix eslint
This commit is contained in:
parent
ef539bcb37
commit
8bcb0635ba
1 changed files with 11 additions and 11 deletions
|
@ -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 */
|
||||||
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue