Skip to content

Commit 5f92eca

Browse files
committed
Expose Instance.cons
1 parent 89cd169 commit 5f92eca

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

lib/instance.d.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,14 @@ import type { Json } from "@hyperjump/json-pointer";
33

44
export const fromJs: (value: Json, uri?: string) => JsonNode;
55

6+
export const cons: (
7+
baseUri: string,
8+
pointer: string,
9+
value: Json,
10+
type: JsonNodeType,
11+
children: JsonNode[],
12+
parent?: JsonNode
13+
) => JsonNode;
614
export const get: (url: string, context: JsonNode) => JsonNode | undefined;
715
export const uri: (node: JsonNode) => string;
816
export const value: <A>(node: JsonNode) => A;
@@ -25,6 +33,8 @@ export type JsonNode = {
2533
parent: JsonNode;
2634
root: JsonNode;
2735
valid: boolean;
36+
errors: Record<string, string>;
37+
annotations: Record<string, Record<string, unknown>>;
2838
};
2939

3040
type JsonNodeType = "object" | "array" | "string" | "number" | "boolean" | "null" | "property";

lib/instance.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export const fromJs = (value, uri = "", pointer = "", parent = undefined) => {
4040
}
4141
};
4242

43-
const cons = (baseUri, pointer, value, type, children, parent) => {
43+
export const cons = (baseUri, pointer, value, type, children, parent) => {
4444
const node = {
4545
baseUri: baseUri ? toAbsoluteIri(baseUri) : "",
4646
pointer: pointer,

0 commit comments

Comments
 (0)