File tree Expand file tree Collapse file tree 4 files changed +43
-7
lines changed Expand file tree Collapse file tree 4 files changed +43
-7
lines changed Original file line number Diff line number Diff line change 1
1
.DS_Store
2
+ * .d.ts
2
3
* .log
3
4
coverage /
4
5
node_modules /
Original file line number Diff line number Diff line change 1
- import { isElement } from 'hast-util-is-element'
1
+ import { convertElement } from 'hast-util-is-element'
2
2
import { hasProperty } from 'hast-util-has-property'
3
3
import { embedded } from 'hast-util-embedded'
4
4
import bodyOkLink from 'hast-util-is-body-ok-link'
5
5
6
- var list = [
6
+ var basic = convertElement ( [
7
7
'a' ,
8
8
'abbr' ,
9
9
// `area` is in fact only phrasing if it is inside a `map` element.
@@ -51,14 +51,21 @@ var list = [
51
51
'u' ,
52
52
'var' ,
53
53
'wbr'
54
- ]
54
+ ] )
55
55
56
+ var meta = convertElement ( 'meta' )
57
+
58
+ /**
59
+ * @param {unknown } node
60
+ * @returns {boolean }
61
+ */
56
62
export function phrasing ( node ) {
57
63
return (
58
- node . type === 'text' ||
59
- isElement ( node , list ) ||
64
+ // @ts -ignore Looks like a text.
65
+ ( node && node . type === 'text' ) ||
66
+ basic ( node ) ||
60
67
embedded ( node ) ||
61
68
bodyOkLink ( node ) ||
62
- ( isElement ( node , 'meta' ) && hasProperty ( node , 'itemProp' ) )
69
+ ( meta ( node ) && hasProperty ( node , 'itemProp' ) )
63
70
)
64
71
}
Original file line number Diff line number Diff line change 26
26
"sideEffects" : false ,
27
27
"type" : " module" ,
28
28
"main" : " index.js" ,
29
+ "types" : " index.d.ts" ,
29
30
"files" : [
31
+ " index.d.ts" ,
30
32
" index.js"
31
33
],
32
34
"dependencies" : {
36
38
"hast-util-is-element" : " ^2.0.0"
37
39
},
38
40
"devDependencies" : {
41
+ "@types/tape" : " ^4.13.0" ,
39
42
"c8" : " ^7.0.0" ,
40
43
"hastscript" : " ^6.0.0" ,
41
44
"prettier" : " ^2.0.0" ,
42
45
"remark-cli" : " ^9.0.0" ,
43
46
"remark-preset-wooorm" : " ^8.0.0" ,
47
+ "rimraf" : " ^3.0.2" ,
44
48
"tape" : " ^5.0.0" ,
49
+ "type-coverage" : " ^2.17.3" ,
50
+ "typescript" : " ^4.2.4" ,
45
51
"unist-builder" : " ^3.0.0" ,
46
52
"xo" : " ^0.39.0"
47
53
},
48
54
"scripts" : {
55
+ "prepack" : " npm run build && npm run format" ,
56
+ "build" : " rimraf \" *.d.ts\" && tsc && type-coverage" ,
49
57
"format" : " remark . -qfo && prettier . -w --loglevel warn && xo --fix" ,
50
58
"test-api" : " node test.js" ,
51
59
"test-coverage" : " c8 --check-coverage --branches 100 --functions 100 --lines 100 --statements 100 --reporter lcov node test.js" ,
52
- "test" : " npm run format && npm run test-coverage"
60
+ "test" : " npm run build && npm run format && npm run test-coverage"
53
61
},
54
62
"prettier" : {
55
63
"tabWidth" : 2 ,
70
78
"plugins" : [
71
79
" preset-wooorm"
72
80
]
81
+ },
82
+ "typeCoverage" : {
83
+ "atLeast" : 100 ,
84
+ "detail" : true ,
85
+ "strict" : true
73
86
}
74
87
}
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