Learn about our RFC process, Open RFC meetings & more.Join in the discussion! »

@braintree/sanitize-url

4.1.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

333,417

Version

4.1.1

License

MIT

Unpacked Size

11.2 kB

Total Files

15

Last publish

Collaborators

  • avatar