index.js 197 B

123456789
  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. };