function stringByteLength(str) {
	  if (useNodeBuffer) {
	    return Buffer.byteLength(str);
	  }

	  return new Blob([str]).size;
	}
Calculate the byte length of a JavaScript string.

Note that a JavaScript string can contain wide characters, therefore the
length of the string is not necessarily equal to the byte length.

@param str Input string.
@returns Byte length.