Need private packages and team management tools?Check out npm Teams »

@braintree/sanitize-url

4.0.1 • Public • Published

sanitize-url

Installation

npm install -S @braintree/sanitize-url

Usage

var sanitizeUrl = require('@braintree/sanitize-url').sanitizeUrl;
 
sanitizeUrl('https://example.com'); // 'https://example.com'
sanitizeUrl('http://example.com'); // 'http://example.com'
sanitizeUrl('www.example.com'); // 'www.example.com'
sanitizeUrl('mailto:hello@example.com'); // 'mailto:hello@example.com'
 
sanitizeUrl('javascript:alert(document.domain)'); // 'about:blank'
sanitizeUrl('jAvasCrIPT:alert(document.domain)'); // 'about:blank'
sanitizeUrl(decodeURIComponent('JaVaScRiP%0at:alert(document.domain)')); // 'about:blank'

Keywords

none

Install

npm i @braintree/sanitize-url

DownloadsWeekly Downloads

130,948

Version

4.0.1

License

MIT

Unpacked Size

9.6 kB

Total Files

10

Last publish

Collaborators

  • avatar