Skip to content

Commit 9efb473

Browse files
committed
Fix code style
1 parent 2c66669 commit 9efb473

1 file changed

Lines changed: 15 additions & 6 deletions

File tree

index.js

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
let valueParser = require('postcss-value-parser');
1+
let valueParser = require('postcss-value-parser')
22

33
const PREFERS_COLOR_ONLY = /^\(\s*prefers-color-scheme\s*:\s*(dark|light)\s*\)$/
44
const PREFERS_COLOR = /\(\s*prefers-color-scheme\s*:\s*(dark|light)\s*\)/g
@@ -43,10 +43,14 @@ function extractLightDark(isDark, declarationValue) {
4343
function mutateLightDarkRec(isDark, parsed) {
4444
let wasMutated = false
4545
parsed.walk(node => {
46-
if (wasMutated || node.type !== 'function' || node.value !== 'light-dark') return
47-
46+
if (wasMutated || node.type !== 'function' || node.value !== 'light-dark') {
47+
return
48+
}
49+
4850
let light = node.nodes[0]
49-
let dark = node.nodes.find((x, i) => i > 0 && (x.type === 'word' || x.type === 'function'))
51+
let dark = node.nodes.find((child, index) => {
52+
return index > 0 && (child.type === 'word' || child.type === 'function')
53+
})
5054
Object.assign(node, isDark ? dark : light)
5155
mutateLightDarkRec(isDark, parsed)
5256
wasMutated = true
@@ -108,8 +112,13 @@ module.exports = (opts = {}) => {
108112

109113
return {
110114
AtRuleExit: {
111-
media: atrule => {
112-
if (!atrule.params.includes('dark') && !atrule.params.includes('light')) return
115+
media(atrule) {
116+
if (
117+
!atrule.params.includes('dark') &&
118+
!atrule.params.includes('light')
119+
) {
120+
return
121+
}
113122

114123
let params = atrule.params
115124
let fixedSelector = params.includes('dark') ? dark : light

0 commit comments

Comments
 (0)