Skip to content

Commit cff33aa

Browse files
committed
Refactor code-style
* Add more docs to JSDoc * Add support for `null` in input of API types
1 parent 3240fc3 commit cff33aa

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

lib/index.js

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,35 @@
11
/**
22
* @typedef {import('unist').Node} Node
33
* @typedef {import('unist').Parent} Parent
4-
*
5-
* @typedef {string} Type
6-
* @typedef {Record<string, unknown>} Props
7-
* @typedef {import('unist-util-is').TestFunctionAnything} TestFunctionAnything
4+
* @typedef {import('unist-util-is').Test} Test
85
*/
96

107
import {convert} from 'unist-util-is'
118

129
/**
13-
* Find nodes in `parent` after another `node` or after an index, that pass
14-
* `test`.
10+
* Find nodes in `parent` after a `child` or after an index, that pass `test`.
1511
*
1612
* @param parent
1713
* Parent node.
1814
* @param index
1915
* Child of `parent` or it’s index.
20-
* @param [test]
16+
* @param test
2117
* `unist-util-is`-compatible test.
2218
* @returns
2319
* Children of `parent` that pass `test`.
2420
*/
2521
export const findAllAfter =
2622
/**
2723
* @type {(
28-
* (<T extends Node>(node: Parent, index: Node|number, test: T['type']|Partial<T>|import('unist-util-is').TestFunctionPredicate<T>|Array<T['type']|Partial<T>|import('unist-util-is').TestFunctionPredicate<T>>) => Array<T>) &
29-
* ((node: Parent, index: Node|number, test?: null|undefined|Type|Props|TestFunctionAnything|Array<Type|Props|TestFunctionAnything>) => Array<Node>)
24+
* (<T extends Node>(node: Parent, index: Node | number, test: import('unist-util-is').PredicateTest<T>) => Array<T>) &
25+
* ((node: Parent, index: Node | number, test?: Test) => Array<Node>)
3026
* )}
3127
*/
3228
(
3329
/**
3430
* @param {Parent} parent
35-
* @param {Node|number} index
36-
* @param {null|undefined|Type|Props|TestFunctionAnything|Array<Type|Props|TestFunctionAnything>} [test]
31+
* @param {Node | number} index
32+
* @param {Test} [test]
3733
* @returns {Array<Node>}
3834
*/
3935
function (parent, index, test) {

0 commit comments

Comments
 (0)