Skip to content

Commit a4c177b

Browse files
committedApr 4, 2022
Refactor code-style
1 parent 63e5121 commit a4c177b

File tree

7 files changed

+11
-13
lines changed

7 files changed

+11
-13
lines changed
 

‎lib/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import {omission} from './omission/index.js'
1111
import {one} from './tree.js'
1212

1313
/**
14-
* @param {Node|Array.<Node>} node
14+
* @param {Node|Array<Node>} node
1515
* @param {Options} [options]
1616
* @returns {string}
1717
*/

‎lib/omission/omission.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const own = {}.hasOwnProperty
77
/**
88
* Factory to check if a given node can have a tag omitted.
99
*
10-
* @param {Object.<string, OmitHandle>} handlers
10+
* @param {Record<string, OmitHandle>} handlers
1111
* @returns {OmitHandle}
1212
*/
1313
export function omission(handlers) {

‎lib/omission/opening.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ function html(node) {
3535
*/
3636
function head(node) {
3737
const children = node.children
38-
/** @type {Array.<string>} */
38+
/** @type {Array<string>} */
3939
const seen = []
4040
let index = -1
4141
/** @type {Child} */

‎lib/tree.js

+4-6
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,7 @@ import {doctype} from './doctype.js'
1818
import {raw} from './raw.js'
1919
import {text} from './text.js'
2020

21-
/**
22-
* @type {Object.<string, Handle>}
23-
*/
21+
/** @type {Record<string, Handle>} */
2422
const handlers = {
2523
comment,
2624
doctype,
@@ -56,7 +54,7 @@ export function one(ctx, node, index, parent) {
5654
* @param {Parent} parent
5755
*/
5856
export function all(ctx, parent) {
59-
/** @type {Array.<string>} */
57+
/** @type {Array<string>} */
6058
const results = []
6159
const children = (parent && parent.children) || []
6260
let index = -1
@@ -80,7 +78,7 @@ export function element(ctx, node, index, parent) {
8078
schema.space === 'svg'
8179
? ctx.closeEmpty
8280
: ctx.voids.includes(node.tagName.toLowerCase())
83-
/** @type {Array.<string>} */
81+
/** @type {Array<string>} */
8482
const parts = []
8583
/** @type {string} */
8684
let last
@@ -138,7 +136,7 @@ export function element(ctx, node, index, parent) {
138136
* @returns {string}
139137
*/
140138
function serializeAttributes(ctx, props) {
141-
/** @type {Array.<string>} */
139+
/** @type {Array<string>} */
142140
const values = []
143141
let index = -1
144142
/** @type {string} */

‎lib/types.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
* @property {boolean} tightClose
7171
* @property {boolean} collapseEmpty
7272
* @property {boolean} dangerous
73-
* @property {Array.<string>} voids
73+
* @property {Array<string>} voids
7474
* @property {StringifyEntitiesOptions} entities
7575
* @property {boolean} close
7676
* @property {boolean} closeEmpty

‎package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,10 @@
6161
},
6262
"scripts": {
6363
"prepack": "npm run build && npm run format",
64-
"build": "rimraf \"{lib/omission/util/**,lib/omission/**,lib/**,test/**,}*.d.ts\" && tsc && type-coverage",
64+
"build": "rimraf \"{lib,test}/**/*.d.ts\" \"*.d.ts\" && tsc && type-coverage",
6565
"format": "remark . -qfo && prettier . -w --loglevel warn && xo --fix",
6666
"test-api": "node test/index.js",
67-
"test-coverage": "c8 --check-coverage --branches 100 --functions 100 --lines 100 --statements 100 --reporter lcov node test/index.js",
67+
"test-coverage": "c8 --check-coverage --100 --reporter lcov npm run test-api",
6868
"test": "npm run build && npm run format && npm run test-coverage"
6969
},
7070
"prettier": {

‎readme.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ However, `useNamedReferences`, `useShortestReferences`, and
7272
###### `options.voids`
7373

7474
Tag names of [*elements*][element] to serialize without closing tag
75-
(`Array.<string>`, default: [`html-void-elements`][html-void-elements]).
75+
(`Array<string>`, default: [`html-void-elements`][html-void-elements]).
7676

7777
Not used in the SVG space.
7878

0 commit comments

Comments
 (0)
Please sign in to comment.