File tree Expand file tree Collapse file tree 3 files changed +10
-18
lines changed Expand file tree Collapse file tree 3 files changed +10
-18
lines changed Original file line number Diff line number Diff line change 3
3
* @typedef {import('hast').Element } Element
4
4
*/
5
5
6
- var search = / [ # . ] / g
6
+ const search = / [ # . ] / g
7
7
8
8
/**
9
9
* Create a hast element from a simple CSS selector.
@@ -27,21 +27,17 @@ export const parseSelector =
27
27
* @returns {Element }
28
28
*/
29
29
function ( selector , defaultTagName = 'div' ) {
30
- var value = selector || ''
30
+ const value = selector || ''
31
31
/** @type {Properties } */
32
- var props = { }
33
- var start = 0
34
- /** @type {string } */
35
- var subvalue
36
- /** @type {string } */
37
- var previous
38
- /** @type {RegExpMatchArray } */
39
- var match
32
+ const props = { }
33
+ let start = 0
34
+ /** @type {string|undefined } */
35
+ let previous
40
36
41
37
while ( start < value . length ) {
42
38
search . lastIndex = start
43
- match = search . exec ( value )
44
- subvalue = value . slice ( start , match ? match . index : value . length )
39
+ const match = search . exec ( value )
40
+ const subvalue = value . slice ( start , match ? match . index : value . length )
45
41
46
42
if ( subvalue ) {
47
43
if ( ! previous ) {
Original file line number Diff line number Diff line change 74
74
"trailingComma" : " none"
75
75
},
76
76
"xo" : {
77
- "prettier" : true ,
78
- "rules" : {
79
- "no-var" : " off" ,
80
- "prefer-arrow-callback" : " off"
81
- }
77
+ "prettier" : true
82
78
},
83
79
"remarkConfig" : {
84
80
"plugins" : [
Original file line number Diff line number Diff line change 1
1
import test from 'tape'
2
2
import { parseSelector } from './index.js'
3
3
4
- test ( 'parseSelector()' , function ( t ) {
4
+ test ( 'parseSelector()' , ( t ) => {
5
5
t . deepEqual (
6
6
parseSelector ( ) ,
7
7
{
You can’t perform that action at this time.
0 commit comments