@aegisjsproject/url

1.0.3 • Public • Published

@aegisjsproject/url

Safe URL parsing/escaping via JS tagged templates

CodeQL Node CI Lint Code Base

GitHub license GitHub last commit GitHub release GitHub Sponsors

npm node-current npm bundle size gzipped npm

GitHub followers GitHub forks GitHub stars Twitter Follow

Donate using Liberapay


Installation

npm i @aegisjsproject/url

Usage

import { url } from '@aegisjsproject/url';

// Santize user input (encodes and escapes as necessary)
const url1 = url`https://example.com/${userInput}`;
const url2 = url`${location.origin}/path/${someVar}`;

// Create a `blob:` URI from a file
const file = new File(['Hello, World!'], hi.txt, { type: 'text/plain' });
const download = `<a href="${url`file`}" download="${file.name}">Download File</a>`;

Package Sidebar

Install

npm i @aegisjsproject/url

Weekly Downloads

68

Version

1.0.3

License

MIT

Unpacked Size

47.9 kB

Total Files

13

Last publish

Collaborators

  • shgysk8zer0