piggy-sanitize-uri
v0.1.4
Published
Sanitize an uri
Downloads
6
Readme
piggy-sanitize-uri
Purpose
Basic lib to sanitize uri with options.
Usage
import sanitizeUri from 'piggy-sanitize-uri'
let uri = '/my/path/?arg=value';
let sanitizedUri = sanitizeUri(uri);
With options:
import sanitizeUri from 'piggy-sanitize-uri'
let uri = '/my/path/?arg=value';
let options = {
simpleChars: true,
lowercase: true,
endingslash: true,
doubleshash: true
};
let sanitizedUri = sanitizeUri(uri);
Options
All options are simple boolean values to enable/disable the feature
- simpleChars: keep only alnum, "-" and "/" chars in the path
- lowercase: lowercase all the chars
- endingslash: force an ending slash
- doubleshash: remove double slash
Developer
Installing dev dependencies, you can edit the package source. Then run:
npm run dev-compile
for babel transpilationnpm run dev-check
for jshint check