-
Notifications
You must be signed in to change notification settings - Fork 0
/
mod.ts
38 lines (37 loc) · 1.33 KB
/
mod.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/**
* A Deno library for expanding shortened URLs to their full form.
*
* This library provides a simple and efficient way to resolve shortened URLs
* to their final destination by following redirects. It can return either just
* the expanded URL or detailed information including parsed components.
*
* @module
*
* @example
* ```ts
* import { expandUrl, expandUrlWithDetails } from "@varandas/expand-url";
*
* // Basic usage
* try {
* const fullUrl = await expandUrl("https://bit.ly/example");
* console.log(fullUrl); // https://example.com/very/long/url
* } catch (error) {
* console.error("Failed to expand URL:", error.message);
* }
*
* // Get detailed URL information
* try {
* const details = await expandUrlWithDetails("https://bit.ly/example?key=value#section");
* console.log(details.fullUrl); // https://example.com/very/long/url?key=value#section
* console.log(details.queryParams); // { key: "value" }
* console.log(details.hash); // "section"
* } catch (error) {
* console.error("Failed to expand URL:", error.message);
* }
* ```
*
* @see {@link https://github.com/andrevarandas/expand-url GitHub Repository}
* @see {@link https://jsr.io/@varandas/expand-url JSR Package}
*/
export type { ExpandedUrl } from "./src/types.ts";
export { expandUrl, expandUrlWithDetails } from "./src/expand_url.ts";