File tree Expand file tree Collapse file tree 6 files changed +68
-3
lines changed Expand file tree Collapse file tree 6 files changed +68
-3
lines changed Original file line number Diff line number Diff line change
1
+ package-lock = false
Original file line number Diff line number Diff line change 31
31
"author" : " Eugene Sharygin <eush77@gmail.com>" ,
32
32
"contributors" : [
33
33
" Eugene Sharygin <eush77@gmail.com>" ,
34
- " Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)"
34
+ " Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)" ,
35
+ " Christian Murphy <christian.murphy.42@gmail.com>"
35
36
],
36
37
"files" : [
37
38
" index.js" ,
38
- " lib/"
39
+ " lib/" ,
40
+ " types/index.d.ts"
39
41
],
42
+ "types" : " types/index.d.ts" ,
40
43
"dependencies" : {
41
44
"css-selector-parser" : " ^1.1.0" ,
42
45
"not" : " ^0.1.0" ,
45
48
"zwitch" : " ^1.0.3"
46
49
},
47
50
"devDependencies" : {
51
+ "dtslint" : " ^0.9.9" ,
48
52
"nyc" : " ^14.0.0" ,
49
53
"prettier" : " ^1.0.0" ,
50
54
"remark-cli" : " ^6.0.0" ,
57
61
"format" : " remark . -qfo && prettier --write \" **/*.js\" && xo --fix" ,
58
62
"test-api" : " node test" ,
59
63
"test-coverage" : " nyc --reporter lcov tape test/index.js" ,
60
- "test" : " npm run format && npm run test-coverage"
64
+ "test-types" : " dtslint types" ,
65
+ "test" : " npm run format && npm run test-coverage && npm run test-types"
61
66
},
62
67
"nyc" : {
63
68
"check-coverage" : true ,
Original file line number Diff line number Diff line change
1
+ // TypeScript Version: 3.5
2
+
3
+ import { Node } from 'unist'
4
+
5
+ /**
6
+ * Is there a match for the given selector in the Unist tree
7
+ *
8
+ * @param selector CSS-like selector
9
+ * @param tree Unist node or tree of nodes to search
10
+ */
11
+ declare function matches ( selector : string , tree : Node ) : boolean
12
+
13
+ /**
14
+ * Find first Node that matches selector
15
+ *
16
+ * @param selector CSS-like selector
17
+ * @param tree Unist node or tree of nodes to search
18
+ */
19
+ declare function select ( selector : string , tree : Node ) : Node | null
20
+
21
+ /**
22
+ * Find all Nodes that match selector
23
+ *
24
+ * @param selector CSS-like selector
25
+ * @param tree Unist node or tree of nodes to search
26
+ */
27
+ declare function selectAll ( selector : string , tree : Node ) : Node [ ]
28
+
29
+ export { matches , select , selectAll }
Original file line number Diff line number Diff line change
1
+ {
2
+ "compilerOptions" : {
3
+ "lib" : [" es2015" ],
4
+ "strict" : true ,
5
+ "baseUrl" : " ." ,
6
+ "paths" : {
7
+ "unist-util-select" : [" index.d.ts" ]
8
+ }
9
+ }
10
+ }
Original file line number Diff line number Diff line change
1
+ {
2
+ "extends" : " dtslint/dtslint.json" ,
3
+ "rules" : {
4
+ "whitespace" : false ,
5
+ "semicolon" : false
6
+ }
7
+ }
Original file line number Diff line number Diff line change
1
+ import { matches , select , selectAll } from 'unist-util-select'
2
+
3
+ matches ( ) // $ExpectError
4
+ matches ( '*' ) // $ExpectError
5
+ matches ( '*' , { type : 'root' } ) // $ExpectType boolean
6
+
7
+ select ( ) // $ExpectError
8
+ select ( '*' ) // $ExpectError
9
+ select ( '*' , { type : 'root' } ) // $ExpectType Node | null
10
+
11
+ selectAll ( ) // $ExpectError
12
+ selectAll ( '*' ) // $ExpectError
13
+ selectAll ( '*' , { type : 'root' } ) // $ExpectType Node[]
You can’t perform that action at this time.
0 commit comments