1- import { JsonNode , ConNode , ValNode , ObjNode , VecNode , StrNode , BinNode , ArrNode } from " ../nodes" ;
2- import { NodeBuilder , s } from " ../../json-crdt-patch" ;
3- import type { JsonNodeToSchema } from " ./types" ;
1+ import { JsonNode , ConNode , ValNode , ObjNode , VecNode , StrNode , BinNode , ArrNode } from ' ../nodes' ;
2+ import { NodeBuilder , s } from ' ../../json-crdt-patch' ;
3+ import type { JsonNodeToSchema } from ' ./types' ;
44
55/**
66 * Converts any JSON CRDT node to a schema representation. The schema can be
77 * used to copy the structure of the JSON CRDT node to another document or
88 * another location in the same document.
9- *
10- * @todo Add type generic.
11- *
9+ *
1210 * @param node JSON CRDT node to recursively convert to schema.
1311 * @returns Schema representation of the JSON CRDT node.
1412 */
@@ -17,7 +15,7 @@ export const toSchema = <N extends JsonNode<any>>(node: N): JsonNodeToSchema<N>
1715 if ( node instanceof ValNode ) return s . val ( toSchema ( node . node ( ) ) ) as any ;
1816 if ( node instanceof ObjNode ) {
1917 const obj : Record < string , NodeBuilder > = { } ;
20- node . nodes ( ( child , key ) => obj [ key ] = toSchema ( child ) ) ;
18+ node . nodes ( ( child , key ) => ( obj [ key ] = toSchema ( child ) ) ) ;
2119 return s . obj ( obj ) as any ;
2220 }
2321 if ( node instanceof VecNode ) {
0 commit comments