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

Function contains

packages/core/src/document/node/node.ts:787–802  ·  view source on GitHub ↗
(node1: Node, node2: Node)

Source from the content-addressed store, hash-verified

785 * check if node1 contains node2
786 */
787export const contains = (node1: Node, node2: Node): boolean => {
788 if (node1 === node2) {
789 return true
790 }
791
792 if (!node1.isParental || !node2.parent) {
793 return false
794 }
795
796 const p = getZLevelTop(node2, node1.zLevel)
797 if (!p) {
798 return false
799 }
800
801 return node1 === p
802}
803
804// 16 node1 contains node2
805// 8 node1 contained_by node2

Callers 1

containsMethod · 0.85

Calls 1

getZLevelTopFunction · 0.85

Tested by

no test coverage detected