-
-
Save OliverJAsh/ae3545c281ed49b1a1f18e5bc5ac733d 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 { ParsedUrlQuery } from 'querystring'; | |
const addQueryToParsedUrl = (queryToAppend: ParsedUrlQuery) => ( | |
parsedUrl: UrlWithParsedQuery, | |
): UrlWithParsedQuery => { | |
const { | |
auth, | |
protocol, | |
host, | |
hash, | |
pathname, | |
query: existingQuery, | |
} = parsedUrl; | |
const newQuery = { ...existingQuery, ...queryToAppend }; | |
const newParsedUrl = { | |
auth, | |
protocol, | |
host, | |
hash, | |
pathname, | |
query: newQuery, | |
}; | |
return newParsedUrl; | |
}; | |
const addQueryToUrl = pipe( | |
addQueryToParsedUrl, | |
mapUrl, | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment