(hostPort: string)
| 563 | } |
| 564 | |
| 565 | export function parseHostPort(hostPort: string) { |
| 566 | let port: number; |
| 567 | let host = '127.0.0.1'; |
| 568 | const match = hostPort.match(/(.*)\:([0-9]+)/); |
| 569 | if (match) { |
| 570 | host = match[1] ? match[1] : host; |
| 571 | port = parseInt(match[2], 10); |
| 572 | } else { |
| 573 | if (hostPort.startsWith(':')) { |
| 574 | hostPort = hostPort.slice(1); |
| 575 | } |
| 576 | port = parseInt(hostPort, 10); |
| 577 | } |
| 578 | return { port: port, host: host }; |
| 579 | } |
| 580 | |
| 581 | export function getNonce() { |
| 582 | let text = ''; |