Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Module

x/ldkit/library/namespace.ts>createNamespace

LDkit - Linked Data query toolkit for TypeScript developers
Latest
function createNamespace
import { createNamespace } from "https://deno.land/x/ldkit@2.0.0/library/namespace.ts";

Creates a strongly typed container for Linked Data vocabulary to provide type safe access to all vocabulary terms as well as IDE autocompletion.

Examples

Example 1

import { createNamespace } from "ldkit";

const onto = createNamespace(
  {
    iri: "http://www.example.com/ontology#",
    prefix: "onto:",
    terms: [
      "object",
      "predicate",
      "subject",
    ],
  } as const,
);

console.log(onto.subject); // prints http://www.example.com/ontology#subject
console.log(onto.unknown); // TypeScript error! This term does not exist

Parameters

namespaceSpec: N

Specification of the namespace