Comparing version 1.0.6 to 1.0.7
@@ -0,1 +1,18 @@ | ||
/** | ||
* This function parses a URL from user input (with potential typos in protocols, bad copy+paste, etc.) and returns a proper URL. | ||
* | ||
* ```ts | ||
* parse("example.com") // "https://example.com" | ||
* parse("http://example.com") // "http://example.com" | ||
* parse("https://example.com") // "https://example.com" | ||
* parse("ftp://example.com") // "https://example.com" | ||
* parse("example.com/path") // "https://example.com/path" | ||
* parse("example.com/path/to/resource") // "https://example.com/path/to/resource" | ||
* parse("example.com/path/to/resource?query=string") // "https://example.com/path/to/resource?query=string" | ||
* parse("example.com/path/to/resource?query=string#fragment") // "https://example.com/path/to/resource?query=string#fragment" | ||
* ``` | ||
* | ||
* @param url - The URL to parse. | ||
* @returns The parsed URL. | ||
*/ | ||
export declare const parse: (url: string) => string; | ||
@@ -2,0 +19,0 @@ declare const _default: { |
@@ -0,1 +1,18 @@ | ||
/** | ||
* This function parses a URL from user input (with potential typos in protocols, bad copy+paste, etc.) and returns a proper URL. | ||
* | ||
* ```ts | ||
* parse("example.com") // "https://example.com" | ||
* parse("http://example.com") // "http://example.com" | ||
* parse("https://example.com") // "https://example.com" | ||
* parse("ftp://example.com") // "https://example.com" | ||
* parse("example.com/path") // "https://example.com/path" | ||
* parse("example.com/path/to/resource") // "https://example.com/path/to/resource" | ||
* parse("example.com/path/to/resource?query=string") // "https://example.com/path/to/resource?query=string" | ||
* parse("example.com/path/to/resource?query=string#fragment") // "https://example.com/path/to/resource?query=string#fragment" | ||
* ``` | ||
* | ||
* @param url - The URL to parse. | ||
* @returns The parsed URL. | ||
*/ | ||
export const parse = (url) => { | ||
@@ -2,0 +19,0 @@ const parsedUrl = url.trim(); |
{ | ||
"name": "shurley", | ||
"version": "1.0.6", | ||
"version": "1.0.7", | ||
"description": "Validate or fix URLs from user input. People make mistakes!", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -0,1 +1,18 @@ | ||
/** | ||
* This function parses a URL from user input (with potential typos in protocols, bad copy+paste, etc.) and returns a proper URL. | ||
* | ||
* ```ts | ||
* parse("example.com") // "https://example.com" | ||
* parse("http://example.com") // "http://example.com" | ||
* parse("https://example.com") // "https://example.com" | ||
* parse("ftp://example.com") // "https://example.com" | ||
* parse("example.com/path") // "https://example.com/path" | ||
* parse("example.com/path/to/resource") // "https://example.com/path/to/resource" | ||
* parse("example.com/path/to/resource?query=string") // "https://example.com/path/to/resource?query=string" | ||
* parse("example.com/path/to/resource?query=string#fragment") // "https://example.com/path/to/resource?query=string#fragment" | ||
* ``` | ||
* | ||
* @param url - The URL to parse. | ||
* @returns The parsed URL. | ||
*/ | ||
export declare const parse: (url: string) => string; | ||
@@ -2,0 +19,0 @@ declare const _default: { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.parse = void 0; | ||
/** | ||
* This function parses a URL from user input (with potential typos in protocols, bad copy+paste, etc.) and returns a proper URL. | ||
* | ||
* ```ts | ||
* parse("example.com") // "https://example.com" | ||
* parse("http://example.com") // "http://example.com" | ||
* parse("https://example.com") // "https://example.com" | ||
* parse("ftp://example.com") // "https://example.com" | ||
* parse("example.com/path") // "https://example.com/path" | ||
* parse("example.com/path/to/resource") // "https://example.com/path/to/resource" | ||
* parse("example.com/path/to/resource?query=string") // "https://example.com/path/to/resource?query=string" | ||
* parse("example.com/path/to/resource?query=string#fragment") // "https://example.com/path/to/resource?query=string#fragment" | ||
* ``` | ||
* | ||
* @param url - The URL to parse. | ||
* @returns The parsed URL. | ||
*/ | ||
const parse = (url) => { | ||
@@ -5,0 +22,0 @@ const parsedUrl = url.trim(); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
36082
120