Skip to main content
Module

x/deno2node/src/deps.deno.ts>Node#getParentWhile

Compile your Deno project to run on Node.js.
Go to Latest
method Node.prototype.getParentWhile
import { Node } from "https://deno.land/x/deno2node@v1.7.1/src/deps.deno.ts";

Goes up the parents (ancestors) of the node while a condition is true. Returns undefined if the initial parent doesn't match the condition.

Parameters

condition: (parent: Node, child: Node) => parent is T
  • Condition that tests the parent to see if the expression is true.

Returns

T | undefined

Goes up the parents (ancestors) of the node while a condition is true. Returns undefined if the initial parent doesn't match the condition.

Parameters

condition: (parent: Node, child: Node) => boolean
  • Condition that tests the parent to see if the expression is true.

Returns

Node | undefined