UNPKG

@cran/lib.vue.ref

Version:

Vue Reactivity Extensions

19 lines (16 loc) 459 B
import { computed } from "vue"; import { type ArrayPredicate, wrapArrayPredicate } from "./ArrayPredicate"; import { type MaybeWrapped, unwrap } from "../utility"; /** * @since 0.0.1 * @category Array * @inheritdoc Array#find */ export function useFind<T> ( values: MaybeWrapped<Array<MaybeWrapped<T>>>, predicate: ArrayPredicate<T> ) { return computed(function compute ( ) { return unwrap(values).find(wrapArrayPredicate(predicate)); }); }