Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | 1x 2x 2x 1x | /**
* 判断对象是否为dom元素
* @method isHTMLElement
* @param {Object} node 要判断的对象
* @return {Boolean} 是否为dom元素
* @example
* import { isHTMLElement } from '@spore-ui/tskit';
* isHTMLElement(document.body) // true
*/
export function isHTMLElement(item: unknown): boolean {
const node = item as HTMLElement;
return !!(
node
&& node.nodeName
&& node.nodeType
);
}
export default isHTMLElement;
|