safe-uri-path
v0.4.2
Published
Parse a uri safely
Downloads
8
Maintainers
Readme
safe-uri-path
A module to safely parse uri paths.
Why? :thinking:
There are times that a string path will contain special characters. Imagine you are using a cat api and someone named a cat cat?*=my&cat
. That is not a valid part of a url if someone was to include it. This library helps parsing correctly any uri paths :tada:
Install :metal:
yarn add --save safe-uri-path
Example
const safeUriPath = require('safe-uri-path');
const cat = 'cat';
// weird string with special characters
const weirdCat = 'cat?format=json';
const uriPath = safelyParseUri`/${cat}/${weirdCat}`;
Contributing
- Fork it (https://github.com/George-Aidonidis/safe-uri-path/fork)
- Create your feature branch (git checkout -b feature/fooBar)
- Commit your changes (git commit -am 'Add some fooBar')
- Push to the branch (git push origin feature/fooBar)
- Create a new Pull Request
License
MIT ©