@domql/utils
Advanced tools
Comparing version 2.3.100 to 2.3.101
@@ -21,2 +21,3 @@ "use strict"; | ||
__export(node_exports, { | ||
isHtmlElement: () => isHtmlElement, | ||
isNode: () => isNode | ||
@@ -30,1 +31,4 @@ }); | ||
}; | ||
const isHtmlElement = (obj) => { | ||
return typeof import_globals.window.HTMLElement === "object" ? obj instanceof import_globals.window.HTMLElement : obj && typeof obj === "object" && obj !== null && obj.nodeType === 1 && typeof obj.nodeName === "string"; | ||
}; |
@@ -27,4 +27,2 @@ "use strict"; | ||
isFunction: () => isFunction, | ||
isHtmlElement: () => isHtmlElement, | ||
isNode: () => isNode, | ||
isNot: () => isNot, | ||
@@ -40,4 +38,4 @@ isNull: () => isNull, | ||
module.exports = __toCommonJS(types_exports); | ||
var import_globals = require("@domql/globals"); | ||
var import_tags = require("@domql/tags"); | ||
var import_node = require("./node"); | ||
const isValidHtmlTag = (arg) => import_tags.HTML_TAGS.body.includes(arg); | ||
@@ -60,8 +58,2 @@ const isObject = (arg) => { | ||
}; | ||
const isNode = (obj) => { | ||
return typeof import_globals.window.Node === "object" ? obj instanceof import_globals.window.Node : obj && typeof obj === "object" && typeof obj.nodeType === "number" && typeof obj.nodeName === "string"; | ||
}; | ||
const isHtmlElement = (obj) => { | ||
return typeof import_globals.window.HTMLElement === "object" ? obj instanceof import_globals.window.HTMLElement : obj && typeof obj === "object" && obj !== null && obj.nodeType === 1 && typeof obj.nodeName === "string"; | ||
}; | ||
const isDefined = (arg) => { | ||
@@ -82,4 +74,4 @@ return isObject(arg) || isObjectLike(arg) || isString(arg) || isNumber(arg) || isFunction(arg) || isArray(arg) || isObjectLike(arg) || isBoolean(arg) || isNull(arg); | ||
objectLike: isObjectLike, | ||
node: isNode, | ||
htmlElement: isHtmlElement, | ||
node: import_node.isNode, | ||
htmlElement: import_node.isHtmlElement, | ||
defined: isDefined | ||
@@ -86,0 +78,0 @@ }; |
@@ -16,1 +16,9 @@ 'use strict' | ||
} | ||
export const isHtmlElement = obj => { | ||
return ( | ||
typeof window.HTMLElement === 'object' | ||
? obj instanceof window.HTMLElement // DOM2 | ||
: obj && typeof obj === 'object' && obj !== null && obj.nodeType === 1 && typeof obj.nodeName === 'string' | ||
) | ||
} |
{ | ||
"name": "@domql/utils", | ||
"version": "2.3.100", | ||
"version": "2.3.101", | ||
"license": "MIT", | ||
@@ -25,3 +25,3 @@ "type": "module", | ||
}, | ||
"gitHead": "4d65ad04e488122bfc73ec81dc16c45b842ffa9b" | ||
"gitHead": "d90273abc53b88938f10d1d44f211c6e35ac1c9c" | ||
} |
18
types.js
'use strict' | ||
import { window } from '@domql/globals' | ||
import { HTML_TAGS } from '@domql/tags' | ||
import { isHtmlElement, isNode } from './node' | ||
@@ -31,18 +31,2 @@ export const isValidHtmlTag = arg => HTML_TAGS.body.includes(arg) | ||
export const isNode = obj => { | ||
return ( | ||
typeof window.Node === 'object' | ||
? obj instanceof window.Node | ||
: obj && typeof obj === 'object' && typeof obj.nodeType === 'number' && typeof obj.nodeName === 'string' | ||
) | ||
} | ||
export const isHtmlElement = obj => { | ||
return ( | ||
typeof window.HTMLElement === 'object' | ||
? obj instanceof window.HTMLElement // DOM2 | ||
: obj && typeof obj === 'object' && obj !== null && obj.nodeType === 1 && typeof obj.nodeName === 'string' | ||
) | ||
} | ||
export const isDefined = arg => { | ||
@@ -49,0 +33,0 @@ return isObject(arg) || |
36179
1108