(text: string, bom: boolean)
| 47 | const splitBom = (text: string) => |
| 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) } |