utf16.browser.js 556 B

12345678
  1. // We trust browsers to always have correct TextDecoder for utf-16le/utf-16be with ignoreBOM without streaming
  2. import { encodeApi, decodeApiDecoders } from './fallback/utf16.js'
  3. export const utf16fromString = (str, format = 'uint16') => encodeApi(str, false, format)
  4. export const utf16fromStringLoose = (str, format = 'uint16') => encodeApi(str, true, format)
  5. export const utf16toString = (arr, format = 'uint16') => decodeApiDecoders(arr, false, format)
  6. export const utf16toStringLoose = (arr, format = 'uint16') => decodeApiDecoders(arr, true, format)