UNPKG

@cran/lib.vue.ref

Version:

Vue Reactivity Extensions

21 lines (18 loc) 480 B
import { computed } from "vue"; import { type MaybeWrapped, unwrap } from "../utility"; /** * @since 0.0.1 * @category Array * @inheritdoc Array#indexOf */ export function useIndexOf<T> ( values: MaybeWrapped<Array<MaybeWrapped<T>>>, searchElement: MaybeWrapped<T>, fromIndex?: MaybeWrapped<number | undefined> ) { return computed(function compute ( ) { return unwrap(values).map<T>(unwrap).indexOf( unwrap(searchElement), unwrap(fromIndex) ); }); }