Skip to content

Commit 93cad17

Browse files
author
Jerry Bruwes
committed
modified: index.ts
1 parent 61c8f0c commit 93cad17

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

index.ts

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -77,12 +77,14 @@ export default (
7777

7878
const leaves = computed(() => getLeaves({ value }));
7979

80-
const atlas = computed(
81-
() => new Map(leaves.value.map((leaf) => [leaf[keyId] as string, leaf])),
80+
const atlas = computed(() =>
81+
Object.fromEntries(
82+
leaves.value.map((leaf) => [leaf[keyId] as string, leaf]),
83+
),
8284
);
8385

8486
const add = (pId: string) => {
85-
const the = atlas.value.get(pId);
87+
const the = atlas.value[pId];
8688
if (the) {
8789
const children = the[keyChildren] as
8890
| Record<string, unknown>[]
@@ -106,7 +108,7 @@ export default (
106108
return undefined;
107109
},
108110
down = (pId: string) => {
109-
const the = atlas.value.get(pId);
111+
const the = atlas.value[pId];
110112
if (the) {
111113
const index = the[keyIndex] as number,
112114
nextIndex = index + 1,
@@ -123,7 +125,7 @@ export default (
123125
}
124126
},
125127
left = (pId: string) => {
126-
const the = atlas.value.get(pId);
128+
const the = atlas.value[pId];
127129
if (the) {
128130
const parent = the[keyParent] as Record<string, unknown> | undefined;
129131
if (parent?.[keyParent]) {
@@ -143,7 +145,7 @@ export default (
143145
return undefined;
144146
},
145147
remove = (pId: string) => {
146-
const the = atlas.value.get(pId);
148+
const the = atlas.value[pId];
147149
if (the) {
148150
const parent = the[keyParent] as Record<string, unknown> | undefined;
149151
if (parent) {
@@ -162,7 +164,7 @@ export default (
162164
return undefined;
163165
},
164166
right = (pId: string) => {
165-
const the = atlas.value.get(pId);
167+
const the = atlas.value[pId];
166168
if (the) {
167169
const prev = the[keyPrev] as Record<string, unknown> | undefined;
168170
if (prev) {
@@ -182,7 +184,7 @@ export default (
182184
return undefined;
183185
},
184186
up = (pId: string) => {
185-
const the = atlas.value.get(pId);
187+
const the = atlas.value[pId];
186188
if (the) {
187189
const index = the[keyIndex] as number,
188190
prevIndex = index - 1,

0 commit comments

Comments
 (0)