Function
useArrayMap
(
list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>,
fn: (element: T, index: number, array: T[]) => U,
)
Source from the content-addressed store, hash-verified
| 11 | * @returns a new array with each element being the result of the callback function. |
| 12 | */ |
| 13 | export function useArrayMap<T, U = T>( |
| 14 | list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>, |
| 15 | fn: (element: T, index: number, array: T[]) => U, |
| 16 | ): ComputedRef<U[]> { |
| 17 | return computed(() => toValue(list).map(i => toValue(i)).map(fn)) |
| 18 | } |
Tested by
no test coverage detected