(url, property)
| 9 | }); |
| 10 | |
| 11 | function getMethod(url, property) { |
| 12 | if (property === 'pathname') return (x) => url.pathname = `/${x}`; |
| 13 | if (property === 'search') return (x) => url.search = `?${x}`; |
| 14 | if (property === 'hash') return (x) => url.hash = `#${x}`; |
| 15 | throw new Error(`Unsupported property "${property}"`); |
| 16 | } |
| 17 | |
| 18 | function main({ searchParams, property, n }) { |
| 19 | const url = new URL('https://nodejs.org'); |