@@ -30,7 +30,7 @@ const configurable = true,
3030 * @param [root0.prev] - Key name for prev property (default: "prev")
3131 * @param [root0.siblings] - Key name for siblings property (default:
3232 * "siblings")
33- * @returns Object containing nodes, nodesMap and manipulation functions
33+ * @returns Object containing nodes, kvNodes and manipulation functions
3434 */
3535export default (
3636 tree : unObject [ ] ,
@@ -95,6 +95,7 @@ export default (
9595 } ,
9696 } ,
9797 } ;
98+
9899 /**
99100 * Generator function that traverses the tree and yields each node
100101 *
@@ -128,8 +129,9 @@ export default (
128129 } ,
129130 nodes = computed ( ( ) => [
130131 ...getNodes ( isReactive ( tree ) ? tree : reactive ( tree ) ) ,
131- ] ) ,
132- nodesMap = computed ( ( ) =>
132+ ] ) ;
133+
134+ const kvNodes = computed ( ( ) =>
133135 Object . fromEntries (
134136 nodes . value . map ( ( node ) => [ node [ keyId ] as string , node ] ) ,
135137 ) ,
@@ -143,7 +145,7 @@ export default (
143145 * @returns ID of the affected node or undefined
144146 */
145147 run = ( pId : string , action : string ) => {
146- const the = nodesMap . value [ pId ] ;
148+ const the = kvNodes . value [ pId ] ;
147149 if ( the ) {
148150 const [ root ] = nodes . value ,
149151 index = the [ keyIndex ] as number ,
@@ -236,6 +238,7 @@ export default (
236238 * @returns Undefined
237239 */
238240 down : ( pId : string ) => run ( pId , "down" ) ,
241+ kvNodes,
239242 /**
240243 * Moves the specified node one level up in the hierarchy, making it a
241244 * sibling of its parent
@@ -245,7 +248,6 @@ export default (
245248 */
246249 left : ( pId : string ) => run ( pId , "left" ) ,
247250 nodes,
248- nodesMap,
249251 /**
250252 * Removes the specified node from the tree
251253 *
0 commit comments