Skip to content

Commit

Permalink
Support inverted media queries
Browse files Browse the repository at this point in the history
  • Loading branch information
vis97c committed Jun 19, 2024
1 parent 715bcbc commit 42ded49
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
14 changes: 8 additions & 6 deletions lib/create-sort.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,14 @@ function _testQuery(doubleTestTrue, doubleTestFalse, singleTest) {
* @return {boolean}
*/
return function (query) {
if (doubleTestTrue.test(query)) {
return true;
} else if (doubleTestFalse.test(query)) {
return false;
}
return singleTest.test(query);
let result;

if (doubleTestTrue.test(query)) result = true;
else if (doubleTestFalse.test(query)) result = false;
else result = singleTest.test(query);

/** Not keyword inverts the whole query */
return query.includes('not') ? !result : result;
};
}

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,4 @@
"mkdirp": "^1.0.4",
"prettier": "^2.3.0"
}
}
}

0 comments on commit 42ded49

Please sign in to comment.