Skip to content

Commit 4d6f005

Browse files
committed
fix: code cleanup and random(Key)
1 parent 846dfea commit 4d6f005

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

packages/indexeddb/src/lib/IndexedDBProvider.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -177,22 +177,20 @@ export class IndexedDBProvider<StoredValue = unknown> extends JoshProvider<Store
177177

178178
const { count, duplicates } = payload;
179179
const unique = !duplicates; // Duplicates is too hard for my head to work around
180-
181-
payload.data = [];
182-
183180
const keys = await this.db.getKeys();
184181

185-
console.log('Hey shitass', keys.length, count, unique && keys.length < count);
186-
187-
if (unique && keys.length > count) {
182+
if (unique && keys.length < count) {
188183
payload.errors.push(this.error({ identifier: CommonIdentifiers.InvalidCount }));
189184
return payload;
190185
}
191186

192187
if (keys.length === 0) {
188+
payload.errors.push(this.error({ identifier: CommonIdentifiers.MissingData }));
193189
return payload;
194190
}
195191

192+
payload.data = [];
193+
196194
if (unique && keys.length === count) {
197195
payload.data = keys;
198196
return payload;

0 commit comments

Comments
 (0)