@vope/utils 1.4.2 → 1.4.4
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/README.md +0 -20
- package/cjs/index.js +583 -56
- package/lib/clamp.js +4 -2
- package/lib/classnames.js +8 -5
- package/lib/compare/version.js +4 -2
- package/lib/compare/weak-equal.js +4 -2
- package/lib/convert/json.js +4 -2
- package/lib/convert/object.js +4 -2
- package/lib/convert/strings.js +4 -2
- package/lib/encoding.js +4 -2
- package/lib/index.js +50 -24
- package/lib/input-regex.js +4 -2
- package/lib/is/class.js +4 -2
- package/lib/is/empty.js +4 -2
- package/lib/is/null.js +4 -2
- package/lib/memory/basic.js +4 -2
- package/lib/memory/list.js +4 -2
- package/lib/memory/power.js +4 -2
- package/lib/memory/type.d.js +0 -1
- package/lib/once.js +4 -2
- package/lib/power/decon.js +4 -2
- package/lib/rotate/angle.js +4 -2
- package/lib/rotate/rad.js +4 -2
- package/lib/table/flex.js +101 -0
- package/lib/union.js +4 -2
- package/lib/url/join.js +4 -2
- package/lib/url/params.js +4 -2
- package/lib/wait.js +4 -2
- package/package.json +24 -30
- package/types/classnames.d.ts +1 -1
- package/types/index.d.ts +1 -0
- package/types/rotate/angle.d.ts +1 -1
- package/types/rotate/rad.d.ts +1 -1
- package/types/table/flex.d.ts +43 -0
- package/cjs/clamp.js +0 -31
- package/cjs/classnames.js +0 -36
- package/cjs/compare/version.js +0 -38
- package/cjs/compare/weak-equal.js +0 -54
- package/cjs/convert/json.js +0 -28
- package/cjs/convert/object.js +0 -28
- package/cjs/convert/strings.js +0 -28
- package/cjs/encoding.js +0 -77
- package/cjs/input-regex.js +0 -29
- package/cjs/is/class.js +0 -49
- package/cjs/is/empty.js +0 -36
- package/cjs/is/null.js +0 -25
- package/cjs/memory/basic.js +0 -168
- package/cjs/memory/list.js +0 -42
- package/cjs/memory/power.js +0 -43
- package/cjs/memory/type.d.js +0 -16
- package/cjs/once.js +0 -28
- package/cjs/power/decon.js +0 -43
- package/cjs/rotate/angle.js +0 -36
- package/cjs/rotate/rad.js +0 -32
- package/cjs/union.js +0 -44
- package/cjs/url/join.js +0 -31
- package/cjs/url/params.js +0 -45
- package/cjs/wait.js +0 -24
package/cjs/clamp.js
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
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 clamp_exports = {};
|
|
20
|
-
__export(clamp_exports, {
|
|
21
|
-
default: () => clamp_default
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(clamp_exports);
|
|
24
|
-
var clamp_default = (value, min, max) => {
|
|
25
|
-
if (min > max) {
|
|
26
|
-
const swap = max;
|
|
27
|
-
max = min;
|
|
28
|
-
min = swap;
|
|
29
|
-
}
|
|
30
|
-
return Math.min(max, Math.max(min, value));
|
|
31
|
-
};
|
package/cjs/classnames.js
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
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 classnames_exports = {};
|
|
20
|
-
__export(classnames_exports, {
|
|
21
|
-
default: () => classnames_default
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(classnames_exports);
|
|
24
|
-
const add = (a, b) => a ? a + " " + b : b;
|
|
25
|
-
var classnames_default = (...list) => list.reduce((caches, data) => {
|
|
26
|
-
if (typeof data === "string") {
|
|
27
|
-
data && (caches = add(caches, data));
|
|
28
|
-
} else if (Array.isArray(data)) {
|
|
29
|
-
data.forEach((value) => value && (caches = add(caches, value)));
|
|
30
|
-
} else if (data) {
|
|
31
|
-
for (const key in data) {
|
|
32
|
-
key && data[key] && (caches = add(caches, key));
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
return caches;
|
|
36
|
-
}, "");
|
package/cjs/compare/version.js
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
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 version_exports = {};
|
|
20
|
-
__export(version_exports, {
|
|
21
|
-
default: () => version_default
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(version_exports);
|
|
24
|
-
const CHAR = ".";
|
|
25
|
-
const compareVersion = (from, to) => {
|
|
26
|
-
const froms = from.split(CHAR);
|
|
27
|
-
const tos = to.split(CHAR);
|
|
28
|
-
for (let i = 0, max = Math.max(froms.length, tos.length); i < max; i++) {
|
|
29
|
-
const fromV = +froms[i] || 0;
|
|
30
|
-
const toV = +tos[i] || 0;
|
|
31
|
-
if (fromV > toV)
|
|
32
|
-
return -1;
|
|
33
|
-
if (fromV < toV)
|
|
34
|
-
return 1;
|
|
35
|
-
}
|
|
36
|
-
return 0;
|
|
37
|
-
};
|
|
38
|
-
var version_default = compareVersion;
|
|
@@ -1,54 +0,0 @@
|
|
|
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 weak_equal_exports = {};
|
|
20
|
-
__export(weak_equal_exports, {
|
|
21
|
-
default: () => weak_equal_default
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(weak_equal_exports);
|
|
24
|
-
const deepWeakEqual = (from, to) => {
|
|
25
|
-
if (typeof from !== "object" || from === null || typeof to !== "object" || to === null)
|
|
26
|
-
return from === to;
|
|
27
|
-
if (Array.isArray(from) && Array.isArray(to)) {
|
|
28
|
-
if (from.length !== to.length)
|
|
29
|
-
return false;
|
|
30
|
-
return !from.some((t1, index) => {
|
|
31
|
-
if (!deepWeakEqual(t1, to[index])) {
|
|
32
|
-
return true;
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
} else {
|
|
36
|
-
const caches = {};
|
|
37
|
-
for (const key in from) {
|
|
38
|
-
if (!deepWeakEqual(from[key], to[key])) {
|
|
39
|
-
return false;
|
|
40
|
-
} else {
|
|
41
|
-
caches[key] = key;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
for (const key in to) {
|
|
45
|
-
if (key in caches)
|
|
46
|
-
continue;
|
|
47
|
-
if (!deepWeakEqual(from[key], to[key])) {
|
|
48
|
-
return false;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
return true;
|
|
53
|
-
};
|
|
54
|
-
var weak_equal_default = deepWeakEqual;
|
package/cjs/convert/json.js
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
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 json_exports = {};
|
|
20
|
-
__export(json_exports, {
|
|
21
|
-
default: () => json_default
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(json_exports);
|
|
24
|
-
const hash8json = (list, key) => list.reduce((caches, data) => {
|
|
25
|
-
caches[data[key]] = data;
|
|
26
|
-
return caches;
|
|
27
|
-
}, {});
|
|
28
|
-
var json_default = hash8json;
|
package/cjs/convert/object.js
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
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 object_exports = {};
|
|
20
|
-
__export(object_exports, {
|
|
21
|
-
default: () => object_default
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(object_exports);
|
|
24
|
-
const hash8object = (list, key) => list.reduce((caches, data) => {
|
|
25
|
-
caches.set(data[key], data);
|
|
26
|
-
return caches;
|
|
27
|
-
}, /* @__PURE__ */ new Map());
|
|
28
|
-
var object_default = hash8object;
|
package/cjs/convert/strings.js
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
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 strings_exports = {};
|
|
20
|
-
__export(strings_exports, {
|
|
21
|
-
default: () => strings_default
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(strings_exports);
|
|
24
|
-
const hash8strings = (list) => list.reduce((caches, data, index) => {
|
|
25
|
-
caches[data] = index;
|
|
26
|
-
return caches;
|
|
27
|
-
}, {});
|
|
28
|
-
var strings_default = hash8strings;
|
package/cjs/encoding.js
DELETED
|
@@ -1,77 +0,0 @@
|
|
|
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 encoding_exports = {};
|
|
20
|
-
__export(encoding_exports, {
|
|
21
|
-
default: () => encoding_default
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(encoding_exports);
|
|
24
|
-
const utf8_first_prefix = /^1{2,}/g;
|
|
25
|
-
const utf8_other_prefix = /^10/;
|
|
26
|
-
const Encodes = {
|
|
27
|
-
UTF_8: "utf-8",
|
|
28
|
-
UTF_16LE: "utf-16le",
|
|
29
|
-
UTF_16BE: "utf-16be",
|
|
30
|
-
GBK: "gbk"
|
|
31
|
-
};
|
|
32
|
-
const defaults = {
|
|
33
|
-
utf8: [239, 187, 191]
|
|
34
|
-
};
|
|
35
|
-
const equal = (uint, list) => {
|
|
36
|
-
if (uint.length !== list.length)
|
|
37
|
-
return false;
|
|
38
|
-
return !uint.some((value, index) => value !== list[index]);
|
|
39
|
-
};
|
|
40
|
-
const getEncoding = (uint, limit = 1024) => {
|
|
41
|
-
let encoding;
|
|
42
|
-
let offset = 0;
|
|
43
|
-
if (equal(uint.slice(0, 3), defaults.utf8)) {
|
|
44
|
-
offset = defaults.utf8.length;
|
|
45
|
-
encoding = Encodes.UTF_8;
|
|
46
|
-
} else if (equal(uint.slice(0, 2), [255, 254])) {
|
|
47
|
-
encoding = Encodes.UTF_16LE;
|
|
48
|
-
} else if (equal(uint.slice(0, 2), [254, 255])) {
|
|
49
|
-
encoding = Encodes.UTF_16BE;
|
|
50
|
-
} else {
|
|
51
|
-
let isBreak = false;
|
|
52
|
-
top:
|
|
53
|
-
for (let i = 0; i < Math.min(uint.length, limit); i++) {
|
|
54
|
-
const data = uint[i];
|
|
55
|
-
if (data < 128)
|
|
56
|
-
continue;
|
|
57
|
-
const match = data.toString(2).match(utf8_first_prefix);
|
|
58
|
-
if (match) {
|
|
59
|
-
for (let m = 0; m < match[0].length - 1; m++) {
|
|
60
|
-
const target = uint[++i];
|
|
61
|
-
if (target == void 0 || !utf8_other_prefix.test(target.toString(2))) {
|
|
62
|
-
encoding = Encodes.GBK;
|
|
63
|
-
isBreak = true;
|
|
64
|
-
break top;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
} else {
|
|
68
|
-
encoding = Encodes.GBK;
|
|
69
|
-
isBreak = true;
|
|
70
|
-
break;
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
isBreak || (encoding = Encodes.UTF_8);
|
|
74
|
-
}
|
|
75
|
-
return { encoding, offset };
|
|
76
|
-
};
|
|
77
|
-
var encoding_default = getEncoding;
|
package/cjs/input-regex.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
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 input_regex_exports = {};
|
|
20
|
-
__export(input_regex_exports, {
|
|
21
|
-
default: () => input_regex_default
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(input_regex_exports);
|
|
24
|
-
const RE_REGEX = /[$()*+.[?\\^{|]/g;
|
|
25
|
-
const RE_STRING = /[$()*+.[?\\^{|-]/g;
|
|
26
|
-
function inputRegex(text, flags) {
|
|
27
|
-
return flags === false ? text.replace(RE_STRING, ($0) => "\\" + $0) : new RegExp(text.replace(RE_REGEX, ($0) => "\\" + $0), flags);
|
|
28
|
-
}
|
|
29
|
-
var input_regex_default = inputRegex;
|
package/cjs/is/class.js
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
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 class_exports = {};
|
|
20
|
-
__export(class_exports, {
|
|
21
|
-
default: () => class_default
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(class_exports);
|
|
24
|
-
const re_anonymous = /^function\s+\(|^function\s+anonymous\(/;
|
|
25
|
-
const re_function = /^function\s+[A-Z]/;
|
|
26
|
-
const re_this = /\b\(this\b|\bthis[\.\[]\b/;
|
|
27
|
-
const re_check = /classCallCheck\(this/;
|
|
28
|
-
const re_default = /^function\sdefault_\d+\s*\(/;
|
|
29
|
-
const isClass = (value, strict = true) => {
|
|
30
|
-
if (typeof value !== "function")
|
|
31
|
-
return false;
|
|
32
|
-
const proto = value.prototype;
|
|
33
|
-
if (!proto || proto.constructor !== value)
|
|
34
|
-
return false;
|
|
35
|
-
const str = value.toString();
|
|
36
|
-
if (str.slice(0, 5) === "class" || Object.getOwnPropertyNames(proto).length >= 2)
|
|
37
|
-
return true;
|
|
38
|
-
if (re_anonymous.test(str))
|
|
39
|
-
return false;
|
|
40
|
-
if (strict && re_function.test(str))
|
|
41
|
-
return true;
|
|
42
|
-
if (re_this.test(str)) {
|
|
43
|
-
if (!strict || re_check.test(str))
|
|
44
|
-
return true;
|
|
45
|
-
return re_default.test(str);
|
|
46
|
-
}
|
|
47
|
-
return false;
|
|
48
|
-
};
|
|
49
|
-
var class_default = isClass;
|
package/cjs/is/empty.js
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var empty_exports = {};
|
|
30
|
-
__export(empty_exports, {
|
|
31
|
-
default: () => empty_default
|
|
32
|
-
});
|
|
33
|
-
module.exports = __toCommonJS(empty_exports);
|
|
34
|
-
var import_null = __toESM(require("./null"), 1);
|
|
35
|
-
const isEmpty = (value) => (0, import_null.default)(value) || value === "";
|
|
36
|
-
var empty_default = isEmpty;
|
package/cjs/is/null.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
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 null_exports = {};
|
|
20
|
-
__export(null_exports, {
|
|
21
|
-
default: () => null_default
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(null_exports);
|
|
24
|
-
const isNull = (value) => value === void 0 || value === null;
|
|
25
|
-
var null_default = isNull;
|
package/cjs/memory/basic.js
DELETED
|
@@ -1,168 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var basic_exports = {};
|
|
30
|
-
__export(basic_exports, {
|
|
31
|
-
default: () => MemoryBasic
|
|
32
|
-
});
|
|
33
|
-
module.exports = __toCommonJS(basic_exports);
|
|
34
|
-
var import_strings = __toESM(require("../convert/strings"), 1);
|
|
35
|
-
class MemoryBasic {
|
|
36
|
-
/**
|
|
37
|
-
* @param key 用于对数据进行分类的key
|
|
38
|
-
* @param config
|
|
39
|
-
*/
|
|
40
|
-
constructor(key, config) {
|
|
41
|
-
this.key = key;
|
|
42
|
-
this.#mount = config.mount;
|
|
43
|
-
this.#reflex = config.reflex;
|
|
44
|
-
}
|
|
45
|
-
#mount;
|
|
46
|
-
#reflex;
|
|
47
|
-
list = [];
|
|
48
|
-
memorys = /* @__PURE__ */ new Map();
|
|
49
|
-
/**
|
|
50
|
-
* 返回存储长度
|
|
51
|
-
*/
|
|
52
|
-
get size() {
|
|
53
|
-
return this.list.length;
|
|
54
|
-
}
|
|
55
|
-
getType(data) {
|
|
56
|
-
const { key } = this;
|
|
57
|
-
return typeof key === "function" ? key(data) : data[key];
|
|
58
|
-
}
|
|
59
|
-
push(...list) {
|
|
60
|
-
const { memorys } = this;
|
|
61
|
-
list.forEach((data) => {
|
|
62
|
-
const type = this.getType(data);
|
|
63
|
-
const memory = memorys.get(type);
|
|
64
|
-
const index = this.list.push(data) - 1;
|
|
65
|
-
const result = this.#mount(index, memory);
|
|
66
|
-
memory === result || memorys.set(type, result);
|
|
67
|
-
});
|
|
68
|
-
return this;
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* 遍历所有存储数据(按入栈顺序)
|
|
72
|
-
*/
|
|
73
|
-
forEach(callback) {
|
|
74
|
-
this.list.forEach(callback);
|
|
75
|
-
return this;
|
|
76
|
-
}
|
|
77
|
-
/**
|
|
78
|
-
* 遍历所有存储类型
|
|
79
|
-
*/
|
|
80
|
-
forType(callback) {
|
|
81
|
-
const { memorys, list } = this;
|
|
82
|
-
for (const [type, memory] of memorys) {
|
|
83
|
-
const caches = this.#reflex(memory).map((index) => list[index]);
|
|
84
|
-
callback(caches, type);
|
|
85
|
-
}
|
|
86
|
-
return this;
|
|
87
|
-
}
|
|
88
|
-
/**
|
|
89
|
-
* 检测存储是否包含某种类型
|
|
90
|
-
*/
|
|
91
|
-
includes(type) {
|
|
92
|
-
return this.memorys.has(type);
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
* 获取指定类型存储数据
|
|
96
|
-
*/
|
|
97
|
-
get(type) {
|
|
98
|
-
const memory = this.memorys.get(type);
|
|
99
|
-
return memory === void 0 ? null : this.#reflex(memory).map((count) => this.list[count]);
|
|
100
|
-
}
|
|
101
|
-
/**
|
|
102
|
-
* 删除指定存储数据
|
|
103
|
-
*/
|
|
104
|
-
delete(data) {
|
|
105
|
-
const { memorys, list } = this;
|
|
106
|
-
let index = -1;
|
|
107
|
-
if (!list.some((value, i) => {
|
|
108
|
-
if (data === value) {
|
|
109
|
-
index = i;
|
|
110
|
-
list.splice(index, 1);
|
|
111
|
-
const type = this.getType(value);
|
|
112
|
-
const memory = this.#reflex(memorys.get(type));
|
|
113
|
-
if (memory.length === 1) {
|
|
114
|
-
memorys.delete(type);
|
|
115
|
-
} else {
|
|
116
|
-
memory.some((count, j) => {
|
|
117
|
-
if (count === i) {
|
|
118
|
-
memory.splice(j, 1);
|
|
119
|
-
return true;
|
|
120
|
-
}
|
|
121
|
-
});
|
|
122
|
-
}
|
|
123
|
-
return true;
|
|
124
|
-
}
|
|
125
|
-
}))
|
|
126
|
-
return this;
|
|
127
|
-
for (const [type, target] of memorys) {
|
|
128
|
-
const memory = this.#reflex(target);
|
|
129
|
-
memory.forEach((value, index2) => {
|
|
130
|
-
if (value >= index2) {
|
|
131
|
-
memory[index2] = value - 1;
|
|
132
|
-
}
|
|
133
|
-
});
|
|
134
|
-
if (memory !== target) {
|
|
135
|
-
let reactor;
|
|
136
|
-
memory.forEach((count) => {
|
|
137
|
-
reactor = this.#mount(count, reactor);
|
|
138
|
-
});
|
|
139
|
-
memorys.set(type, reactor);
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
return this;
|
|
143
|
-
}
|
|
144
|
-
/**
|
|
145
|
-
* 删除指定类型存储数据
|
|
146
|
-
*/
|
|
147
|
-
deleteType(type) {
|
|
148
|
-
const { memorys, list } = this;
|
|
149
|
-
if (!memorys.has(type))
|
|
150
|
-
return this;
|
|
151
|
-
const local = (0, import_strings.default)(this.#reflex(memorys.get(type)));
|
|
152
|
-
const Memory2 = this.constructor;
|
|
153
|
-
const imitator = new Memory2(this.key);
|
|
154
|
-
list.forEach((data, index) => {
|
|
155
|
-
index in local || imitator.push(data);
|
|
156
|
-
});
|
|
157
|
-
this.list = imitator.list;
|
|
158
|
-
this.memorys = imitator.memorys;
|
|
159
|
-
return this;
|
|
160
|
-
}
|
|
161
|
-
/**
|
|
162
|
-
* 清理存储
|
|
163
|
-
*/
|
|
164
|
-
clear() {
|
|
165
|
-
this.list = [];
|
|
166
|
-
this.memorys.clear();
|
|
167
|
-
}
|
|
168
|
-
}
|
package/cjs/memory/list.js
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var list_exports = {};
|
|
30
|
-
__export(list_exports, {
|
|
31
|
-
default: () => MemoryList
|
|
32
|
-
});
|
|
33
|
-
module.exports = __toCommonJS(list_exports);
|
|
34
|
-
var import_basic = __toESM(require("./basic"), 1);
|
|
35
|
-
class MemoryList extends import_basic.default {
|
|
36
|
-
constructor(key) {
|
|
37
|
-
super(key, {
|
|
38
|
-
mount: (index, reactor) => reactor ? (reactor.push(index), reactor) : [index],
|
|
39
|
-
reflex: (reactor) => reactor
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
}
|