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 11.DS_Store
2+ * .d.ts
23* .log
34coverage /
45node_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'
22import { hasProperty } from 'hast-util-has-property'
33import { embedded } from 'hast-util-embedded'
44import bodyOkLink from 'hast-util-is-body-ok-link'
55
6- var list = [
6+ var basic = convertElement ( [
77 'a' ,
88 'abbr' ,
99 // `area` is in fact only phrasing if it is inside a `map` element.
@@ -51,14 +51,21 @@ var list = [
5151 'u' ,
5252 'var' ,
5353 'wbr'
54- ]
54+ ] )
5555
56+ var meta = convertElement ( 'meta' )
57+
58+ /**
59+ * @param {unknown } node
60+ * @returns {boolean }
61+ */
5662export function phrasing ( node ) {
5763 return (
58- node . type === 'text' ||
59- isElement ( node , list ) ||
64+ // @ts -ignore Looks like a text.
65+ ( node && node . type === 'text' ) ||
66+ basic ( node ) ||
6067 embedded ( node ) ||
6168 bodyOkLink ( node ) ||
62- ( isElement ( node , 'meta' ) && hasProperty ( node , 'itemProp' ) )
69+ ( meta ( node ) && hasProperty ( node , 'itemProp' ) )
6370 )
6471}
Original file line number Diff line number Diff line change 2626 "sideEffects" : false ,
2727 "type" : " module" ,
2828 "main" : " index.js" ,
29+ "types" : " index.d.ts" ,
2930 "files" : [
31+ " index.d.ts" ,
3032 " index.js"
3133 ],
3234 "dependencies" : {
3638 "hast-util-is-element" : " ^2.0.0"
3739 },
3840 "devDependencies" : {
41+ "@types/tape" : " ^4.13.0" ,
3942 "c8" : " ^7.0.0" ,
4043 "hastscript" : " ^6.0.0" ,
4144 "prettier" : " ^2.0.0" ,
4245 "remark-cli" : " ^9.0.0" ,
4346 "remark-preset-wooorm" : " ^8.0.0" ,
47+ "rimraf" : " ^3.0.2" ,
4448 "tape" : " ^5.0.0" ,
49+ "type-coverage" : " ^2.17.3" ,
50+ "typescript" : " ^4.2.4" ,
4551 "unist-builder" : " ^3.0.0" ,
4652 "xo" : " ^0.39.0"
4753 },
4854 "scripts" : {
55+ "prepack" : " npm run build && npm run format" ,
56+ "build" : " rimraf \" *.d.ts\" && tsc && type-coverage" ,
4957 "format" : " remark . -qfo && prettier . -w --loglevel warn && xo --fix" ,
5058 "test-api" : " node test.js" ,
5159 "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"
5361 },
5462 "prettier" : {
5563 "tabWidth" : 2 ,
7078 "plugins" : [
7179 " preset-wooorm"
7280 ]
81+ },
82+ "typeCoverage" : {
83+ "atLeast" : 100 ,
84+ "detail" : true ,
85+ "strict" : true
7386 }
7487}
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