Skip to content

Commit 62bab26

Browse files
committed
Refactor code-style
1 parent 844589d commit 62bab26

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

index.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
* @typedef {import('hast').Element} HastElement
33
*
44
* @typedef {string|number} ConditionalPrimitive
5-
* @typedef {Object.<string, boolean>} ConditionalMap
6-
* @typedef {null|undefined|ConditionalPrimitive|ConditionalMap|Array.<ConditionalPrimitive|ConditionalMap|Array.<ConditionalPrimitive|ConditionalMap>>} Conditional
5+
* @typedef {Record<string, boolean>} ConditionalMap
6+
* @typedef {null|undefined|ConditionalPrimitive|ConditionalMap|Array<ConditionalPrimitive|ConditionalMap|Array<ConditionalPrimitive|ConditionalMap>>} Conditional
77
*
88
* @typedef {Record<string, boolean>} ClassMap
99
*/
@@ -16,13 +16,13 @@ const own = {}.hasOwnProperty
1616
* A bit inspired by <https://github.com/JedWatson/classnames>, but for hast.
1717
*
1818
* @param {HastElement|Conditional} [node]
19-
* @param {Array.<Conditional>} conditionals
19+
* @param {Array<Conditional>} conditionals
2020
*/
2121
export function classnames(node, ...conditionals) {
2222
let index = -1
2323
/** @type {ClassMap} */
2424
const map = Object.create(null)
25-
/** @type {Array.<string>} */
25+
/** @type {Array<string>} */
2626
const list = []
2727
/** @type {string} */
2828
let key
@@ -33,7 +33,7 @@ export function classnames(node, ...conditionals) {
3333
if (!node.properties) node.properties = {}
3434

3535
if (node.properties.className) {
36-
// @ts-expect-error Assume `classname` is `Array.<string>`
36+
// @ts-expect-error Assume `classname` is `Array<string>`
3737
add(map, node.properties.className)
3838
}
3939

@@ -61,7 +61,7 @@ function add(result, conditional) {
6161
let index = -1
6262
/** @type {string} */
6363
let key
64-
/** @type {Array.<string>} */
64+
/** @type {Array<string>} */
6565
let list
6666

6767
if (typeof conditional === 'number') {

readme.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,9 @@ A value that is either:
7070

7171
* `string` — One or more space-separated tokens (example: `alpha bravo`)
7272
* `number` — Single token that is cast to string (example: `123`)
73-
* `Object.<string, boolean>` — Map where each field is a token, and each value
73+
* `Record<string, boolean>` — Map where each field is a token, and each value
7474
turns it either on or off
75-
* `Conditional[]` — List of more conditionals
75+
* `Array<Conditional>` — List of more conditionals
7676
* Other values are ignored
7777

7878
## Security

0 commit comments

Comments
 (0)