-
-
Save OliverJAsh/c57e89e7a3e1496001d7405cdcf83868 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as urlHelpers from 'url'; | |
import { UrlWithParsedQuery } from 'url'; | |
import { pipe } from './helpers/pipe'; | |
const parseUrlWithQueryString = (url: string): UrlWithParsedQuery => | |
urlHelpers.parse( | |
url, | |
// Parse the query string | |
true, | |
); | |
const mapUrl = (fn: (parsedUrl: UrlWithParsedQuery) => UrlWithParsedQuery) => | |
pipe( | |
parseUrlWithQueryString, | |
fn, | |
urlHelpers.format, | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment