UNPKG

505 BJavaScriptView Raw
1'use strict';
2
3const rangeOperators = ['>=', '<=', '>', '<', '='];
4const styleSearch = require('style-search');
5
6module.exports = function (atRule, cb) {
7 if (atRule.name.toLowerCase() !== 'media') {
8 return;
9 }
10
11 const params = atRule.raws.params ? atRule.raws.params.raw : atRule.params;
12
13 styleSearch({ source: params, target: rangeOperators }, (match) => {
14 const before = params[match.startIndex - 1];
15
16 if (before === '>' || before === '<') {
17 return;
18 }
19
20 cb(match, params, atRule);
21 });
22};