Skip to content

Commit 4112757

Browse files
committed
Refactor code-style
* Add more docs to JSDoc
1 parent 0c44d78 commit 4112757

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

index.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,20 @@
11
/**
22
* @typedef {import('hast').Root} Root
3-
* @typedef {Root['children'][number]|Root} Node
3+
* @typedef {import('hast').Content} Content
4+
*/
5+
6+
/**
7+
* @typedef {Content | Root} Node
48
*/
59

610
/**
711
* Check whether a `node` is labelable:
8-
* See: <https://html.spec.whatwg.org/#category-label>.
12+
* See: <https://html.spec.whatwg.org/multipage/forms.html#category-label>.
913
*
1014
* @param {Node} node
15+
* Node to check (typically `Element`).
1116
* @returns {boolean}
17+
* Whether `node` is a labelable element.
1218
*/
1319
export function labelable(node) {
1420
return Boolean(

readme.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@
2727

2828
## What is this?
2929

30-
This package is a small utility that checks if a node is labelable according to
31-
HTML.
30+
This package is a small utility that checks if a node is a labelable element
31+
according to HTML.
3232

3333
## When should I use this?
3434

@@ -206,7 +206,7 @@ abide by its terms.
206206

207207
[coc]: https://github.com/syntax-tree/.github/blob/main/code-of-conduct.md
208208

209-
[spec]: https://html.spec.whatwg.org/#category-label
209+
[spec]: https://html.spec.whatwg.org/multipage/forms.html#category-label
210210

211211
[hast]: https://github.com/syntax-tree/hast
212212

0 commit comments

Comments
 (0)