(
filterFn?: (value: WithVirtualProps<T, TKey>) => boolean,
)
| 64 | ): Array<ChangeMessage<WithVirtualProps<T, TKey>, TKey>> | void { |
| 65 | // Helper function to collect filtered results |
| 66 | const collectFilteredResults = ( |
| 67 | filterFn?: (value: WithVirtualProps<T, TKey>) => boolean, |
| 68 | ): Array<ChangeMessage<WithVirtualProps<T, TKey>, TKey>> => { |
| 69 | const result: Array<ChangeMessage<WithVirtualProps<T, TKey>, TKey>> = [] |
| 70 | for (const [key, value] of collection.entries()) { |
| 71 | // If no filter function is provided, include all items |
| 72 | if (filterFn?.(value) ?? true) { |
| 73 | result.push({ |
| 74 | type: `insert`, |
| 75 | key, |
| 76 | value, |
| 77 | }) |
| 78 | } |
| 79 | } |
| 80 | return result |
| 81 | } |
| 82 | |
| 83 | // Validate that limit without orderBy doesn't happen |
| 84 | if (options.limit !== undefined && !options.orderBy) { |
no test coverage detected