@domql/utils 2.3.92 → 2.3.100

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/array.js CHANGED
@@ -24,3 +24,7 @@ export const removeFromArray = (arr, index) => {
24
24
  export const swapItemsInArray = (arr, i, j) => {
25
25
  [arr[i], arr[j]] = [arr[j], arr[i]]
26
26
  }
27
+
28
+ export const joinArrays = (...arrays) => {
29
+ return [].concat(...arrays)
30
+ }
package/dist/cjs/array.js CHANGED
@@ -19,6 +19,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
19
19
  var array_exports = {};
20
20
  __export(array_exports, {
21
21
  arrayContainsOtherArray: () => arrayContainsOtherArray,
22
+ joinArrays: () => joinArrays,
22
23
  removeFromArray: () => removeFromArray,
23
24
  swapItemsInArray: () => swapItemsInArray
24
25
  });
@@ -45,3 +46,6 @@ const removeFromArray = (arr, index) => {
45
46
  const swapItemsInArray = (arr, i, j) => {
46
47
  [arr[i], arr[j]] = [arr[j], arr[i]];
47
48
  };
49
+ const joinArrays = (...arrays) => {
50
+ return [].concat(...arrays);
51
+ };
package/dist/cjs/node.js CHANGED
@@ -18,18 +18,11 @@ 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
- cleanWithNode: () => cleanWithNode,
22
- createID: () => createID,
23
- createSnapshotId: () => createSnapshotId
21
+ isNode: () => isNode
24
22
  });
25
23
  module.exports = __toCommonJS(node_exports);
26
- const cleanWithNode = (extend) => delete extend.node && extend;
27
- const createID = function() {
28
- let index = 0;
29
- function newId() {
30
- index++;
31
- return index;
32
- }
33
- return newId;
34
- }();
35
- const createSnapshotId = createID;
24
+ var import_globals = require("@domql/globals");
25
+ const isNode = (node) => {
26
+ const { Node } = import_globals.window;
27
+ return typeof Node === "function" ? node instanceof Node : node && typeof node === "object" && typeof node.nodeType === "number" && typeof node.tag === "string";
28
+ };
package/dist/cjs/types.js CHANGED
@@ -38,7 +38,7 @@ __export(types_exports, {
38
38
  module.exports = __toCommonJS(types_exports);
39
39
  var import_globals = require("@domql/globals");
40
40
  var import_tags = require("@domql/tags");
41
- const isValidHtmlTag = (arg) => import_tags.HTML_TAGS.body.indexOf(arg);
41
+ const isValidHtmlTag = (arg) => import_tags.HTML_TAGS.body.includes(arg);
42
42
  const isObject = (arg) => {
43
43
  if (arg === null)
44
44
  return false;
package/node.js CHANGED
@@ -1,16 +1,15 @@
1
1
  'use strict'
2
2
 
3
- export const cleanWithNode = extend => delete extend.node && extend
4
-
5
- export const createID = (function () {
6
- let index = 0
7
-
8
- function newId () {
9
- index++
10
- return index
11
- }
12
-
13
- return newId
14
- })()
15
-
16
- export const createSnapshotId = createID
3
+ import { window } from '@domql/globals'
4
+
5
+ export const isNode = (node) => {
6
+ const { Node } = window
7
+ return (
8
+ typeof Node === 'function'
9
+ ? node instanceof Node
10
+ : node &&
11
+ typeof node === 'object' &&
12
+ typeof node.nodeType === 'number' &&
13
+ typeof node.tag === 'string'
14
+ )
15
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@domql/utils",
3
- "version": "2.3.92",
3
+ "version": "2.3.100",
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": "dc86022df601a498fca8c9af5be9e40dcf36ddbf"
25
+ "gitHead": "4d65ad04e488122bfc73ec81dc16c45b842ffa9b"
26
26
  }
package/types.js CHANGED
@@ -3,7 +3,7 @@
3
3
  import { window } from '@domql/globals'
4
4
  import { HTML_TAGS } from '@domql/tags'
5
5
 
6
- export const isValidHtmlTag = arg => HTML_TAGS.body.indexOf(arg)
6
+ export const isValidHtmlTag = arg => HTML_TAGS.body.includes(arg)
7
7
 
8
8
  export const isObject = arg => {
9
9
  if (arg === null) return false