Skip to content

Commit

Permalink
Refactor code-style
Browse files Browse the repository at this point in the history
  • Loading branch information
wooorm committed May 27, 2022
1 parent 5e813f0 commit 3397a66
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
* @callback Handler
* @param {Context} ctx
* @param {P5Node} node
* @param {Array.<Child>} [children]
* @param {Array<Child>} [children]
* @returns {Node}
*
* @typedef Options
Expand Down Expand Up @@ -102,7 +102,7 @@ function transform(ctx, ast) {
/** @type {Handler} */
// @ts-expect-error: index is fine.
const fn = own.call(map, ast.nodeName) ? map[ast.nodeName] : element
/** @type {Array.<Child>|undefined} */
/** @type {Array<Child>|undefined} */
let children

// Element.
Expand Down Expand Up @@ -134,12 +134,12 @@ function transform(ctx, ast) {
* Transform children.
*
* @param {Context} ctx
* @param {Array.<P5Node>} children
* @returns {Array.<Child>}
* @param {Array<P5Node>} children
* @returns {Array<Child>}
*/
function nodes(ctx, children) {
let index = -1
/** @type {Array.<Child>} */
/** @type {Array<Child>} */
const result = []

while (++index < children.length) {
Expand All @@ -156,7 +156,7 @@ function nodes(ctx, children) {
*
* @type {Handler}
* @param {P5Document} ast
* @param {Array.<Child>} children
* @param {Array<Child>} children
* @returns {Root}
*/
function root(ctx, ast, children) {
Expand Down Expand Up @@ -217,13 +217,13 @@ function comment(_, ast) {
*
* @type {Handler}
* @param {P5Element} ast
* @param {Array.<ElementChild>} children
* @param {Array<ElementChild>} children
* @returns {Element}
*/
function element(ctx, ast, children) {
const fn = ctx.schema.space === 'svg' ? s : h
let index = -1
/** @type {Object.<string, string>} */
/** @type {Record<string, string>} */
const props = {}

while (++index < ast.attrs.length) {
Expand Down Expand Up @@ -280,7 +280,7 @@ function createLocation(ctx, node, location) {
}

if (ctx.verbose) {
/** @type {Object.<string, Position|null>} */
/** @type {Record<string, Position|null>} */
const props = {}
/** @type {string} */
let key
Expand Down

0 comments on commit 3397a66

Please sign in to comment.