(mediaQueryString: string, cachedQueries: string[])
| 951 | } |
| 952 | |
| 953 | export function matchMediaQueryString(mediaQueryString: string, cachedQueries: string[]): boolean { |
| 954 | // It can be a single or multiple queries in case of nested media queries |
| 955 | const mediaQueryStrings = mediaQueryString.split(MEDIA_QUERY_SEPARATOR); |
| 956 | |
| 957 | return mediaQueryStrings.every((mq) => { |
| 958 | let isMatching: boolean; |
| 959 | |
| 960 | // Query has already been validated |
| 961 | if (cachedQueries.includes(mq)) { |
| 962 | isMatching = true; |
| 963 | } else { |
| 964 | isMatching = checkIfMediaQueryMatches(mq); |
| 965 | if (isMatching) { |
| 966 | cachedQueries.push(mq); |
| 967 | } |
| 968 | } |
| 969 | return isMatching; |
| 970 | }); |
| 971 | } |
| 972 | |
| 973 | interface SelectorMap { |
| 974 | [key: string]: SelectorCore[]; |
no test coverage detected