/* * Copyright notice: * * Large parts of this file are heavily inspired if not downright copied from editor.js, * copyright MIT. * https://editorjs.io/ */ /** * Check if object is DOM node * * @param {*} node - object to check * @returns {boolean} */ // eslint-disable-next-line @typescript-eslint/no-explicit-any export const isElement = (node: any): node is Element => { if (node instanceof Number) { return false; } return node && node.nodeType && node.nodeType === Node.ELEMENT_NODE; } /** * Check if object is DocumentFragment node * * @param {object} node - object to check * @returns {boolean} */ // eslint-disable-next-line @typescript-eslint/no-explicit-any export const isFragment = (node: any): node is DocumentFragment => { if (node instanceof Number) { return false; } return node && node.nodeType && node.nodeType === Node.DOCUMENT_FRAGMENT_NODE; }