node_modules/notepack.io/lib/encode.js
// Faster for short strings than buffer.write
Faster for short strings than buffer.write
Faster for short strings than buffer . write
function utf8Write(arr, offset, str) {
  var c = 0;
  for (var i = 0, l = str.length; i < l; i++) {
    c = str.charCodeAt(i);
    if (c < 0x80) {
      arr[offset++] = c;
    }
    else if (c < 0x800) {
      arr[offset++] = 0xc0 | (c >> 6);
      arr[offset++] = 0x80 | (c & 0x3f);
    }
    else if (c < 0xd800 || c >= 0xe000) {
      arr[offset++] = 0xe0 | (c >> 12);
      arr[offset++] = 0x80 | (c >> 6) & 0x3f;
      arr[offset++] = 0x80 | (c & 0x3f);
    }
    else {
      i++;
      c = 0x10000 + (((c & 0x3ff) << 10) | (str.charCodeAt(i) & 0x3ff));
      arr[offset++] = 0xf0 | (c >> 18);
      arr[offset++] = 0x80 | (c >> 12) & 0x3f;
      arr[offset++] = 0x80 | (c >> 6) & 0x3f;
      arr[offset++] = 0x80 | (c & 0x3f);
    }
  }
}
function utf8Write ( arr , offset , str ) { var c = 0 ; for ( var i = 0 , l = str . length ; i < l ; i ++ ) { c = str . charCodeAt ( i ) ; if ( c < 0x80 ) { arr [ offset ++ ] = c ; } else if ( c < 0x800 ) { arr [ offset ++ ] = 0xc0 | ( c >> 6 ) ; arr [ offset ++ ] = 0x80 | ( c & 0x3f ) ; } else if ( c < 0xd800 || c >= 0xe000 ) { arr [ offset ++ ] = 0xe0 | ( c >> 12 ) ; arr [ offset ++ ] = 0x80 | ( c >> 6 ) & 0x3f ; arr [ offset ++ ] = 0x80 | ( c & 0x3f ) ; } else { i ++ ; c = 0x10000 + ( ( ( c & 0x3ff ) << 10 ) | ( str . charCodeAt ( i ) & 0x3ff ) ) ; arr [ offset ++ ] = 0xf0 | ( c >> 18 ) ; arr [ offset ++ ] = 0x80 | ( c >> 12 ) & 0x3f ; arr [ offset ++ ] = 0x80 | ( c >> 6 ) & 0x3f ; arr [ offset ++ ] = 0x80 | ( c & 0x3f ) ; } } }
Faster for short strings than buffer.write
Faster for short strings than buffer . write