@domql/utils 2.3.100 → 2.3.101

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cjs/node.js CHANGED
@@ -18,6 +18,7 @@ var __copyProps = (to, from, except, desc) => {
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
  var node_exports = {};
20
20
  __export(node_exports, {
21
+ isHtmlElement: () => isHtmlElement,
21
22
  isNode: () => isNode
22
23
  });
23
24
  module.exports = __toCommonJS(node_exports);
@@ -26,3 +27,6 @@ const isNode = (node) => {
26
27
  const { Node } = import_globals.window;
27
28
  return typeof Node === "function" ? node instanceof Node : node && typeof node === "object" && typeof node.nodeType === "number" && typeof node.tag === "string";
28
29
  };
30
+ const isHtmlElement = (obj) => {
31
+ 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";
32
+ };
package/dist/cjs/types.js CHANGED
@@ -24,8 +24,6 @@ __export(types_exports, {
24
24
  isBoolean: () => isBoolean,
25
25
  isDefined: () => isDefined,
26
26
  isFunction: () => isFunction,
27
- isHtmlElement: () => isHtmlElement,
28
- isNode: () => isNode,
29
27
  isNot: () => isNot,
30
28
  isNull: () => isNull,
31
29
  isNumber: () => isNumber,
@@ -36,8 +34,8 @@ __export(types_exports, {
36
34
  isValidHtmlTag: () => isValidHtmlTag
37
35
  });
38
36
  module.exports = __toCommonJS(types_exports);
39
- var import_globals = require("@domql/globals");
40
37
  var import_tags = require("@domql/tags");
38
+ var import_node = require("./node");
41
39
  const isValidHtmlTag = (arg) => import_tags.HTML_TAGS.body.includes(arg);
42
40
  const isObject = (arg) => {
43
41
  if (arg === null)
@@ -55,12 +53,6 @@ const isObjectLike = (arg) => {
55
53
  return false;
56
54
  return typeof arg === "object";
57
55
  };
58
- const isNode = (obj) => {
59
- 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";
60
- };
61
- const isHtmlElement = (obj) => {
62
- 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";
63
- };
64
56
  const isDefined = (arg) => {
65
57
  return isObject(arg) || isObjectLike(arg) || isString(arg) || isNumber(arg) || isFunction(arg) || isArray(arg) || isObjectLike(arg) || isBoolean(arg) || isNull(arg);
66
58
  };
@@ -76,8 +68,8 @@ const TYPES = {
76
68
  null: isNull,
77
69
  function: isFunction,
78
70
  objectLike: isObjectLike,
79
- node: isNode,
80
- htmlElement: isHtmlElement,
71
+ node: import_node.isNode,
72
+ htmlElement: import_node.isHtmlElement,
81
73
  defined: isDefined
82
74
  };
83
75
  const is = (arg) => {
package/node.js CHANGED
@@ -13,3 +13,11 @@ export const isNode = (node) => {
13
13
  typeof node.tag === 'string'
14
14
  )
15
15
  }
16
+
17
+ export const isHtmlElement = obj => {
18
+ return (
19
+ typeof window.HTMLElement === 'object'
20
+ ? obj instanceof window.HTMLElement // DOM2
21
+ : obj && typeof obj === 'object' && obj !== null && obj.nodeType === 1 && typeof obj.nodeName === 'string'
22
+ )
23
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@domql/utils",
3
- "version": "2.3.100",
3
+ "version": "2.3.101",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "module": "index.js",
@@ -22,5 +22,5 @@
22
22
  "@domql/globals": "latest",
23
23
  "@domql/tags": "latest"
24
24
  },
25
- "gitHead": "4d65ad04e488122bfc73ec81dc16c45b842ffa9b"
25
+ "gitHead": "d90273abc53b88938f10d1d44f211c6e35ac1c9c"
26
26
  }
package/types.js CHANGED
@@ -1,7 +1,7 @@
1
1
  'use strict'
2
2
 
3
- import { window } from '@domql/globals'
4
3
  import { HTML_TAGS } from '@domql/tags'
4
+ import { isHtmlElement, isNode } from './node'
5
5
 
6
6
  export const isValidHtmlTag = arg => HTML_TAGS.body.includes(arg)
7
7
 
@@ -28,22 +28,6 @@ export const isObjectLike = arg => {
28
28
  return (typeof arg === 'object')
29
29
  }
30
30
 
31
- export const isNode = obj => {
32
- return (
33
- typeof window.Node === 'object'
34
- ? obj instanceof window.Node
35
- : obj && typeof obj === 'object' && typeof obj.nodeType === 'number' && typeof obj.nodeName === 'string'
36
- )
37
- }
38
-
39
- export const isHtmlElement = obj => {
40
- return (
41
- typeof window.HTMLElement === 'object'
42
- ? obj instanceof window.HTMLElement // DOM2
43
- : obj && typeof obj === 'object' && obj !== null && obj.nodeType === 1 && typeof obj.nodeName === 'string'
44
- )
45
- }
46
-
47
31
  export const isDefined = arg => {
48
32
  return isObject(arg) ||
49
33
  isObjectLike(arg) ||