piggy-sanitize-uri

0.1.4 • Public • Published

piggy-sanitize-uri NPM version Build Status

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 transpilation
  • npm run dev-check for jshint check

Dependencies (0)

    Dev Dependencies (4)

    Package Sidebar

    Install

    npm i piggy-sanitize-uri

    Weekly Downloads

    4

    Version

    0.1.4

    License

    MIT

    Last publish

    Collaborators

    • tilap