0.1.1 โข Published 3 years ago
@sanitise/uri v0.1.1
@sanitise/uri
๐งผ Sanitise a URI to mitigate XSS and malformed URIs
Requirements
This module requires an Active LTS Node version (v14.15.0+).
Install
Using npm:
npm install @sanitise/uri
Usage
const { sanitise } = require('@sanitise/uri');
sanitise('http://bat.cave');
// โ 'http://bat.cave'
sanitise(`javascript:alert('joker')`);
// โ undefined
Falsey Results
This package follows the behavior of JSON.stringify
. The following results for falsey values can be expected:
sanitise(undefined);
// โ undefined
sanitise(null);
// โ 'null'
sanitise('');
// โ ''
Options
invalidUri
Type: String
Default: ''
Sets the default result value, should the uri
passed contain an invalid protocol.