File tree Expand file tree Collapse file tree 5 files changed +77
-2
lines changed Expand file tree Collapse file tree 5 files changed +77
-2
lines changed Original file line number Diff line number Diff line change 16
16
" Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)"
17
17
],
18
18
"files" : [
19
- " index.js"
19
+ " index.js" ,
20
+ " types/index.d.ts"
20
21
],
22
+ "types" : " types/index.d.ts" ,
21
23
"dependencies" : {
22
24
"is-empty" : " ^1.0.0"
23
25
},
24
26
"devDependencies" : {
27
+ "@types/unist" : " ^2.0.3" ,
25
28
"browserify" : " ^16.0.0" ,
26
29
"chalk" : " ^2.3.0" ,
30
+ "dtslint" : " ^1.0.2" ,
27
31
"nyc" : " ^14.0.0" ,
28
32
"prettier" : " ^1.0.0" ,
29
33
"remark-cli" : " ^6.0.0" ,
41
45
"build" : " npm run build-bundle && npm run build-mangle" ,
42
46
"test-api" : " node test" ,
43
47
"test-coverage" : " nyc --reporter lcov tape test.js" ,
44
- "test" : " npm run format && npm run build && npm run test-coverage"
48
+ "test" : " npm run format && npm run build && npm run test-coverage" ,
49
+ "dtslint" : " dtslint types"
45
50
},
46
51
"prettier" : {
47
52
"tabWidth" : 2 ,
Original file line number Diff line number Diff line change
1
+ // TypeScript Version: 3.0
2
+ import { Node } from 'unist' ;
3
+
4
+ export = inpect ;
5
+
6
+ /*
7
+ * Unist utility to inspect the details of a Unist Node
8
+ *
9
+ * @param node Node to inspect
10
+ */
11
+ declare function inpect ( node : Node ) : string ;
12
+
13
+ declare namespace inpect {
14
+ /**
15
+ * Inspect the given Node and include colors from the results
16
+ *
17
+ * @param node Node to inspect
18
+ */
19
+ function color ( node : Node ) : string ;
20
+
21
+ /**
22
+ * Inspect the given Node and exclude colors from the results
23
+ *
24
+ * @param node Node to inspect
25
+ */
26
+ function noColor ( node : Node ) : string ;
27
+ }
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-inspect" : [" index.d.ts" ]
8
+ }
9
+ }
10
+ }
Original file line number Diff line number Diff line change
1
+ {
2
+ "extends" : " dtslint/dtslint.json"
3
+ }
Original file line number Diff line number Diff line change
1
+ import * as inspect from 'unist-util-inspect' ;
2
+
3
+ const node = {
4
+ type : 'node' ,
5
+ data : {
6
+ string : 'string' ,
7
+ number : 1 ,
8
+ object : {
9
+ key : 'value'
10
+ } ,
11
+ array : [ ] ,
12
+ boolean : true ,
13
+ null : null
14
+ } ,
15
+ position : {
16
+ start : {
17
+ line : 1 ,
18
+ column : 1 ,
19
+ offset : 0
20
+ } ,
21
+ end : {
22
+ line : 1 ,
23
+ column : 4 ,
24
+ offset : 0
25
+ } ,
26
+ indent : [ 1 ]
27
+ }
28
+ } ;
29
+
30
+ const result : string = inspect ( node ) ;
You can’t perform that action at this time.
0 commit comments