docs: updates docs of findParent and find (#10479) [skip ci]

Makes the documentation of `findParent` and `find` consistent and documents their `null` cases.
This commit is contained in:
Tomer Aberbach 2019-09-22 17:00:13 -04:00 committed by Nicolò Ribaudo
parent b7333ea97a
commit 962015f7e7

View File

@ -4,8 +4,10 @@ import * as t from "@babel/types";
import NodePath from "./index"; import NodePath from "./index";
/** /**
* Call the provided `callback` with the `NodePath`s of all the parents. * Starting at the parent path of the current `NodePath` and going up the
* When the `callback` returns a truthy value, we return that node path. * tree, return the first `NodePath` that causes the provided `callback`
* to return a truthy value, or `null` if the `callback` never returns a
* truthy value.
*/ */
export function findParent(callback): ?NodePath { export function findParent(callback): ?NodePath {
@ -18,7 +20,8 @@ export function findParent(callback): ?NodePath {
/** /**
* Starting at current `NodePath` and going up the tree, return the first * Starting at current `NodePath` and going up the tree, return the first
* `NodePath` that causes the provided `callback` to return a truthy value. * `NodePath` that causes the provided `callback` to return a truthy value,
* or `null` if the `callback` never returns a truthy value.
*/ */
export function find(callback): ?NodePath { export function find(callback): ?NodePath {