MCPcopy Create free account
hub / github.com/ecomfe/tempad-dev / matchNode

Function matchNode

packages/plugins/src/index.ts:468–476  ·  view source on GitHub ↗

* Checks whether a node satisfies the provided query. * * @param node Node being evaluated. * @param query Predicate or property query description. * @returns True when the node matches.

(node: DesignNode, query: NodeQuery)

Source from the content-addressed store, hash-verified

466 * @returns True when the node matches.
467 */
468function matchNode(node: DesignNode, query: NodeQuery): boolean {
469 if (typeof query === 'function') return query(node)
470
471 return (
472 matchProperty(node.type, query.type) &&
473 matchProperty(node.name, query.name) &&
474 matchProperty(node.visible, query.visible ?? true)
475 )
476}
477
478/**
479 * Find the first direct child that matches the query.

Callers 4

findChildFunction · 0.85
findChildrenFunction · 0.85
findOneFunction · 0.85
findAllFunction · 0.85

Calls 1

matchPropertyFunction · 0.85

Tested by

no test coverage detected