@domql/utils 2.4.0 → 2.4.7
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/index.js +1 -0
- package/dist/cjs/node.js +1 -1
- package/dist/cjs/object.js +1 -1
- package/dist/cjs/tags.js +159 -0
- package/dist/cjs/types.js +1 -4
- package/index.js +1 -0
- package/node.js +1 -1
- package/object.js +1 -1
- package/package.json +2 -7
- package/tags.js +141 -0
- package/types.js +0 -3
package/dist/cjs/index.js
CHANGED
|
@@ -26,3 +26,4 @@ __reExport(utils_exports, require("./log.js"), module.exports);
|
|
|
26
26
|
__reExport(utils_exports, require("./string.js"), module.exports);
|
|
27
27
|
__reExport(utils_exports, require("./globals.js"), module.exports);
|
|
28
28
|
__reExport(utils_exports, require("./cookie.js"), module.exports);
|
|
29
|
+
__reExport(utils_exports, require("./tags.js"), module.exports);
|
package/dist/cjs/node.js
CHANGED
|
@@ -22,7 +22,7 @@ __export(node_exports, {
|
|
|
22
22
|
isNode: () => isNode
|
|
23
23
|
});
|
|
24
24
|
module.exports = __toCommonJS(node_exports);
|
|
25
|
-
var import_globals = require("
|
|
25
|
+
var import_globals = require("./globals");
|
|
26
26
|
const isNode = (obj) => {
|
|
27
27
|
return (typeof Node === "object" ? obj instanceof import_globals.window.Node : obj && typeof obj === "object" && typeof obj.nodeType === "number" && typeof obj.nodeName === "string") || false;
|
|
28
28
|
};
|
package/dist/cjs/object.js
CHANGED
|
@@ -43,7 +43,7 @@ __export(object_exports, {
|
|
|
43
43
|
stringToObject: () => stringToObject
|
|
44
44
|
});
|
|
45
45
|
module.exports = __toCommonJS(object_exports);
|
|
46
|
-
var import_globals = require("
|
|
46
|
+
var import_globals = require("./globals.js");
|
|
47
47
|
var import_types = require("./types.js");
|
|
48
48
|
var import_array = require("./array.js");
|
|
49
49
|
var import_string = require("./string.js");
|
package/dist/cjs/tags.js
ADDED
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var tags_exports = {};
|
|
20
|
+
__export(tags_exports, {
|
|
21
|
+
HTML_TAGS: () => HTML_TAGS,
|
|
22
|
+
isValidHtmlTag: () => isValidHtmlTag
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(tags_exports);
|
|
25
|
+
const HTML_TAGS = {
|
|
26
|
+
root: [
|
|
27
|
+
"body",
|
|
28
|
+
"html"
|
|
29
|
+
],
|
|
30
|
+
head: [
|
|
31
|
+
"title",
|
|
32
|
+
"base",
|
|
33
|
+
"meta",
|
|
34
|
+
"style"
|
|
35
|
+
],
|
|
36
|
+
body: [
|
|
37
|
+
"string",
|
|
38
|
+
"fragment",
|
|
39
|
+
"a",
|
|
40
|
+
"abbr",
|
|
41
|
+
"acronym",
|
|
42
|
+
"address",
|
|
43
|
+
"applet",
|
|
44
|
+
"area",
|
|
45
|
+
"article",
|
|
46
|
+
"aside",
|
|
47
|
+
"audio",
|
|
48
|
+
"b",
|
|
49
|
+
"basefont",
|
|
50
|
+
"bdi",
|
|
51
|
+
"bdo",
|
|
52
|
+
"big",
|
|
53
|
+
"blockquote",
|
|
54
|
+
"br",
|
|
55
|
+
"button",
|
|
56
|
+
"canvas",
|
|
57
|
+
"caption",
|
|
58
|
+
"center",
|
|
59
|
+
"cite",
|
|
60
|
+
"code",
|
|
61
|
+
"col",
|
|
62
|
+
"colgroup",
|
|
63
|
+
"data",
|
|
64
|
+
"datalist",
|
|
65
|
+
"dd",
|
|
66
|
+
"del",
|
|
67
|
+
"details",
|
|
68
|
+
"dfn",
|
|
69
|
+
"dialog",
|
|
70
|
+
"dir",
|
|
71
|
+
"div",
|
|
72
|
+
"dl",
|
|
73
|
+
"dt",
|
|
74
|
+
"em",
|
|
75
|
+
"embed",
|
|
76
|
+
"fieldset",
|
|
77
|
+
"figcaption",
|
|
78
|
+
"figure",
|
|
79
|
+
"font",
|
|
80
|
+
"footer",
|
|
81
|
+
"form",
|
|
82
|
+
"frame",
|
|
83
|
+
"frameset",
|
|
84
|
+
"h1",
|
|
85
|
+
"h2",
|
|
86
|
+
"h3",
|
|
87
|
+
"h4",
|
|
88
|
+
"h5",
|
|
89
|
+
"h6",
|
|
90
|
+
"head",
|
|
91
|
+
"header",
|
|
92
|
+
"hr",
|
|
93
|
+
"i",
|
|
94
|
+
"iframe",
|
|
95
|
+
"img",
|
|
96
|
+
"input",
|
|
97
|
+
"ins",
|
|
98
|
+
"kbd",
|
|
99
|
+
"label",
|
|
100
|
+
"legend",
|
|
101
|
+
"li",
|
|
102
|
+
"link",
|
|
103
|
+
"main",
|
|
104
|
+
"map",
|
|
105
|
+
"mark",
|
|
106
|
+
"meter",
|
|
107
|
+
"nav",
|
|
108
|
+
"noframes",
|
|
109
|
+
"noscript",
|
|
110
|
+
"object",
|
|
111
|
+
"ol",
|
|
112
|
+
"optgroup",
|
|
113
|
+
"option",
|
|
114
|
+
"output",
|
|
115
|
+
"p",
|
|
116
|
+
"param",
|
|
117
|
+
"picture",
|
|
118
|
+
"pre",
|
|
119
|
+
"progress",
|
|
120
|
+
"q",
|
|
121
|
+
"rp",
|
|
122
|
+
"rt",
|
|
123
|
+
"ruby",
|
|
124
|
+
"s",
|
|
125
|
+
"samp",
|
|
126
|
+
"script",
|
|
127
|
+
"section",
|
|
128
|
+
"select",
|
|
129
|
+
"small",
|
|
130
|
+
"source",
|
|
131
|
+
"span",
|
|
132
|
+
"strike",
|
|
133
|
+
"strong",
|
|
134
|
+
"sub",
|
|
135
|
+
"summary",
|
|
136
|
+
"sup",
|
|
137
|
+
"table",
|
|
138
|
+
"tbody",
|
|
139
|
+
"td",
|
|
140
|
+
"template",
|
|
141
|
+
"textarea",
|
|
142
|
+
"tfoot",
|
|
143
|
+
"th",
|
|
144
|
+
"thead",
|
|
145
|
+
"time",
|
|
146
|
+
"tr",
|
|
147
|
+
"track",
|
|
148
|
+
"tt",
|
|
149
|
+
"u",
|
|
150
|
+
"ul",
|
|
151
|
+
"var",
|
|
152
|
+
"video",
|
|
153
|
+
"wbr",
|
|
154
|
+
// SVG
|
|
155
|
+
"svg",
|
|
156
|
+
"path"
|
|
157
|
+
]
|
|
158
|
+
};
|
|
159
|
+
const isValidHtmlTag = (arg) => HTML_TAGS.body.includes(arg);
|
package/dist/cjs/types.js
CHANGED
|
@@ -30,13 +30,10 @@ __export(types_exports, {
|
|
|
30
30
|
isObject: () => isObject,
|
|
31
31
|
isObjectLike: () => isObjectLike,
|
|
32
32
|
isString: () => isString,
|
|
33
|
-
isUndefined: () => isUndefined
|
|
34
|
-
isValidHtmlTag: () => isValidHtmlTag
|
|
33
|
+
isUndefined: () => isUndefined
|
|
35
34
|
});
|
|
36
35
|
module.exports = __toCommonJS(types_exports);
|
|
37
|
-
var import_tags = require("@domql/tags");
|
|
38
36
|
var import_node = require("./node");
|
|
39
|
-
const isValidHtmlTag = (arg) => import_tags.HTML_TAGS.body.includes(arg);
|
|
40
37
|
const isObject = (arg) => {
|
|
41
38
|
if (arg === null)
|
|
42
39
|
return false;
|
package/index.js
CHANGED
package/node.js
CHANGED
package/object.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
-
import { window } from '
|
|
3
|
+
import { window } from './globals.js'
|
|
4
4
|
import { isFunction, isObjectLike, isObject, isArray, isString, is } from './types.js'
|
|
5
5
|
import { mergeAndCloneIfArray, mergeArray } from './array.js'
|
|
6
6
|
import { stringIncludesAny } from './string.js'
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@domql/utils",
|
|
3
|
-
"version": "2.4.
|
|
3
|
+
"version": "2.4.7",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "index.js",
|
|
@@ -23,12 +23,7 @@
|
|
|
23
23
|
"build": "yarn build:cjs",
|
|
24
24
|
"prepublish": "rimraf -I dist && yarn build && yarn copy:package:cjs"
|
|
25
25
|
},
|
|
26
|
-
"
|
|
27
|
-
"@domql/globals": "latest",
|
|
28
|
-
"@domql/key": "latest",
|
|
29
|
-
"@domql/tags": "^2.3.117"
|
|
30
|
-
},
|
|
31
|
-
"gitHead": "d01a7237a0065a5a439a03062064076c5fdc91b7",
|
|
26
|
+
"gitHead": "fd9683a7d42893983463967fa512ac095a6a36e9",
|
|
32
27
|
"devDependencies": {
|
|
33
28
|
"@babel/core": "^7.12.0"
|
|
34
29
|
}
|
package/tags.js
ADDED
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
export const HTML_TAGS = {
|
|
4
|
+
root: [
|
|
5
|
+
'body',
|
|
6
|
+
'html'
|
|
7
|
+
],
|
|
8
|
+
|
|
9
|
+
head: [
|
|
10
|
+
'title',
|
|
11
|
+
'base',
|
|
12
|
+
'meta',
|
|
13
|
+
'style'
|
|
14
|
+
],
|
|
15
|
+
|
|
16
|
+
body: [
|
|
17
|
+
'string',
|
|
18
|
+
'fragment',
|
|
19
|
+
'a',
|
|
20
|
+
'abbr',
|
|
21
|
+
'acronym',
|
|
22
|
+
'address',
|
|
23
|
+
'applet',
|
|
24
|
+
'area',
|
|
25
|
+
'article',
|
|
26
|
+
'aside',
|
|
27
|
+
'audio',
|
|
28
|
+
'b',
|
|
29
|
+
'basefont',
|
|
30
|
+
'bdi',
|
|
31
|
+
'bdo',
|
|
32
|
+
'big',
|
|
33
|
+
'blockquote',
|
|
34
|
+
'br',
|
|
35
|
+
'button',
|
|
36
|
+
'canvas',
|
|
37
|
+
'caption',
|
|
38
|
+
'center',
|
|
39
|
+
'cite',
|
|
40
|
+
'code',
|
|
41
|
+
'col',
|
|
42
|
+
'colgroup',
|
|
43
|
+
'data',
|
|
44
|
+
'datalist',
|
|
45
|
+
'dd',
|
|
46
|
+
'del',
|
|
47
|
+
'details',
|
|
48
|
+
'dfn',
|
|
49
|
+
'dialog',
|
|
50
|
+
'dir',
|
|
51
|
+
'div',
|
|
52
|
+
'dl',
|
|
53
|
+
'dt',
|
|
54
|
+
'em',
|
|
55
|
+
'embed',
|
|
56
|
+
'fieldset',
|
|
57
|
+
'figcaption',
|
|
58
|
+
'figure',
|
|
59
|
+
'font',
|
|
60
|
+
'footer',
|
|
61
|
+
'form',
|
|
62
|
+
'frame',
|
|
63
|
+
'frameset',
|
|
64
|
+
'h1',
|
|
65
|
+
'h2',
|
|
66
|
+
'h3',
|
|
67
|
+
'h4',
|
|
68
|
+
'h5',
|
|
69
|
+
'h6',
|
|
70
|
+
'head',
|
|
71
|
+
'header',
|
|
72
|
+
'hr',
|
|
73
|
+
'i',
|
|
74
|
+
'iframe',
|
|
75
|
+
'img',
|
|
76
|
+
'input',
|
|
77
|
+
'ins',
|
|
78
|
+
'kbd',
|
|
79
|
+
'label',
|
|
80
|
+
'legend',
|
|
81
|
+
'li',
|
|
82
|
+
'link',
|
|
83
|
+
'main',
|
|
84
|
+
'map',
|
|
85
|
+
'mark',
|
|
86
|
+
'meter',
|
|
87
|
+
'nav',
|
|
88
|
+
'noframes',
|
|
89
|
+
'noscript',
|
|
90
|
+
'object',
|
|
91
|
+
'ol',
|
|
92
|
+
'optgroup',
|
|
93
|
+
'option',
|
|
94
|
+
'output',
|
|
95
|
+
'p',
|
|
96
|
+
'param',
|
|
97
|
+
'picture',
|
|
98
|
+
'pre',
|
|
99
|
+
'progress',
|
|
100
|
+
'q',
|
|
101
|
+
'rp',
|
|
102
|
+
'rt',
|
|
103
|
+
'ruby',
|
|
104
|
+
's',
|
|
105
|
+
'samp',
|
|
106
|
+
'script',
|
|
107
|
+
'section',
|
|
108
|
+
'select',
|
|
109
|
+
'small',
|
|
110
|
+
'source',
|
|
111
|
+
'span',
|
|
112
|
+
'strike',
|
|
113
|
+
'strong',
|
|
114
|
+
'sub',
|
|
115
|
+
'summary',
|
|
116
|
+
'sup',
|
|
117
|
+
'table',
|
|
118
|
+
'tbody',
|
|
119
|
+
'td',
|
|
120
|
+
'template',
|
|
121
|
+
'textarea',
|
|
122
|
+
'tfoot',
|
|
123
|
+
'th',
|
|
124
|
+
'thead',
|
|
125
|
+
'time',
|
|
126
|
+
'tr',
|
|
127
|
+
'track',
|
|
128
|
+
'tt',
|
|
129
|
+
'u',
|
|
130
|
+
'ul',
|
|
131
|
+
'var',
|
|
132
|
+
'video',
|
|
133
|
+
'wbr',
|
|
134
|
+
|
|
135
|
+
// SVG
|
|
136
|
+
'svg',
|
|
137
|
+
'path'
|
|
138
|
+
]
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
export const isValidHtmlTag = arg => HTML_TAGS.body.includes(arg)
|
package/types.js
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
-
import { HTML_TAGS } from '@domql/tags'
|
|
4
3
|
import { isHtmlElement, isNode } from './node'
|
|
5
4
|
|
|
6
|
-
export const isValidHtmlTag = arg => HTML_TAGS.body.includes(arg)
|
|
7
|
-
|
|
8
5
|
export const isObject = arg => {
|
|
9
6
|
if (arg === null) return false
|
|
10
7
|
return (typeof arg === 'object') && (arg.constructor === Object)
|