function stringToByteArray(string) {
  var array = new Uint16Array(string.length),
      i,
      l;

  for (i = 0, l = string.length; i < l; i++)
    array[i] = string.charCodeAt(i);

  return array;
}
Function used to convert a string into a Uint16 byte array.

@param  {string}      string - Target string.
@return {Uint16Array}