(
type: IteratorType,
k: K,
v?: V,
iteratorResult?:
| IteratorResult<K>
| IteratorResult<V>
| IteratorResult<[K, V]>
)
| 69 | iteratorResult?: IteratorResult<[K, V]> |
| 70 | ): IteratorResult<[K, V]> | undefined; |
| 71 | export function iteratorValue<K, V>( |
| 72 | type: IteratorType, |
| 73 | k: K, |
| 74 | v?: V, |
| 75 | iteratorResult?: |
| 76 | | IteratorResult<K> |
| 77 | | IteratorResult<V> |
| 78 | | IteratorResult<[K, V]> |
| 79 | ): IteratorResult<K> | IteratorResult<V> | IteratorResult<[K, V]> | undefined { |
| 80 | const value = |
| 81 | type === ITERATE_KEYS ? k : type === ITERATE_VALUES ? v : [k, v]; |
| 82 | // eslint-disable-next-line @typescript-eslint/no-unused-expressions -- TODO enable eslint here |
| 83 | iteratorResult |
| 84 | ? (iteratorResult.value = value) |
| 85 | : (iteratorResult = { |
| 86 | // @ts-expect-error ensure value is not undefined |
| 87 | value: value, |
| 88 | done: false, |
| 89 | }); |
| 90 | |
| 91 | return iteratorResult; |
| 92 | } |
| 93 | |
| 94 | export function iteratorDone(): IteratorReturnResult<undefined> { |
| 95 | return { value: undefined, done: true }; |
no outgoing calls
no test coverage detected