Skip to content

Commit b91c51d

Browse files
author
Jerry Bruwes
committed
modified: index.ts
1 parent 5884e9e commit b91c51d

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

index.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,16 +81,20 @@ const useFlatJsonTree: (
8181
},
8282
[keyNext]: {
8383
get(this: Record<string, unknown>) {
84-
return (this[keySiblings] as Record<string, unknown>[])[
85-
(this[keyIndex] as number) + 1
86-
];
84+
return (
85+
(this[keySiblings] as Record<string, unknown>[])[
86+
(this[keyIndex] as number) + 1
87+
] ?? null
88+
);
8789
},
8890
},
8991
[keyPrev]: {
9092
get(this: Record<string, unknown>) {
91-
return (this[keySiblings] as Record<string, unknown>[])[
92-
(this[keyIndex] as number) - 1
93-
];
93+
return (
94+
(this[keySiblings] as Record<string, unknown>[])[
95+
(this[keyIndex] as number) - 1
96+
] ?? null
97+
);
9498
},
9599
},
96100
};

0 commit comments

Comments
 (0)