Skip to content

Commit b7ffc07

Browse files
committed
Refactor code-style
1 parent 37c7fe3 commit b7ffc07

File tree

4 files changed

+13
-13
lines changed

4 files changed

+13
-13
lines changed

index.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
* @typedef {import('unist').Parent} Parent
44
*
55
* @typedef {string} Type
6-
* @typedef {Object<string, unknown>} Props
6+
* @typedef {Record<string, unknown>} Props
77
*
8-
* @typedef {null|undefined|Type|Props|TestFunctionAnything|Array.<Type|Props|TestFunctionAnything>} Test
8+
* @typedef {null|undefined|Type|Props|TestFunctionAnything|Array<Type|Props|TestFunctionAnything>} Test
99
*/
1010

1111
/**
@@ -73,8 +73,8 @@
7373
export const is =
7474
/**
7575
* @type {(
76-
* (<ExplicitNode extends Node>(node: unknown, test: ExplicitNode['type']|Partial<ExplicitNode>|TestFunctionPredicate<ExplicitNode>|Array.<ExplicitNode['type']|Partial<ExplicitNode>|TestFunctionPredicate<ExplicitNode>>, index: number, parent: Parent, context?: unknown) => node is ExplicitNode) &
77-
* (<ExplicitNode extends Node>(node: unknown, test: ExplicitNode['type']|Partial<ExplicitNode>|TestFunctionPredicate<ExplicitNode>|Array.<ExplicitNode['type']|Partial<ExplicitNode>|TestFunctionPredicate<ExplicitNode>>, index?: null|undefined, parent?: null|undefined, context?: unknown) => node is ExplicitNode) &
76+
* (<ExplicitNode extends Node>(node: unknown, test: ExplicitNode['type']|Partial<ExplicitNode>|TestFunctionPredicate<ExplicitNode>|Array<ExplicitNode['type']|Partial<ExplicitNode>|TestFunctionPredicate<ExplicitNode>>, index: number, parent: Parent, context?: unknown) => node is ExplicitNode) &
77+
* (<ExplicitNode extends Node>(node: unknown, test: ExplicitNode['type']|Partial<ExplicitNode>|TestFunctionPredicate<ExplicitNode>|Array<ExplicitNode['type']|Partial<ExplicitNode>|TestFunctionPredicate<ExplicitNode>>, index?: null|undefined, parent?: null|undefined, context?: unknown) => node is ExplicitNode) &
7878
* ((node: unknown, test: Test, index: number, parent: Parent, context?: unknown) => boolean) &
7979
* ((node?: unknown, test?: Test, index?: null|undefined, parent?: null|undefined, context?: unknown) => boolean)
8080
* )}
@@ -163,11 +163,11 @@ export const convert =
163163
}
164164
)
165165
/**
166-
* @param {Array.<Type|Props|TestFunctionAnything>} tests
166+
* @param {Array<Type|Props|TestFunctionAnything>} tests
167167
* @returns {AssertAnything}
168168
*/
169169
function anyFactory(tests) {
170-
/** @type {Array.<AssertAnything>} */
170+
/** @type {Array<AssertAnything>} */
171171
const checks = []
172172
let index = -1
173173

@@ -179,7 +179,7 @@ function anyFactory(tests) {
179179

180180
/**
181181
* @this {unknown}
182-
* @param {unknown[]} parameters
182+
* @param {Array<unknown>} parameters
183183
* @returns {boolean}
184184
*/
185185
function any(...parameters) {
@@ -249,7 +249,7 @@ function castFactory(check) {
249249

250250
/**
251251
* @this {unknown}
252-
* @param {Array.<unknown>} parameters
252+
* @param {Array<unknown>} parameters
253253
* @returns {boolean}
254254
*/
255255
function assertion(...parameters) {

readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ There is no default export.
5858
###### Parameters
5959

6060
* `node` ([`Node`][node]) — Node to check.
61-
* `test` ([`Function`][test], `string`, `Object`, or `Array.<Test>`, optional)
61+
* `test` ([`Function`][test], `string`, `Object`, or `Array<Test>`, optional)
6262
— When nullish, checks if `node` is a [`Node`][node].
6363
When `string`, works like passing `node => node.type === test`.
6464
When `array`, checks if any one of the subtests pass.

test/main.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import test from 'tape'
2-
import {is} from '../index.js'
3-
41
/**
52
* @typedef {import('unist').Node} Node
63
* @typedef {import('unist').Parent} Parent
74
*/
85

6+
import test from 'tape'
7+
import {is} from '../index.js'
8+
99
test('unist-util-is', (t) => {
1010
const node = {type: 'strong'}
1111
const parent = {type: 'paragraph', children: []}

test/property.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ test('unist-util-is properties', (t) => {
7575
// @ts-expect-error: fine.
7676
fc.string({minLength: 1}),
7777
(
78-
/** @type {[Object.<string, unknown>, Array.<string>]} */ nodeAndKeys,
78+
/** @type {[Record<string, unknown>, Array<string>]} */ nodeAndKeys,
7979
/** @type {string} */ type
8080
) => {
8181
const nodeProperties = nodeAndKeys[0]

0 commit comments

Comments
 (0)