• Beta

    Converts a string to a Uint16Array.

    Parameters

    • str: string

      The string to convert

    Returns Uint16Array

    A Uint16Array representation of the string

    const result = stringToUint16('hello world')

    deepEqual(result, new Uint16Array([104, 101, 108, 108, 111, 32, 119, 111, 114, 108, 100]));