@adviser/cement - v0.0.0
    Preparing search index...

    Class URI

    Immutable URI representation with type-safe parameter handling.

    URI provides a read-only view of a URL with convenient methods for accessing components and query parameters. All URI instances are cached for performance. Use BuildURI for mutable construction and URI for immutable references.

    const uri = URI.from('https://example.com/path?key=value&foo=bar');

    // Access components
    console.log(uri.protocol); // "https:"
    console.log(uri.hostname); // "example.com"
    console.log(uri.pathname); // "/path"

    // Query parameters
    const key = uri.getParam('key'); // "value"
    const missing = uri.getParam('missing', 'default'); // "default"

    // Type-safe parameter extraction with Result
    const result = uri.getParamsResult('key', 'foo');
    if (result.isOk()) {
    const { key, foo } = result.unwrap();
    }

    // Build a modified version
    const modified = uri.build()
    .setParam('new', 'param')
    .URI();

    Implements

    Index

    Constructors

    Properties

    Accessors

    • get hostname(): string

      Returns string

    • get onlyHostAndSchema(): string

      Returns string

    • get withoutHostAndSchema(): string

      Returns string

    • get port(): string

      Returns string

    • get host(): string

      Returns string

    • get search(): string

      Returns string

    • get protocol(): string

      Returns string

    • get pathname(): string

      Returns string

    • get hash(): string

      Returns string

    • get getHashes(): Iterable<[string, string]>

      Returns Iterable<[string, string]>

    Methods

    • Parameters

      • protocol: string

      Returns () => void

    • Parameters

      • value: unknown

      Returns value is URI

    • Type Parameters

      • T extends string | undefined

      Parameters

      • key: string | OneKey<string, string>
      • Optionaldef: T

      Returns T extends string ? string : string | undefined