MCPcopy Create free account
hub / github.com/Easy-Editor/EasyEditor / getClosestNode

Function getClosestNode

packages/core/src/document/node/node.ts:890–899  ·  view source on GitHub ↗
(node: Node | null, until: (n: Node) => boolean)

Source from the content-addressed store, hash-verified

888 * get the closest node that satisfies the condition
889 */
890export const getClosestNode = (node: Node | null, until: (n: Node) => boolean): Node | undefined => {
891 if (!node) {
892 return undefined
893 }
894 if (until(node)) {
895 return node
896 } else {
897 return getClosestNode(node.parent, until)
898 }
899}
900
901/**
902 * get the closest clickable node

Callers 3

locateMethod · 0.90
getClosestClickableNodeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected