File tree 5 files changed +67
-3
lines changed
5 files changed +67
-3
lines changed Original file line number Diff line number Diff line change 20
20
"contributors" : [
21
21
" Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)"
22
22
],
23
+ "types" : " types/index.d.ts" ,
23
24
"files" : [
25
+ " types/index.d.ts" ,
24
26
" index.js"
25
27
],
26
- "dependencies" : {},
28
+ "dependencies" : {
29
+ "@types/unist" : " ^2.0.2"
30
+ },
27
31
"devDependencies" : {
28
32
"browserify" : " ^16.0.0" ,
33
+ "dtslint" : " ^0.4.2" ,
29
34
"nyc" : " ^13.0.0" ,
30
35
"prettier" : " ^1.12.1" ,
31
36
"remark-cli" : " ^6.0.0" ,
32
37
"remark-preset-wooorm" : " ^4.0.0" ,
33
38
"tape" : " ^4.5.1" ,
34
39
"tinyify" : " ^2.4.3" ,
40
+ "typescript" : " ^3.2.2" ,
35
41
"xo" : " ^0.23.0"
36
42
},
37
43
"scripts" : {
38
- "format" : " remark . -qfo && prettier --write '**/*.js ' && xo --fix" ,
44
+ "format" : " remark . -qfo && prettier --write '**/*.{js,ts} ' && xo --fix" ,
39
45
"build-bundle" : " browserify . -s unistUtilStringifyPosition > unist-util-stringify-position.js" ,
40
46
"build-mangle" : " browserify . -s unistUtilStringifyPosition -p tinyify > unist-util-stringify-position.min.js" ,
41
47
"build" : " npm run build-bundle && npm run build-mangle" ,
42
48
"test-api" : " node test" ,
43
49
"test-coverage" : " nyc --reporter lcov tape test.js" ,
44
- "test" : " npm run format && npm run build && npm run test-coverage"
50
+ "test-types" : " dtslint types" ,
51
+ "test" : " npm run format && npm run build && npm run test-coverage && npm run test-types"
45
52
},
46
53
"nyc" : {
47
54
"check-coverage" : true ,
Original file line number Diff line number Diff line change
1
+ // TypeScript Version: 3.0
2
+
3
+ import * as Unist from 'unist'
4
+
5
+ declare function unistUtilStringifyPosition (
6
+ value : Unist . Node | Unist . Position | Unist . Point
7
+ ) : string
8
+
9
+ export = unistUtilStringifyPosition
Original file line number Diff line number Diff line change
1
+ {
2
+ "compilerOptions" : {
3
+ "lib" : [" es2015" ],
4
+ "strict" : true ,
5
+ "noImplicitAny" : true ,
6
+ "noImplicitThis" : true ,
7
+ "strictNullChecks" : true ,
8
+ "strictFunctionTypes" : true ,
9
+ "baseUrl" : " ." ,
10
+ "paths" : {
11
+ "unist-util-stringify-position" : [" index.d.ts" ]
12
+ }
13
+ }
14
+ }
Original file line number Diff line number Diff line change
1
+ {
2
+ "extends" : " dtslint/dtslint.json" ,
3
+ "rules" : {
4
+ "callable-types" : false ,
5
+ "max-line-length" : false ,
6
+ "no-redundant-jsdoc" : false ,
7
+ "no-void-expression" : false ,
8
+ "only-arrow-functions" : false ,
9
+ "semicolon" : false ,
10
+ "unified-signatures" : false ,
11
+ "whitespace" : false ,
12
+ "interface-over-type-literal" : false
13
+ }
14
+ }
Original file line number Diff line number Diff line change
1
+ import stringify = require( 'unist-util-stringify-position' )
2
+
3
+ // Point
4
+ const stringValue : string = stringify ( { line : 2 , column : 3 } ) // => '2:3'
5
+
6
+ // Position
7
+ const stringValue2 : string = stringify ( {
8
+ start : { line : 2 , column : 1 } ,
9
+ end : { line : 3 , column : 1 }
10
+ } ) // => '2:1-3:1'
11
+
12
+ // Node
13
+ const stringValue3 : string = stringify ( {
14
+ type : 'text' ,
15
+ value : '!' ,
16
+ position : {
17
+ start : { line : 5 , column : 11 } ,
18
+ end : { line : 5 , column : 12 }
19
+ }
20
+ } ) // => '5:11-5:12'
You can’t perform that action at this time.
0 commit comments