HELLO.js 832 B

1234567891011121314151617181920212223242526272829
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.transformReply = exports.transformArguments = void 0;
  4. function transformArguments(options) {
  5. const args = ['HELLO'];
  6. if (options) {
  7. args.push(options.protover.toString());
  8. if (options.auth) {
  9. args.push('AUTH', options.auth.username, options.auth.password);
  10. }
  11. if (options.clientName) {
  12. args.push('SETNAME', options.clientName);
  13. }
  14. }
  15. return args;
  16. }
  17. exports.transformArguments = transformArguments;
  18. function transformReply(reply) {
  19. return {
  20. server: reply[1],
  21. version: reply[3],
  22. proto: reply[5],
  23. id: reply[7],
  24. mode: reply[9],
  25. role: reply[11],
  26. modules: reply[13]
  27. };
  28. }
  29. exports.transformReply = transformReply;