char/avril

(wip) why'd you have to go and make things so complicaaaaated?

git clone https://git.t4t.associates/char/avril

Charlotte Somport URL extension to typescriptbf382b3

main
1.1 KiB34 linesraw
1declare module "ext:core/ops" {
2  export type URLParts = [
3    href: string,
4    origin: string,
5    protocol: string,
6    username: string,
7    password: string,
8    host: string,
9    hostname: string,
10    port: string,
11    pathname: string,
12    search: string,
13    hash: string,
14  ];
15  export type URLComponent =
16    | "href"
17    | "protocol"
18    | "username"
19    | "password"
20    | "host"
21    | "hostname"
22    | "port"
23    | "pathname"
24    | "search"
25    | "hash";
26  export type SearchPair = [name: string, value: string];
27
28  export function op_url_parse(args: [input: string, base: string | null]): URLParts | null;
29  // Non-href setters retain the original URL when a component cannot be changed.
30  export function op_url_set(args: [href: string, component: Exclude<URLComponent, "href">, value: string]): URLParts;
31  export function op_url_set(args: [href: string, component: URLComponent, value: string]): URLParts | null;
32  export function op_url_search_parse(query: string): SearchPair[];
33  export function op_url_search_serialize(pairs: readonly SearchPair[]): string;
34}