vendor/GLTFExporter.js
function stringToArrayBuffer(text) {
      if (window.TextEncoder !== undefined) {
        return new TextEncoder().encode(text).buffer;
      }

      var array = new Uint8Array(new ArrayBuffer(text.length));

      for (var i = 0, il = text.length; i < il; i++) {
        var value = text.charCodeAt(i);

        // Replacing multi-byte character with space(0x20).
        array[i] = value > 0xff ? 0x20 : value;
      }

      return array.buffer;
    }
function stringToArrayBuffer(text) {
      if (window.TextEncoder !== undefined) {
        return new TextEncoder().encode(text).buffer;
      }

      var array = new Uint8Array(new ArrayBuffer(text.length));

      for (var i = 0, il = text.length; i < il; i++) {
        var value = text.charCodeAt(i);

        // Replacing multi-byte character with space(0x20).
        array[i] = value > 0xff ? 0x20 : value;
      }

      return array.buffer;
    }
function stringToArrayBuffer ( text ) { if ( window . TextEncoder !== undefined ) { return new TextEncoder ( ) . encode ( text ) . buffer ; } var array = new Uint8Array ( new ArrayBuffer ( text . length ) ) ; for ( var i = 0 , il = text . length ; i < il ; i ++ ) { var value = text . charCodeAt ( i ) ; // Replacing multi-byte character with space(0x20). array [ i ] = value > 0xff ? 0x20 : value ; } return array . buffer ; }
Converts a string to an ArrayBuffer.
@param  {string} text
@return {ArrayBuffer}
Converts a string to an ArrayBuffer .