File tree Expand file tree Collapse file tree 4 files changed +63
-1
lines changed Expand file tree Collapse file tree 4 files changed +63
-1
lines changed Original file line number Diff line number Diff line change 11.DS_Store
2+ * .d.ts
23* .log
34coverage /
45node_modules /
Original file line number Diff line number Diff line change 1+ /**
2+ * @typedef {import('unist').Position } Position
3+ * @typedef {import('unist').Point } Point
4+ *
5+ * @typedef {Partial<Point> } PointLike
6+ *
7+ * @typedef {Object } PositionLike
8+ * @property {PointLike } [start]
9+ * @property {PointLike } [end]
10+ *
11+ * @typedef {Object } NodeLike
12+ * @property {PositionLike } [position]
13+ */
14+
115export var pointStart = point ( 'start' )
216export var pointEnd = point ( 'end' )
317
18+ /**
19+ * Get the positional info of `node`.
20+ *
21+ * @param {NodeLike } [node]
22+ * @returns {Position }
23+ */
424export function position ( node ) {
525 return { start : pointStart ( node ) , end : pointEnd ( node ) }
626}
727
28+ /**
29+ * Get the positional info of `node`.
30+ *
31+ * @param {'start'|'end' } type
32+ */
833function point ( type ) {
934 point . displayName = type
1035
1136 return point
1237
38+ /**
39+ * Get the positional info of `node`.
40+ *
41+ * @param {NodeLike } [node]
42+ * @returns {Point }
43+ */
1344 function point ( node ) {
45+ /** @type {Point } */
46+ // @ts -ignore looks like a point
1447 var point = ( node && node . position && node . position [ type ] ) || { }
1548
1649 return {
Original file line number Diff line number Diff line change 2525 "sideEffects" : false ,
2626 "type" : " module" ,
2727 "main" : " index.js" ,
28+ "types" : " index.d.ts" ,
2829 "files" : [
30+ " index.d.ts" ,
2931 " index.js"
3032 ],
3133 "devDependencies" : {
34+ "@types/tape" : " ^4.0.0" ,
3235 "c8" : " ^7.0.0" ,
3336 "prettier" : " ^2.0.0" ,
3437 "remark-cli" : " ^9.0.0" ,
3538 "remark-preset-wooorm" : " ^8.0.0" ,
39+ "rimraf" : " ^3.0.0" ,
3640 "tape" : " ^5.0.0" ,
41+ "type-coverage" : " ^2.0.0" ,
42+ "typescript" : " ^4.0.0" ,
3743 "xo" : " ^0.38.0"
3844 },
3945 "scripts" : {
46+ "prepack" : " npm run build && npm run format" ,
47+ "build" : " rimraf \" *.d.ts\" && tsc && type-coverage" ,
4048 "format" : " remark . -qfo && prettier . -w --loglevel warn && xo --fix" ,
4149 "test-api" : " node test.js" ,
4250 "test-coverage" : " c8 --check-coverage --branches 100 --functions 100 --lines 100 --statements 100 --reporter lcov node test.js" ,
43- "test" : " npm run format && npm run test-coverage"
51+ "test" : " npm run build && npm run format && npm run test-coverage"
4452 },
4553 "prettier" : {
4654 "tabWidth" : 2 ,
6270 "plugins" : [
6371 " preset-wooorm"
6472 ]
73+ },
74+ "typeCoverage" : {
75+ "atLeast" : 100 ,
76+ "detail" : true ,
77+ "strict" : true
6578 }
6679}
Original file line number Diff line number Diff line change 1+ {
2+ "include" : [" *.js" ],
3+ "compilerOptions" : {
4+ "target" : " ES2020" ,
5+ "lib" : [" ES2020" ],
6+ "module" : " ES2020" ,
7+ "moduleResolution" : " node" ,
8+ "allowJs" : true ,
9+ "checkJs" : true ,
10+ "declaration" : true ,
11+ "emitDeclarationOnly" : true ,
12+ "allowSyntheticDefaultImports" : true ,
13+ "skipLibCheck" : true
14+ }
15+ }
You can’t perform that action at this time.
0 commit comments