toBuf.js 425 B

123456789101112
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.toBuf = void 0;
  4. const encode_1 = require("./utf8/encode");
  5. const toBuf = (str) => {
  6. const maxLength = str.length * 4;
  7. const arr = new Uint8Array(maxLength);
  8. const strBufferLength = (0, encode_1.encode)(arr, str, 0, maxLength);
  9. return arr.slice(0, strBufferLength);
  10. };
  11. exports.toBuf = toBuf;
  12. //# sourceMappingURL=toBuf.js.map