@cran/lib.vue.ref
Version:
Vue Reactivity Extensions
25 lines (20 loc) • 575 B
text/typescript
import type { ArrayPredicate } from "./ArrayPredicate";
import { type MaybeWrapped, eagerComputed, unwrap } from "../utility";
/**
* @since 0.0.1
* @category Array
*/
export function useNone<T> (
values: MaybeWrapped<Array<MaybeWrapped<T>>>,
predicate: ArrayPredicate<T>
) {
return eagerComputed(function compute ( ) {
const unwrapped = unwrap(values);
for (let index = 0, { length, } = unwrapped; index < length; ++index) {
if (predicate(unwrap(unwrapped[index]!), index, unwrapped)) {
return false;
}
}
return true;
});
}