Neutralize Pesky Miscreants

    @braintree/sanitize-url
    TypeScript icon, indicating that this package has built-in type declarations

    5.0.2 • 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

    442,428

    Version

    5.0.2

    License

    MIT

    Unpacked Size

    12.3 kB

    Total Files

    16

    Last publish

    Collaborators

    • braintree