()
| 17 | ); |
| 18 | |
| 19 | export const readStreakViewQueue = (): QueuedStreakView[] => { |
| 20 | try { |
| 21 | const raw = storageWrapper.getItem(STREAK_VIEW_QUEUE_KEY); |
| 22 | const parsed = raw ? JSON.parse(raw) : []; |
| 23 | |
| 24 | if (!Array.isArray(parsed)) { |
| 25 | return []; |
| 26 | } |
| 27 | |
| 28 | return parsed.filter( |
| 29 | (item): item is QueuedStreakView => |
| 30 | !!item && |
| 31 | typeof item.postId === 'string' && |
| 32 | typeof item.userId === 'string' && |
| 33 | typeof item.at === 'number', |
| 34 | ); |
| 35 | } catch { |
| 36 | return []; |
| 37 | } |
| 38 | }; |
| 39 | |
| 40 | const writeStreakViewQueue = (queue: QueuedStreakView[]): void => { |
| 41 | try { |
no outgoing calls
no test coverage detected