1 import { normalize } from '@proton/shared/lib/helpers/string';
3 /** Searches for occurrences of the normalized `value` in
4 * the provided needles. Needles should already be normalized.
5 * Early termination is implicit via `some`. */
6 export const matchEvery =
8 (haystack: string): boolean => {
9 if (needles.length === 0) return false;
10 const normalizedHaystack = normalize(haystack, true);
11 return needles.every((needle) => normalizedHaystack.includes(needle));