https://github.com/tilap/piggy-sanitize-uri
Nodejs lib to sanitize uri
https://github.com/tilap/piggy-sanitize-uri
Last synced: 9 months ago
JSON representation
Nodejs lib to sanitize uri
- Host: GitHub
- URL: https://github.com/tilap/piggy-sanitize-uri
- Owner: tilap
- License: mit
- Created: 2015-07-18T17:10:40.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2015-07-18T19:03:32.000Z (almost 11 years ago)
- Last Synced: 2025-03-05T14:49:28.726Z (over 1 year ago)
- Language: JavaScript
- Homepage:
- Size: 139 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
piggy-sanitize-uri [![NPM version][npm-image]][npm-url] [![Build Status][build-status-image]][build-status-url]
============================
## Purpose
Basic lib to sanitize uri with options.
## Usage
```js
import sanitizeUri from 'piggy-sanitize-uri'
let uri = '/my/path/?arg=value';
let sanitizedUri = sanitizeUri(uri);
```
With options:
```js
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 transpilation
- ```npm run dev-check``` for jshint check
[npm-image]: https://img.shields.io/npm/v/piggy-sanitize-uri.svg?style=flat
[npm-url]: https://npmjs.org/package/piggy-sanitize-uri
[build-status-image]: https://circleci.com/gh/tilap/piggy-sanitize-uri/tree/master.svg?style=svg
[build-status-url]: https://circleci.com/gh/tilap/piggy-sanitize-uri/tree/master