@vope/utils 1.3.1 → 1.4.1
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/cjs/clamp.js +29 -12
- package/cjs/classnames.js +34 -20
- package/cjs/compare/version.js +35 -18
- package/cjs/compare/weak-equal.js +49 -36
- package/cjs/convert/json.js +25 -15
- package/cjs/convert/object.js +26 -16
- package/cjs/convert/strings.js +25 -9
- package/cjs/encoding.js +64 -51
- package/cjs/index.js +76 -53
- package/cjs/input-regex.js +24 -5
- package/cjs/is/class.js +40 -23
- package/cjs/is/empty.js +34 -10
- package/cjs/is/null.js +24 -7
- package/cjs/memory/basic.js +159 -139
- package/cjs/memory/list.js +39 -17
- package/cjs/memory/power.js +40 -16
- package/cjs/memory/type.d.js +16 -0
- package/cjs/once.js +26 -13
- package/cjs/power/decon.js +38 -26
- package/cjs/rotate/angle.js +34 -12
- package/cjs/rotate/rad.js +29 -14
- package/cjs/union.js +41 -26
- package/cjs/url/join.js +27 -11
- package/cjs/url/params.js +41 -33
- package/cjs/wait.js +23 -5
- package/lib/clamp.js +7 -10
- package/lib/classnames.js +12 -18
- package/lib/compare/version.js +13 -16
- package/lib/compare/weak-equal.js +27 -34
- package/lib/convert/json.js +3 -13
- package/lib/convert/object.js +4 -14
- package/lib/convert/strings.js +3 -7
- package/lib/encoding.js +42 -49
- package/lib/index.js +24 -24
- package/lib/input-regex.js +2 -3
- package/lib/is/class.js +18 -21
- package/lib/is/empty.js +3 -6
- package/lib/is/null.js +2 -5
- package/lib/memory/basic.js +129 -135
- package/lib/memory/list.js +8 -12
- package/lib/memory/power.js +9 -11
- package/lib/memory/type.d.js +1 -0
- package/lib/once.js +4 -11
- package/lib/power/decon.js +16 -24
- package/lib/rotate/angle.js +2 -7
- package/lib/rotate/rad.js +7 -12
- package/lib/union.js +20 -24
- package/lib/url/join.js +5 -9
- package/lib/url/params.js +19 -31
- package/lib/wait.js +1 -3
- package/package.json +6 -8
- package/types/index.d.ts +0 -1
- package/cjs/api.js +0 -56
- package/lib/api.js +0 -48
- package/types/api.d.ts +0 -19
package/cjs/memory/list.js
CHANGED
|
@@ -1,20 +1,42 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
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 });
|
|
4
11
|
};
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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
|
+
}
|
|
19
42
|
}
|
|
20
|
-
exports.default = MemoryList;
|
package/cjs/memory/power.js
CHANGED
|
@@ -1,19 +1,43 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
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 });
|
|
4
11
|
};
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
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 power_exports = {};
|
|
30
|
+
__export(power_exports, {
|
|
31
|
+
default: () => MemoryPower
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(power_exports);
|
|
34
|
+
var import_decon = __toESM(require("../power/decon"), 1);
|
|
35
|
+
var import_basic = __toESM(require("./basic"), 1);
|
|
36
|
+
class MemoryPower extends import_basic.default {
|
|
37
|
+
constructor(key) {
|
|
38
|
+
super(key, {
|
|
39
|
+
mount: (index, reactor) => (reactor || 0) + 2 ** index,
|
|
40
|
+
reflex: (reactor) => (0, import_decon.default)(reactor, "asc")
|
|
41
|
+
});
|
|
42
|
+
}
|
|
18
43
|
}
|
|
19
|
-
exports.default = MemoryPower;
|
|
@@ -0,0 +1,16 @@
|
|
|
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 __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
var type_d_exports = {};
|
|
16
|
+
module.exports = __toCommonJS(type_d_exports);
|
package/cjs/once.js
CHANGED
|
@@ -1,15 +1,28 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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 once_exports = {};
|
|
20
|
+
__export(once_exports, {
|
|
21
|
+
default: () => once_default
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(once_exports);
|
|
24
|
+
var once_default = (func, thisArg) => {
|
|
25
|
+
let local;
|
|
26
|
+
let inited = false;
|
|
27
|
+
return (...list) => inited ? local : (inited = true, local = func.apply(thisArg, list));
|
|
15
28
|
};
|
package/cjs/power/decon.js
CHANGED
|
@@ -1,31 +1,43 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty
|
|
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 decon_exports = {};
|
|
20
|
+
__export(decon_exports, {
|
|
21
|
+
default: () => decon_default
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(decon_exports);
|
|
3
24
|
const ERROR_MESSAGE = {
|
|
4
|
-
|
|
5
|
-
|
|
25
|
+
INT: "\u53C2\u6570\u5FC5\u987B\u662F\u6574\u6570",
|
|
26
|
+
MIN: "\u591A\u4E2A2\u7684\u6B63\u6574\u6570\u5E42(\u4E24\u4E24\u4E0D\u76F8\u7B49)\u4E4B\u548C\u5FC5\u5B9A\u5927\u4E8E\u7B49\u4E8E1"
|
|
6
27
|
};
|
|
7
|
-
/**
|
|
8
|
-
* 解构多个2的正整数幂(两两不相等)之和
|
|
9
|
-
* @param sum 幂和
|
|
10
|
-
* @param sort 排序方式(默认降序)
|
|
11
|
-
* @description sum > 2**53则会因为精度问题计算报错
|
|
12
|
-
*/
|
|
13
28
|
const deconPowersSum = (sum, sort) => {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
return sort === 'asc'
|
|
28
|
-
? list.reverse()
|
|
29
|
-
: list;
|
|
29
|
+
if (sum < 1) {
|
|
30
|
+
throw new Error(ERROR_MESSAGE.MIN);
|
|
31
|
+
} else if (sum !== Math.floor(sum)) {
|
|
32
|
+
throw new Error(ERROR_MESSAGE.INT);
|
|
33
|
+
}
|
|
34
|
+
const list = [];
|
|
35
|
+
let cache = sum;
|
|
36
|
+
while (cache) {
|
|
37
|
+
const power = Math.log2(cache) ^ 0;
|
|
38
|
+
list.push(power);
|
|
39
|
+
cache -= Math.pow(2, power);
|
|
40
|
+
}
|
|
41
|
+
return sort === "asc" ? list.reverse() : list;
|
|
30
42
|
};
|
|
31
|
-
|
|
43
|
+
var decon_default = deconPowersSum;
|
package/cjs/rotate/angle.js
CHANGED
|
@@ -1,14 +1,36 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
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 });
|
|
4
11
|
};
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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 angle_exports = {};
|
|
30
|
+
__export(angle_exports, {
|
|
31
|
+
default: () => angle_default
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(angle_exports);
|
|
34
|
+
var import_rad = __toESM(require("./rad"), 1);
|
|
35
|
+
const rotateAngle = (from, angle, visit) => (0, import_rad.default)(from, angle / 180 * Math.PI, visit);
|
|
36
|
+
var angle_default = rotateAngle;
|
package/cjs/rotate/rad.js
CHANGED
|
@@ -1,17 +1,32 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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 rad_exports = {};
|
|
20
|
+
__export(rad_exports, {
|
|
21
|
+
default: () => rad_default
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(rad_exports);
|
|
9
24
|
const rotateRad = (from, rad, visit = [0, 0]) => {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
25
|
+
const x = from[0] - visit[0];
|
|
26
|
+
const y = from[1] - visit[1];
|
|
27
|
+
return [
|
|
28
|
+
x * Math.cos(rad) + y * Math.sin(rad) + visit[0],
|
|
29
|
+
y * Math.cos(rad) - x * Math.sin(rad) + visit[1]
|
|
30
|
+
];
|
|
16
31
|
};
|
|
17
|
-
|
|
32
|
+
var rad_default = rotateRad;
|
package/cjs/union.js
CHANGED
|
@@ -1,29 +1,44 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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 union_exports = {};
|
|
20
|
+
__export(union_exports, {
|
|
21
|
+
default: () => Union
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(union_exports);
|
|
6
24
|
class Union {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
return this;
|
|
27
|
-
}
|
|
25
|
+
constructor(key, formatter) {
|
|
26
|
+
this.key = key;
|
|
27
|
+
this.formatter = formatter;
|
|
28
|
+
}
|
|
29
|
+
#data = {};
|
|
30
|
+
#options = {};
|
|
31
|
+
get data() {
|
|
32
|
+
return this.#data;
|
|
33
|
+
}
|
|
34
|
+
get options() {
|
|
35
|
+
return this.#options;
|
|
36
|
+
}
|
|
37
|
+
add(data) {
|
|
38
|
+
const key = data[this.key];
|
|
39
|
+
const result = this.formatter(data);
|
|
40
|
+
this.#data[key] = result.data;
|
|
41
|
+
this.#options[key] = result.option;
|
|
42
|
+
return this;
|
|
43
|
+
}
|
|
28
44
|
}
|
|
29
|
-
exports.default = Union;
|
package/cjs/url/join.js
CHANGED
|
@@ -1,15 +1,31 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty
|
|
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 join_exports = {};
|
|
20
|
+
__export(join_exports, {
|
|
21
|
+
default: () => join_default
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(join_exports);
|
|
3
24
|
const re = /([^:])\/{2,}/g;
|
|
4
|
-
/**
|
|
5
|
-
* 实现多个路径拼接
|
|
6
|
-
*/
|
|
7
25
|
const joinPaths = (...list) => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
? list[0]
|
|
13
|
-
: list.join('/').replace(re, ($0, $1) => `${$1}/`);
|
|
26
|
+
const { length } = list;
|
|
27
|
+
if (length === 0)
|
|
28
|
+
return "";
|
|
29
|
+
return length === 1 ? list[0] : list.join("/").replace(re, ($0, $1) => `${$1}/`);
|
|
14
30
|
};
|
|
15
|
-
|
|
31
|
+
var join_default = joinPaths;
|
package/cjs/url/params.js
CHANGED
|
@@ -1,37 +1,45 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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 params_exports = {};
|
|
20
|
+
__export(params_exports, {
|
|
21
|
+
default: () => params_default
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(params_exports);
|
|
10
24
|
const connectURLParams = (url, params, isOpenType) => {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
: value.join(',')));
|
|
25
|
-
}
|
|
26
|
-
else {
|
|
27
|
-
list.push(key + '=' + (isOpenType ? JSON.stringify(value) : value.toString()));
|
|
28
|
-
}
|
|
25
|
+
if (!params)
|
|
26
|
+
return url;
|
|
27
|
+
const list = [];
|
|
28
|
+
for (const key in params) {
|
|
29
|
+
const value = params[key];
|
|
30
|
+
if (value === void 0) {
|
|
31
|
+
list.push(key);
|
|
32
|
+
} else if (Array.isArray(value)) {
|
|
33
|
+
list.push(
|
|
34
|
+
key + "=" + (isOpenType ? JSON.stringify(value).slice(1, -1) : value.join(","))
|
|
35
|
+
);
|
|
36
|
+
} else {
|
|
37
|
+
list.push(key + "=" + (isOpenType ? JSON.stringify(value) : value.toString()));
|
|
29
38
|
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
: url + '?' + caches;
|
|
39
|
+
}
|
|
40
|
+
if (!list.length)
|
|
41
|
+
return url;
|
|
42
|
+
const caches = list.join("&");
|
|
43
|
+
return url.includes("?") ? url + "&" + caches : url + "?" + caches;
|
|
36
44
|
};
|
|
37
|
-
|
|
45
|
+
var params_default = connectURLParams;
|
package/cjs/wait.js
CHANGED
|
@@ -1,6 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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 wait_exports = {};
|
|
20
|
+
__export(wait_exports, {
|
|
21
|
+
default: () => wait_default
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(wait_exports);
|
|
24
|
+
var wait_default = (delay = 0) => new Promise((resolve) => window.setTimeout(resolve, delay));
|
package/lib/clamp.js
CHANGED
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
* 获取中间数
|
|
3
|
-
*/
|
|
1
|
+
"use strict";
|
|
4
2
|
export default (value, min, max) => {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
return Math.min(max, Math.max(min, value));
|
|
3
|
+
if (min > max) {
|
|
4
|
+
const swap = max;
|
|
5
|
+
max = min;
|
|
6
|
+
min = swap;
|
|
7
|
+
}
|
|
8
|
+
return Math.min(max, Math.max(min, value));
|
|
12
9
|
};
|
package/lib/classnames.js
CHANGED
|
@@ -1,20 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
: b;
|
|
4
|
-
/**
|
|
5
|
-
* 拼接多个class
|
|
6
|
-
*/
|
|
1
|
+
"use strict";
|
|
2
|
+
const add = (a, b) => a ? a + " " + b : b;
|
|
7
3
|
export default (...list) => list.reduce((caches, data) => {
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
if (typeof data === "string") {
|
|
5
|
+
data && (caches = add(caches, data));
|
|
6
|
+
} else if (Array.isArray(data)) {
|
|
7
|
+
data.forEach((value) => value && (caches = add(caches, value)));
|
|
8
|
+
} else if (data) {
|
|
9
|
+
for (const key in data) {
|
|
10
|
+
key && data[key] && (caches = add(caches, key));
|
|
10
11
|
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
else if (data) {
|
|
15
|
-
for (const key in data) {
|
|
16
|
-
key && data[key] && (caches = add(caches, key));
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
return caches;
|
|
20
|
-
}, '');
|
|
12
|
+
}
|
|
13
|
+
return caches;
|
|
14
|
+
}, "");
|