TextMessageFormat.js 1.1 KB

1234567891011121314151617181920212223242526
  1. "use strict";
  2. // Copyright (c) .NET Foundation. All rights reserved.
  3. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
  4. Object.defineProperty(exports, "__esModule", { value: true });
  5. // Not exported from index
  6. /** @private */
  7. var TextMessageFormat = /** @class */ (function () {
  8. function TextMessageFormat() {
  9. }
  10. TextMessageFormat.write = function (output) {
  11. return "" + output + TextMessageFormat.RecordSeparator;
  12. };
  13. TextMessageFormat.parse = function (input) {
  14. if (input[input.length - 1] !== TextMessageFormat.RecordSeparator) {
  15. throw new Error("Message is incomplete.");
  16. }
  17. var messages = input.split(TextMessageFormat.RecordSeparator);
  18. messages.pop();
  19. return messages;
  20. };
  21. TextMessageFormat.RecordSeparatorCode = 0x1e;
  22. TextMessageFormat.RecordSeparator = String.fromCharCode(TextMessageFormat.RecordSeparatorCode);
  23. return TextMessageFormat;
  24. }());
  25. exports.TextMessageFormat = TextMessageFormat;
  26. //# sourceMappingURL=TextMessageFormat.js.map