| 48 | text.startsWith("\uFEFF") ? { bom: true, text: text.slice(1) } : { bom: false, text } |
| 49 | const joinBom = (text: string, bom: boolean) => (bom ? `\uFEFF${text}` : text) |
| 50 | const decodeUtf8 = (content: Uint8Array) => { |
| 51 | const bom = content[0] === 0xef && content[1] === 0xbb && content[2] === 0xbf |
| 52 | return { bom, content, text: new TextDecoder().decode(bom ? content.slice(3) : content) } |
| 53 | } |
| 54 | |
| 55 | const countOccurrences = (content: string, search: string) => { |
| 56 | if (search === "") return content.length + 1 |