@rbxts/neturl
TypeScript icon, indicating that this package has built-in type declarations

1.1.1-ts.1 • Public • Published

🌐 NetUrl 🌐

roblox-ts typings for the NetUrl library, a URL and Query string parser, builder, and normalizer for Lua. Some useful links:

Installation

NPM

Run npm i @rbxts/neturl in your project directory.

Usage

To import:

import NetUrl from "@rbxts/neturl";

Below are some usage examples adapted from the NetUrl repository:

URL parser

const u = NetUrl.parse("http://www.example.com/test/?start=10");

print(u.scheme); // http
print(u.host); // www.example.com
print(u.path); // /test/

Querystring parser

const query = NetUrl.parseQuery("a=123&b=456");

print(query); // a=123&b=456
print(query.get("a")); // "123"
print(query.get("b")); // "456"
// Note: replace the type if using brackets in the query string:
const query = NetUrl.parseQuery<string | string[]>("first=abc&a[]=123&a[]=false&b[]=str&c[]=3.5&a[]=last");

print(query); // a[1]=123&a[2]=false&a[3]=last&b[1]=str&c[1]=3.5&first=abc
print(query.get("a")); // [ "3.5" ]

Package Sidebar

Install

npm i @rbxts/neturl

Weekly Downloads

1

Version

1.1.1-ts.1

License

MIT

Unpacked Size

20.4 kB

Total Files

5

Last publish

Collaborators

  • tacheometry