* Sets the port for the URL pattern. * * @param {number} port - The port number to set. * @returns {UrlPattern} - Returns the updated instance of the URL pattern for chaining. * @throws {Error} - Throws an error if the port is not a number.
(port)
| 52 | * @throws {Error} - Throws an error if the port is not a number. |
| 53 | */ |
| 54 | port(port) { |
| 55 | if (typeof port === 'number') { |
| 56 | this.#map.set('port', port.toString()) |
| 57 | } else { |
| 58 | throw new Error(`Port must be a number. Received:'${port}'`) |
| 59 | } |
| 60 | return this |
| 61 | } |
| 62 | |
| 63 | /** |
| 64 | * Sets the pathname for the URL pattern. |
no test coverage detected