( container: Node, thing: Node | NodeSchema, at?: number | null, copy?: boolean, )
| 843 | } |
| 844 | |
| 845 | export const insertChild = ( |
| 846 | container: Node, |
| 847 | thing: Node | NodeSchema, |
| 848 | at?: number | null, |
| 849 | copy?: boolean, |
| 850 | ): Node | null => { |
| 851 | let node: Node | null | undefined |
| 852 | let Schema: NodeSchema |
| 853 | if (isNode(thing) && copy) { |
| 854 | Schema = thing.export() |
| 855 | node = container.document?.createNode(Schema) |
| 856 | } else if (isNode(thing)) { |
| 857 | node = thing |
| 858 | } else if (isNodeSchema(thing)) { |
| 859 | node = container.document?.createNode(thing) |
| 860 | } |
| 861 | |
| 862 | if (isNode(node)) { |
| 863 | container.children?.insert(node, at) |
| 864 | return node |
| 865 | } |
| 866 | |
| 867 | return null |
| 868 | } |
| 869 | |
| 870 | export const insertChildren = ( |
| 871 | container: Node, |
no test coverage detected