Skip to content

Commit

Permalink
Fix datatype rendering issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Polleps authored and joepio committed May 14, 2024
1 parent 9b74325 commit 0de422b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions browser/lib/src/datatypes.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/** Each possible Atomic Datatype. See https://atomicdata.dev/collections/datatype */

import { Client } from './index.js';
import { urls } from './urls.js';
import type { JSONValue } from './value.js';

// TODO: use strings from `./urls`, requires TS fix: https://github.com/microsoft/TypeScript/issues/40793
Expand All @@ -27,9 +26,11 @@ export enum Datatype {
UNKNOWN = 'unknown-datatype',
}

const validDatatypes = new Set<string>(Object.values(Datatype));

/** Convert a URL to a Datatype */
export const datatypeFromUrl = (url: string): Datatype => {
if (url in urls.datatypes) {
if (validDatatypes.has(url)) {
return url as Datatype;
}

Expand Down

0 comments on commit 0de422b

Please # to comment.