@@ -109,14 +109,14 @@ export const NestedApi = ({ database }: { database: InternalDatabase }) => {
109109 position ?: number ,
110110 ) : Promise < string > => {
111111 const entries = await itAll ( iterator ( ) ) ;
112- const sisterEntries = ( entries ) . filter ( ( entry ) =>
112+ const sisterEntries = entries . filter ( ( entry ) =>
113113 isSisterKey ( entry . key , key ) ,
114114 ) ;
115115 key = asJoinedKey ( key ) ;
116116
117- const parent = parentKey ( key )
118- if ( parent && ! entries . find ( e => e . key === parent ) )
119- await putEntry ( parent )
117+ const parent = parentKey ( key ) ;
118+ if ( parent && ! entries . find ( ( e ) => e . key === parent ) )
119+ await putEntry ( parent ) ;
120120
121121 // Avoid overwriting existing position; default to end of list
122122 let scaledPosition : number | undefined = undefined ;
@@ -131,8 +131,10 @@ export const NestedApi = ({ database }: { database: InternalDatabase }) => {
131131 } ) ;
132132 }
133133
134- const entryValue : { value ?: DagCborEncodable , position : number } = { position : scaledPosition } ;
135- if ( value !== undefined ) entryValue . value = value
134+ const entryValue : { value ?: DagCborEncodable ; position : number } = {
135+ position : scaledPosition ,
136+ } ;
137+ if ( value !== undefined ) entryValue . value = value ;
136138 return database . addOperation ( {
137139 op : "PUT" ,
138140 key,
@@ -300,9 +302,9 @@ export const NestedApi = ({ database }: { database: InternalDatabase }) => {
300302 }
301303
302304 const sorted = values . toSorted ( ( a , b ) => {
303- const lengthDif = asSplitKey ( a . key ) . length - asSplitKey ( b . key ) . length
305+ const lengthDif = asSplitKey ( a . key ) . length - asSplitKey ( b . key ) . length ;
304306
305- return lengthDif || ( a . position - b . position )
307+ return lengthDif || a . position - b . position ;
306308 } ) ;
307309
308310 return toNested ( sorted ) ;
0 commit comments