File tree Expand file tree Collapse file tree 6 files changed +51
-4
lines changed Expand file tree Collapse file tree 6 files changed +51
-4
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
+ /**
2
+ * Check whether a `node` is labelable:
3
+ * See: <https://html.spec.whatwg.org/#category-label>.
4
+ *
5
+ * @param {unknown } node
6
+ * @returns {boolean }
7
+ */
8
+ export function labelable ( node : unknown ) : boolean ;
Original file line number Diff line number Diff line change 1
- // Check whether a `node` is labelable:
2
- // See: <https://html.spec.whatwg.org/#category-label>.
1
+ /**
2
+ * Check whether a `node` is labelable:
3
+ * See: <https://html.spec.whatwg.org/#category-label>.
4
+ *
5
+ * @param {unknown } node
6
+ * @returns {boolean }
7
+ */
3
8
export function labelable ( node ) {
4
- var name = node && node . type === 'element' && node . tagName
9
+ /** @type {string } */
10
+ var name =
11
+ // @ts -ignore Looks like an object.
12
+ node && typeof node === 'object' && node . type === 'element' && node . tagName
5
13
6
14
return Boolean (
7
15
name === 'button' ||
@@ -12,6 +20,7 @@ export function labelable(node) {
12
20
name === 'select' ||
13
21
name === 'textarea' ||
14
22
( name === 'input' &&
23
+ // @ts -ignore Looks like an object.
15
24
( node . properties && node . properties . type ) !== 'hidden' )
16
25
)
17
26
}
Original file line number Diff line number Diff line change 25
25
"sideEffects" : false ,
26
26
"type" : " module" ,
27
27
"main" : " index.js" ,
28
+ "types" : " index.d.ts" ,
28
29
"files" : [
30
+ " index.d.ts" ,
29
31
" index.js"
30
32
],
31
33
"devDependencies" : {
34
+ "@types/tape" : " ^4.0.0" ,
32
35
"c8" : " ^7.0.0" ,
33
36
"prettier" : " ^2.0.0" ,
34
37
"remark-cli" : " ^9.0.0" ,
35
38
"remark-preset-wooorm" : " ^8.0.0" ,
39
+ "rimraf" : " ^3.0.0" ,
36
40
"tape" : " ^5.0.0" ,
41
+ "type-coverage" : " ^2.0.0" ,
42
+ "typescript" : " ^4.0.0" ,
37
43
"xo" : " ^0.39.0"
38
44
},
39
45
"scripts" : {
46
+ "prepack" : " npm run build && npm run format" ,
47
+ "build" : " rimraf \" *.d.ts\" && tsc && type-coverage" ,
40
48
"format" : " remark . -qfo && prettier . -w --loglevel warn && xo --fix" ,
41
49
"test-api" : " node test.js" ,
42
50
"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"
44
52
},
45
53
"prettier" : {
46
54
"tabWidth" : 2 ,
61
69
"plugins" : [
62
70
" preset-wooorm"
63
71
]
72
+ },
73
+ "typeCoverage" : {
74
+ "atLeast" : 100 ,
75
+ "detail" : true ,
76
+ "strict" : true
64
77
}
65
78
}
Original file line number Diff line number Diff line change
1
+ export { } ;
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