url-transformers
v0.0.10
Published
A small helper library for manipulating URL strings in Node and in the browser. `url-transformers` provides several functions for common URL transformations, such as adding a search/query string to a URL or appending to the URL pathname.
Downloads
1,367
Readme
url-transformers
A small helper library for manipulating URL strings in Node and in the browser. url-transformers
provides several functions for common URL transformations, such as adding a search/query string to a URL or appending to the URL pathname.
Currently url-transformers
provides the following helpers:
mapUrl
replaceQueryInUrl
addQueryToUrl
replacePathInUrl
replacePathnameInUrl
appendPathnameToUrl
replaceHashInUrl
There are many more possibilities, so we would love for you to help us grow this collection!
Currently we don't have documentation, however the code is strongly typed using TypeScript, and it should be easy to scan the function signatures. See the tests for example usage.
Installation
yarn add url-transformers
npm install url-transformers
Dependencies
This project depends on monocle-ts
(lenses library) and fp-ts
. If tree shaking is used (via the module
field in package.json
) these dependencies will have a neglible impact on the bundle size—at the time of writing they only contribute ~500 bytes (gzipped) to the bundle.
Development
yarn
npm run test
npm run prepublishOnly && npm version patch && npm publish && git push && git push --tags