Skip to content

Commit 497b867

Browse files
committed
Add improved jsdoc
1 parent 2beb3f0 commit 497b867

File tree

3 files changed

+22
-16
lines changed

3 files changed

+22
-16
lines changed

index.js

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,30 @@
1313
* @typedef {(<T extends string>(type: T) => {type: T})} BuildVoid
1414
*/
1515

16-
export var u = /**
16+
/**
17+
* Build a node.
18+
*
19+
* @param type
20+
* Node type.
21+
* @param [props]
22+
* Fields assigned to node.
23+
* @param [value]
24+
* Children of node or value of `node` (cast to string).
25+
* @returns
26+
* Built node.
27+
*/
28+
export const u = /**
1729
* @type {BuildVoid & BuildVoidWithProps & BuildLiteral & BuildLiteralWithProps & BuildParent & BuildParentWithProps}
1830
*/ (
1931
/**
20-
* @param {string} type Type of node
21-
* @param {Props|ChildrenOrValue} [props] Additional properties for node (or `children` or `value`)
22-
* @param {ChildrenOrValue} [value] `children` or `value` of node
32+
* @param {string} type
33+
* @param {Props|ChildrenOrValue} [props]
34+
* @param {ChildrenOrValue} [value]
2335
* @returns {Node}
2436
*/
2537
function (type, props, value) {
2638
/** @type {Node} */
27-
var node = {type: String(type)}
39+
const node = {type: String(type)}
2840

2941
if (
3042
(value === undefined || value === null) &&

package.json

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -72,13 +72,7 @@
7272
"trailingComma": "none"
7373
},
7474
"xo": {
75-
"prettier": true,
76-
"rules": {
77-
"capitalized-comments": "off",
78-
"import/no-mutable-exports": "off",
79-
"no-var": "off",
80-
"prefer-arrow-callback": "off"
81-
}
75+
"prettier": true
8276
},
8377
"remarkConfig": {
8478
"plugins": [

readme.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ There is no default export.
112112

113113
### `u(type[, props][, children|value])`
114114

115-
Creates a node from `props`, `children`, and optionally `value`.
115+
Build a node.
116116

117117
###### Signatures
118118

@@ -125,15 +125,15 @@ Creates a node from `props`, `children`, and optionally `value`.
125125
* `type` (`string`)
126126
— node type
127127
* `props` (`Record<string, unknown>`)
128-
other values assigned to `node`
128+
fields assigned to node
129129
* `children` ([`Array<Node>`][node])
130-
— children of `node`
130+
— children of node
131131
* `value` (`*`)
132132
— value of `node` (cast to string)
133133

134134
###### Returns
135135

136-
[`Node`][node].
136+
Built node ([`Node`][node]).
137137

138138
## Types
139139

0 commit comments

Comments
 (0)