|
Download llama.cpp/tools/ui/node_modules/@braintree/sanitize-url/README.md from NGMISystems/test-check: direct link, hf CLI and curl.
- Browser
- Download file 1.38 kB
-
https://huggingface.co/NGMISystems/test-check/resolve/main/llama.cpp/tools/ui/node_modules/%40braintree/sanitize-url/README.md
- Command line
-
hf download hf://NGMISystems/test-check/llama.cpp/tools/ui/node_modules/@braintree/sanitize-url/README.md
-
curl -L -o README.md https://huggingface.co/NGMISystems/test-check/resolve/main/llama.cpp/tools/ui/node_modules/%40braintree/sanitize-url/README.md
1.38 kB
| # sanitize-url | |
| ## Installation | |
| ```sh | |
| npm install -S @braintree/sanitize-url | |
| ``` | |
| ## Usage | |
| ```js | |
| 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( | |
| "https://example.com", | |
| ); // https://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' | |
| // HTML encoded javascript:alert('XSS') | |
| sanitizeUrl( | |
| "javascript:alert('XSS')", | |
| ); // 'about:blank' | |
| ``` | |
| ## Testing | |
| This library uses [Vitest](https://vitest.dev/). All testing dependencies | |
| will be installed upon `npm install` and the test suite can be executed with | |
| `npm test`. Running the test suite will also run lint checks upon exiting. | |
| npm test | |
| To generate a coverage report, use `npm run coverage`. | |