https://github.com/ferus-web/nim-ada
Safe, high-level wrapper over ada-url. Ada is an efficient and spec-compliant URL parser.
https://github.com/ferus-web/nim-ada
ada-url bindings nim parser url whatwg
Last synced: 4 months ago
JSON representation
Safe, high-level wrapper over ada-url. Ada is an efficient and spec-compliant URL parser.
- Host: GitHub
- URL: https://github.com/ferus-web/nim-ada
- Owner: ferus-web
- License: mit
- Created: 2025-06-28T06:30:53.000Z (4 months ago)
- Default Branch: master
- Last Pushed: 2025-06-28T06:40:44.000Z (4 months ago)
- Last Synced: 2025-06-28T07:35:13.211Z (4 months ago)
- Topics: ada-url, bindings, nim, parser, url, whatwg
- Language: Nim
- Homepage:
- Size: 3.91 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# nim-ada
This library provides low-level bindings and a high-level wrapper over [ada-url](https://github.com/ada-url/ada), a high-performance and WHATWG-compliant URL parser written in C++. \
The high-level wrapper manages memory for you via ORC move semantics.## examples
### parsing a URL
```nim
import std/options
import pkg/adavar url = parseURL("https://example.com/path?x=y")
echo url.hostname ## example.com/path?x=y
echo url.pathname ## /path?x=y
echo url.query.get() ## ?x=y
```### validating a URL
```nim
import pkg/adalet
urls = [
"https://github.com",
"https://lk.m.e,3.,ao????2.s.", # <--- These are technically valid URLs,
"mxl:://///dmnems.xyie", # <--- as the WhatWG URL spec is very forgiving for erroneous inputs.
"https://google.com",
"....", # <--- However, these two are not.
";:@;3!..//1@#;21" # <---
]for url in urls:
echo '[' & url & "]: " & (
if isValidURL(url):
"valid"
else:
"invalid"
)
```