TextMessageFormat.js 948 B

123456789101112131415161718192021222324
  1. "use strict";
  2. // Licensed to the .NET Foundation under one or more agreements.
  3. // The .NET Foundation licenses this file to you under the MIT license.
  4. Object.defineProperty(exports, "__esModule", { value: true });
  5. exports.TextMessageFormat = void 0;
  6. // Not exported from index
  7. /** @private */
  8. class TextMessageFormat {
  9. static write(output) {
  10. return `${output}${TextMessageFormat.RecordSeparator}`;
  11. }
  12. static parse(input) {
  13. if (input[input.length - 1] !== TextMessageFormat.RecordSeparator) {
  14. throw new Error("Message is incomplete.");
  15. }
  16. const messages = input.split(TextMessageFormat.RecordSeparator);
  17. messages.pop();
  18. return messages;
  19. }
  20. }
  21. exports.TextMessageFormat = TextMessageFormat;
  22. TextMessageFormat.RecordSeparatorCode = 0x1e;
  23. TextMessageFormat.RecordSeparator = String.fromCharCode(TextMessageFormat.RecordSeparatorCode);
  24. //# sourceMappingURL=TextMessageFormat.js.map