Skip to content

Commit

Permalink
perf(utils): only check atrule on 'atrule' nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
clshortfuse committed Jul 7, 2023
1 parent d9c6183 commit 08b9c2b
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions utils/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,13 @@ export function checkSelector(selector) {

/**
* @param {FeatureCheck|FeatureCheck[]} [name]
* @param {FeatureCheck|FeatureCheck[]} [params]
* @param {FeatureCheck|FeatureCheck[]} [parameters]
* @return {(rule:import('postcss').ChildNode) => boolean}
*/
export function checkAtRule(name, params) {
// @ts-ignore rule.name can be `undefined`
return (rule) => performFeatureCheck(name, rule.name)
// @ts-ignore rule.params can be `undefined`
&& (!params || performFeatureCheck(params, rule.params));
export function checkAtRule(name, parameters) {
return (rule) => rule.type === 'atrule'
&& performFeatureCheck(name, rule.name)
&& (!parameters || performFeatureCheck(parameters, rule.params));
}

/**
Expand Down

0 comments on commit 08b9c2b

Please sign in to comment.