bcb4fb45762d1525340be08a9db5920fa784296eac1a62b0f0786a53d0ba1eaa30d3814bb0f804c58f8371b434fde089b3fa5a9f9265da88c8826bd0d3ef77 371 B

123456789101112131415
  1. function removeNode(node) {
  2. if (node.parentElement !== null) {
  3. node.parentElement.removeChild(node);
  4. }
  5. }
  6. function insertNodeAt(fatherNode, node, position) {
  7. const refNode =
  8. position === 0
  9. ? fatherNode.children[0]
  10. : fatherNode.children[position - 1].nextSibling;
  11. fatherNode.insertBefore(node, refNode);
  12. }
  13. export { insertNodeAt, removeNode };