File tree Expand file tree Collapse file tree 5 files changed +67
-3
lines changed Expand file tree Collapse file tree 5 files changed +67
-3
lines changed Original file line number Diff line number Diff line change 2020 "contributors" : [
2121 " Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)"
2222 ],
23+ "types" : " types/index.d.ts" ,
2324 "files" : [
25+ " types/index.d.ts" ,
2426 " index.js"
2527 ],
26- "dependencies" : {},
28+ "dependencies" : {
29+ "@types/unist" : " ^2.0.2"
30+ },
2731 "devDependencies" : {
2832 "browserify" : " ^16.0.0" ,
33+ "dtslint" : " ^0.4.2" ,
2934 "nyc" : " ^13.0.0" ,
3035 "prettier" : " ^1.12.1" ,
3136 "remark-cli" : " ^6.0.0" ,
3237 "remark-preset-wooorm" : " ^4.0.0" ,
3338 "tape" : " ^4.5.1" ,
3439 "tinyify" : " ^2.4.3" ,
40+ "typescript" : " ^3.2.2" ,
3541 "xo" : " ^0.23.0"
3642 },
3743 "scripts" : {
38- "format" : " remark . -qfo && prettier --write '**/*.js ' && xo --fix" ,
44+ "format" : " remark . -qfo && prettier --write '**/*.{js,ts} ' && xo --fix" ,
3945 "build-bundle" : " browserify . -s unistUtilStringifyPosition > unist-util-stringify-position.js" ,
4046 "build-mangle" : " browserify . -s unistUtilStringifyPosition -p tinyify > unist-util-stringify-position.min.js" ,
4147 "build" : " npm run build-bundle && npm run build-mangle" ,
4248 "test-api" : " node test" ,
4349 "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"
4552 },
4653 "nyc" : {
4754 "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