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

Function ensureNode

packages/core/src/document/node/node.ts:928–940  ·  view source on GitHub ↗
(node: any, document: Document)

Source from the content-addressed store, hash-verified

926 * ensure the node is a Node instance
927 */
928export const ensureNode = (node: any, document: Document): Node => {
929 let nodeInstance = node
930 if (!isNode(node)) {
931 if (node.getComponentName) {
932 nodeInstance = document.createNode({
933 componentName: node.getComponentName(),
934 })
935 } else {
936 nodeInstance = document.createNode(node)
937 }
938 }
939 return nodeInstance
940}

Callers 3

insertMethod · 0.85
insertBeforeMethod · 0.85
insertAfterMethod · 0.85

Calls 3

isNodeFunction · 0.85
createNodeMethod · 0.80
getComponentNameMethod · 0.80

Tested by

no test coverage detected