Removed useless code
This commit is contained in:
13
src/utils.ts
13
src/utils.ts
@@ -61,19 +61,6 @@ export function stringsToRegex(strings: string[]): RegExp {
|
||||
return new RegExp(strings.map(s => `(${escapeRegex(s)})`).join('|'), 'gi')
|
||||
}
|
||||
|
||||
export function replaceAll(
|
||||
text: string,
|
||||
terms: string[],
|
||||
cb: (t: string) => string,
|
||||
): string {
|
||||
terms.sort((a, b) => a.length - b.length)
|
||||
const regs = terms.map(term => new RegExp(escapeRegex(term), 'gi'))
|
||||
for (const reg of regs) {
|
||||
text = text.replaceAll(reg, cb)
|
||||
}
|
||||
return text
|
||||
}
|
||||
|
||||
export function extractHeadingsFromCache(
|
||||
cache: CachedMetadata,
|
||||
level: number,
|
||||
|
||||
Reference in New Issue
Block a user