index.js 197 B

12345678
  1. "use strict";
  2. module.exports = function getByteLength(string) {
  3. if (typeof string !== "string") {
  4. throw new Error("Input must be string");
  5. }
  6. return Buffer.byteLength(string, "utf8");
  7. };