File tree Expand file tree Collapse file tree 1 file changed +6
-11
lines changed
packages/container-query-meta-builder/src Expand file tree Collapse file tree 1 file changed +6
-11
lines changed Original file line number Diff line number Diff line change 1- import { trim } from "lodash" ;
2-
31/**
42 * Extracts conditions as arrays from a single "param" string PostCSS provides
53 * for at-rules.
@@ -11,18 +9,15 @@ import { trim } from "lodash";
119export default function getConditionsFromQueryParams ( params ) {
1210 return params . split ( "," ) . map ( andParams => {
1311 return andParams . match ( / \( ( [ ^ \) ] * ) \) / g) . map ( condition => {
14- let conditionArr = trim ( condition , "()" ) ;
15-
16- conditionArr = conditionArr . match ( / ( [ a - z - ] * ) ( [ : > < = ] * ) ( [ a - z 0 - 9 \. ] * ) / i) ;
17- conditionArr . shift ( ) ;
18-
19- conditionArr = conditionArr . map ( trim ) ;
12+ const conditionArr = condition . match (
13+ / \( ( [ a - z - ] * ) * ( [: > <= ] * ) * ( [ a - z 0 - 9 \. ] * ) \) / i
14+ ) ;
2015
21- if ( [ "landscape" , "portrait" ] . indexOf ( conditionArr [ 2 ] ) === - 1 ) {
22- conditionArr [ 2 ] = parseFloat ( conditionArr [ 2 ] ) ;
16+ if ( [ "landscape" , "portrait" ] . indexOf ( conditionArr [ 3 ] ) === - 1 ) {
17+ conditionArr [ 3 ] = parseFloat ( conditionArr [ 3 ] ) ;
2318 }
2419
25- return conditionArr ;
20+ return conditionArr . slice ( 1 ) ;
2621 } ) ;
2722 } ) ;
2823}
You can’t perform that action at this time.
0 commit comments