Skip to content

⬅️ Back to Table of Contents

📄 index.ts

📊 Analysis Summary

Metric Count
🔧 Functions 1
📦 Imports 4
🟢 Vue Composition API 1
📑 Type Aliases 1

📚 Table of Contents

🛠️ File Location:

📂 packages/shared/useArrayFilter/index.ts

📦 Imports

Name Source
ComputedRef vue
MaybeRefOrGetter vue
computed vue
toValue vue

Vue Composition API

Name Type Reactive Variables Composables
computed computed none none

Functions

useArrayFilter(list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>, fn: (element: T, index: number, array: T[]) => element is S): UseArrayFilterReturn<S>

Code
export function useArrayFilter<T, S extends T>(
  list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>,
  fn: (element: T, index: number, array: T[]) => element is S,
): UseArrayFilterReturn<S>
  • JSDoc:

    /**
     * Reactive `Array.filter`
     *
     * @see https://vueuse.org/useArrayFilter
     * @param list - the array was called upon.
     * @param fn - a function that is called for every element of the given `list`. Each time `fn` executes, the returned value is added to the new array.
     *
     * @returns a shallow copy of a portion of the given array, filtered down to just the elements from the given array that pass the test implemented by the provided function. If no elements pass the test, an empty array will be returned.
     */
    

  • Parameters:

  • list: MaybeRefOrGetter<MaybeRefOrGetter<T>[]>
  • fn: (element: T, index: number, array: T[]) => element is S
  • Return Type: UseArrayFilterReturn<S>

Type Aliases

UseArrayFilterReturn<T = any = any>

type UseArrayFilterReturn<T = any = any> = ComputedRef<T[]>;