Missing \feff when expected:
> const d = new TextDecoder()
undefined
> d.decode(Uint8Array.of(0xef, 0xbb, 0xbf), { stream: true }).length // should be 0
0
> d.decode(Uint8Array.of(0xef, 0xbb, 0xbf), { stream: true }).length // should be 1
0
> d.decode(Uint8Array.of(0xef, 0xbb, 0xbf)).length // should be 1
0
Returning \feff when not expected:
> const n = new TextDecoder()
undefined
> n.decode(Uint8Array.of(0xef), { stream: true }).length // should be 0
0
> n.decode(Uint8Array.of(0xbb, 0xbf), { stream: true }).length // should be 0
1