@@ -109,14 +109,14 @@ export const NestedApi = ({ database }: { database: InternalDatabase }) => {
109
109
position ?: number ,
110
110
) : Promise < string > => {
111
111
const entries = await itAll ( iterator ( ) ) ;
112
- const sisterEntries = ( entries ) . filter ( ( entry ) =>
112
+ const sisterEntries = entries . filter ( ( entry ) =>
113
113
isSisterKey ( entry . key , key ) ,
114
114
) ;
115
115
key = asJoinedKey ( key ) ;
116
116
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 ) ;
120
120
121
121
// Avoid overwriting existing position; default to end of list
122
122
let scaledPosition : number | undefined = undefined ;
@@ -131,8 +131,10 @@ export const NestedApi = ({ database }: { database: InternalDatabase }) => {
131
131
} ) ;
132
132
}
133
133
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 ;
136
138
return database . addOperation ( {
137
139
op : "PUT" ,
138
140
key,
@@ -300,9 +302,9 @@ export const NestedApi = ({ database }: { database: InternalDatabase }) => {
300
302
}
301
303
302
304
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 ;
304
306
305
- return lengthDif || ( a . position - b . position )
307
+ return lengthDif || a . position - b . position ;
306
308
} ) ;
307
309
308
310
return toNested ( sorted ) ;
0 commit comments