util.js 638 B

123456789101112131415161718192021222324
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. /**
  4. * Error wrapper for SocksClient
  5. */
  6. class SocksClientError extends Error {
  7. constructor(message, options) {
  8. super(message);
  9. this.options = options;
  10. }
  11. }
  12. exports.SocksClientError = SocksClientError;
  13. /**
  14. * Shuffles a given array.
  15. * @param array The array to shuffle.
  16. */
  17. function shuffleArray(array) {
  18. for (let i = array.length - 1; i > 0; i--) {
  19. let j = Math.floor(Math.random() * (i + 1));
  20. [array[i], array[j]] = [array[j], array[i]];
  21. }
  22. }
  23. exports.shuffleArray = shuffleArray;
  24. //# sourceMappingURL=util.js.map