From cc14892d4c01b51f6ffbbd8d4b26110053e79490 Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Fri, 3 Jun 2022 19:08:58 +0200 Subject: [PATCH] Add improved jsdoc --- index.js | 19 ++++++++++++++++--- readme.md | 2 +- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/index.js b/index.js index 71cecb9..3c4797b 100644 --- a/index.js +++ b/index.js @@ -9,6 +9,19 @@ import {convert} from 'unist-util-is' +/** + * Find the first node in `parent` before another `node` or before an index, + * that passes `test`. + + * @param parent + * Parent node. + * @param index + * Child of `parent`, or it’s index. + * @param [test] + * `unist-util-is`-compatible test. + * @returns + * + */ export const findBefore = /** * @type {( @@ -18,9 +31,9 @@ export const findBefore = */ ( /** - * @param {Parent} parent Parent node - * @param {Node|number} index Child of `parent`, or it’s index - * @param {null|undefined|Type|Props|TestFunctionAnything|Array} [test] is-compatible test (such as a type) + * @param {Parent} parent + * @param {Node|number} index + * @param {null|undefined|Type|Props|TestFunctionAnything|Array} [test] * @returns {Node|null} */ function (parent, index, test) { diff --git a/readme.md b/readme.md index edab92f..43f70e3 100644 --- a/readme.md +++ b/readme.md @@ -92,7 +92,7 @@ There is no default export. ### `findBefore(parent, node|index[, test])` -Find the first node in `parent` ([`Parent`][parent]) before another node +Find the first node in `parent` ([`Parent`][parent]) before another `node` ([`Node`][node]) or before an index, that passes `test` (`Test` from [`unist-util-is`][test]).