File tree 2 files changed +29
-28
lines changed
2 files changed +29
-28
lines changed Original file line number Diff line number Diff line change @@ -24,50 +24,51 @@ module.exports = function resolveNestedSelector(selector, node) {
24
24
return resolvedSelectors ;
25
25
}
26
26
27
+ var blockPairs = {
28
+ '(' : ')' ,
29
+ '[' : ']' ,
30
+ '{' : '}'
31
+ } ;
32
+
27
33
function split ( string , separator , splitFunctions ) {
28
- var blockPairs = {
29
- '(' : ')' ,
30
- '[' : ']' ,
31
- '{' : '}'
32
- }
33
- var array = [ ]
34
- var current = ''
35
- var split = false
34
+ var array = [ ] ;
35
+ var current = '' ;
36
+ var split = false ;
36
37
37
- var blockClose = [ ]
38
- var inQuote = false
39
- var prevQuote = ''
40
- var escape = false
38
+ var blockClose = [ ] ;
39
+ var inQuote = false ;
40
+ var prevQuote = '' ;
41
+ var escape = false ;
41
42
42
- for ( let letter of string ) {
43
+ for ( var letter of string ) {
43
44
if ( escape ) {
44
- escape = false
45
+ escape = false ;
45
46
} else if ( letter === '\\' ) {
46
- escape = true
47
+ escape = true ;
47
48
} else if ( inQuote ) {
48
49
if ( letter === prevQuote ) {
49
- inQuote = false
50
+ inQuote = false ;
50
51
}
51
52
} else if ( letter === '"' || letter === "'" ) {
52
- inQuote = true
53
- prevQuote = letter
53
+ inQuote = true ;
54
+ prevQuote = letter ;
54
55
} else if ( letter === '(' || letter === '[' || letter === '{' ) {
55
- blockClose . push ( blockPairs [ letter ] )
56
+ blockClose . push ( blockPairs [ letter ] ) ;
56
57
} else if ( letter === blockClose [ blockClose . length - 1 ] ) {
57
- blockClose . pop ( )
58
+ blockClose . pop ( ) ;
58
59
} else if ( blockClose . length === 0 || ( splitFunctions && blockClose . every ( ( x ) => x === ')' ) ) ) {
59
- if ( letter === separator ) split = true
60
+ if ( letter === separator ) split = true ;
60
61
}
61
62
62
63
if ( split ) {
63
- array . push ( current )
64
- current = ''
65
- split = false
64
+ array . push ( current ) ;
65
+ current = '' ;
66
+ split = false ;
66
67
} else {
67
- current += letter
68
+ current += letter ;
68
69
}
69
70
}
70
71
71
- array . push ( current )
72
- return array
72
+ array . push ( current ) ;
73
+ return array ;
73
74
}
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " postcss-resolve-nested-selector" ,
3
- "version" : " 0.1.4 " ,
3
+ "version" : " 0.1.5 " ,
4
4
"description" : " Resolve a nested selector in a PostCSS AST" ,
5
5
"main" : " index.js" ,
6
6
"scripts" : {
You can’t perform that action at this time.
0 commit comments