@metreeca/core - v0.9.17
    Preparing search index...

    Function createNamespace

    • Creates a namespace factory for generating IRIs within a common namespace.

      Returns a callable function that constructs IRIs by appending names to the namespace, enhanced with typed properties for each predefined term. This enables both dynamic IRI creation (ns("custom")) and type-safe access to known terms (ns.label).

      Type Parameters

      • const T extends readonly string[]

        The readonly array type of term names, inferred as const

      Parameters

      • namespace: string

        The namespace IRI to which names and terms are appended

      • Optionalterms: T

        Optional array of predefined term names to expose as typed properties

      Returns Namespace & Terms<T>

      A callable function accepting a name parameter, augmented with IRI properties for each term

      RangeError If the namespace or any term produces an invalid IRI during initialization. For closed namespaces, also throws when the factory is called with an undefined term name. For open namespaces, throws when the factory is called with a name that produces an invalid IRI.

      Open namespaces (no terms provided): Accept any term name dynamically, constructing IRIs on demand.

      Closed namespaces (terms provided): Restrict access to predefined terms only, throwing errors for undefined term names.