lib/utils/media-query.js
function queryCoversRange(lessRestrictive, moreRestrictive) {
  // Short curcuit if there is an exact match
  if (lessRestrictive === moreRestrictive) {
    return true;
  }

  const lessRestrictiveParts = explodeMediaQuery(lessRestrictive);
  const moreRestrictiveParts = explodeMediaQuery(moreRestrictive);

  return lessRestrictiveParts.reduce((orPrevious, lessAndParts) => {
    // Short curcuit if a previous part was not satisfied
    if (!orPrevious) {
      return false;
    }

    return moreRestrictiveParts.reduce((prev, moreAndParts) => {
      return (
        prev || arrayContainsAllElementsOfArray(lessAndParts, moreAndParts)
      );
    }, false);
  }, true);
}
function queryCoversRange(lessRestrictive, moreRestrictive) {
  // Short curcuit if there is an exact match
  if (lessRestrictive === moreRestrictive) {
    return true;
  }

  const lessRestrictiveParts = explodeMediaQuery(lessRestrictive);
  const moreRestrictiveParts = explodeMediaQuery(moreRestrictive);

  return lessRestrictiveParts.reduce((orPrevious, lessAndParts) => {
    // Short curcuit if a previous part was not satisfied
    if (!orPrevious) {
      return false;
    }

    return moreRestrictiveParts.reduce((prev, moreAndParts) => {
      return (
        prev || arrayContainsAllElementsOfArray(lessAndParts, moreAndParts)
      );
    }, false);
  }, true);
}
function queryCoversRange ( lessRestrictive , moreRestrictive ) { // Short curcuit if there is an exact match if ( lessRestrictive === moreRestrictive ) { return true ; } const lessRestrictiveParts = explodeMediaQuery ( lessRestrictive ) ; const moreRestrictiveParts = explodeMediaQuery ( moreRestrictive ) ; return lessRestrictiveParts . reduce ( ( orPrevious , lessAndParts ) => { // Short curcuit if a previous part was not satisfied if ( ! orPrevious ) { return false ; } return moreRestrictiveParts . reduce ( ( prev , moreAndParts ) => { return ( prev || arrayContainsAllElementsOfArray ( lessAndParts , moreAndParts ) ) ; } , false ) ; } , true ) ; }
Determine if the more restrictive media query covers all cases of the less restrictive one

For MQ "A" to contain MQ "B", "A" must be at least as specific as "B".

@example
// returns `true`
queryCoversRange('(min-width: 600px)', '(min-width: 600px) and (max-width: 800px)');

@example
// returns `false`
queryCoversRange('(min-width: 600px), (max-width: 700px)', '(min-width: 600px) and (max-width: 800px)');

@param {string} lessRestrictive
@param {string} moreRestrictive the media query to check membership of
@return {boolean}
Determine if the more restrictive media query covers all cases of the less restrictive one