MCPcopy Create free account
hub / github.com/cn-docs/vueuse / useArrayMap

Function useArrayMap

packages/shared/useArrayMap/index.ts:13–18  ·  view source on GitHub ↗
(
  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 */
13export 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}

Callers 1

index.test.tsFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected