No description
Find a file
2025-07-04 22:23:21 +05:30
.github/workflows Permissions jumbogram 2025-07-04 21:06:46 +05:30
src fix: more formatting errors in docs 2025-07-04 22:20:07 +05:30
tests add: tests: more cases 2025-07-04 22:18:01 +05:30
.gitignore feat: initial commit 2025-06-28 11:59:12 +05:30
ada.nimble bump: 0.1.0 -> 1.0.0 2025-07-04 20:37:12 +05:30
LICENSE feat: initial commit 2025-06-28 11:59:12 +05:30
README.md xxx: update README.md 2025-07-04 22:23:21 +05:30

nim-ada

This library provides low-level bindings and a high-level wrapper over ada-url, a high-performance and WHATWG-compliant URL parser written in C++.
The high-level wrapper manages memory for you via ORC move semantics.

Documentation for this library can be found here.

This library has been tested and confirmed to work with ada-url 3.2.1

installation

To add this library to your project, run the following command:

$ nimble add ada

If you simply wish to install it, run this command:

$ nimble install ada

examples

parsing a URL

import std/options
import pkg/ada

var url = parseURL("https://example.com/path?x=y")
echo url.hostname      ## example.com
echo url.pathname      ## /path?x=y
echo url.query.get()   ## ?x=y

validating a URL

import pkg/ada

let
  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"
  )