@vope/utils 1.4.5 → 1.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/cjs/index.js +129 -56
- package/lib/clamp.js +2 -2
- package/lib/classnames.js +2 -2
- package/lib/compare/version.js +1 -2
- package/lib/compare/weak-equal.js +1 -2
- package/lib/convert/json.js +1 -2
- package/lib/convert/object.js +1 -2
- package/lib/convert/strings.js +1 -2
- package/lib/desens.js +51 -0
- package/lib/encoding.js +16 -16
- package/lib/index.js +56 -48
- package/lib/input-regex.js +1 -2
- package/lib/is/class.js +1 -2
- package/lib/is/empty.js +2 -3
- package/lib/is/null.js +1 -2
- package/lib/load/image.js +11 -0
- package/lib/memory/basic.js +2 -2
- package/lib/memory/list.js +2 -2
- package/lib/memory/power.js +3 -3
- package/lib/once.js +2 -2
- package/lib/power/decon.js +1 -2
- package/lib/rotate/angle.js +2 -3
- package/lib/rotate/rad.js +1 -2
- package/lib/style/css.js +26 -0
- package/lib/table/flex.js +1 -1
- package/lib/union.js +1 -1
- package/lib/url/join.js +1 -2
- package/lib/url/params.js +1 -2
- package/lib/wait.js +2 -2
- package/package.json +57 -55
- package/types/clamp.d.ts +1 -2
- package/types/classnames.d.ts +2 -2
- package/types/compare/version.d.ts +1 -2
- package/types/compare/weak-equal.d.ts +1 -2
- package/types/convert/json.d.ts +1 -2
- package/types/convert/object.d.ts +1 -2
- package/types/convert/strings.d.ts +1 -2
- package/types/desens.d.ts +40 -0
- package/types/encoding.d.ts +1 -2
- package/types/index.d.ts +27 -24
- package/types/input-regex.d.ts +2 -3
- package/types/is/class.d.ts +1 -2
- package/types/is/empty.d.ts +1 -2
- package/types/is/null.d.ts +1 -2
- package/types/load/image.d.ts +5 -0
- package/types/memory/basic.d.ts +1 -1
- package/types/memory/list.d.ts +2 -2
- package/types/memory/power.d.ts +2 -2
- package/types/once.d.ts +1 -2
- package/types/power/decon.d.ts +2 -2
- package/types/rotate/angle.d.ts +1 -2
- package/types/rotate/rad.d.ts +1 -2
- package/types/style/css.d.ts +9 -0
- package/types/table/flex.d.ts +1 -1
- package/types/union.d.ts +1 -1
- package/types/url/join.d.ts +1 -2
- package/types/url/params.d.ts +2 -2
- package/types/wait.d.ts +1 -2
package/cjs/index.js
CHANGED
|
@@ -25,30 +25,35 @@ __export(src_exports, {
|
|
|
25
25
|
MemoryList: () => MemoryList,
|
|
26
26
|
MemoryPower: () => MemoryPower,
|
|
27
27
|
Union: () => Union,
|
|
28
|
-
clamp: () =>
|
|
29
|
-
classnames: () =>
|
|
30
|
-
compareVersion: () =>
|
|
31
|
-
connectURLParams: () =>
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
28
|
+
clamp: () => clamp,
|
|
29
|
+
classnames: () => classnames,
|
|
30
|
+
compareVersion: () => compareVersion,
|
|
31
|
+
connectURLParams: () => connectURLParams,
|
|
32
|
+
css: () => css,
|
|
33
|
+
deconPowersSum: () => deconPowersSum,
|
|
34
|
+
deepWeakEqual: () => deepWeakEqual,
|
|
35
|
+
desensDecrypt: () => desensDecrypt,
|
|
36
|
+
desensEncrypt: () => desensEncrypt,
|
|
37
|
+
desensReplace: () => desensReplace,
|
|
38
|
+
getEncoding: () => getEncoding,
|
|
39
|
+
hash8json: () => hash8json,
|
|
40
|
+
hash8object: () => hash8object,
|
|
41
|
+
hash8strings: () => hash8strings,
|
|
42
|
+
inputRegex: () => inputRegex,
|
|
43
|
+
isClass: () => isClass,
|
|
44
|
+
isEmpty: () => isEmpty,
|
|
45
|
+
isNull: () => isNull,
|
|
46
|
+
joinPaths: () => joinPaths,
|
|
47
|
+
loadImage: () => loadImage,
|
|
48
|
+
once: () => once,
|
|
49
|
+
rotateAngle: () => rotateAngle,
|
|
50
|
+
rotateRad: () => rotateRad,
|
|
51
|
+
wait: () => wait
|
|
47
52
|
});
|
|
48
53
|
module.exports = __toCommonJS(src_exports);
|
|
49
54
|
|
|
50
55
|
// src/clamp.ts
|
|
51
|
-
var
|
|
56
|
+
var clamp = (value, min, max) => {
|
|
52
57
|
if (min > max) {
|
|
53
58
|
const swap = max;
|
|
54
59
|
max = min;
|
|
@@ -60,7 +65,7 @@ var clamp_default = (value, min, max) => {
|
|
|
60
65
|
// src/classnames.ts
|
|
61
66
|
var import_lodash_es = require("lodash-es");
|
|
62
67
|
var add = (a, b) => a ? a + " " + b : b;
|
|
63
|
-
var
|
|
68
|
+
var classnames = (...list) => list.reduce((caches, data) => {
|
|
64
69
|
if ((0, import_lodash_es.isString)(data)) {
|
|
65
70
|
data && (caches = add(caches, data));
|
|
66
71
|
} else if (Array.isArray(data)) {
|
|
@@ -88,7 +93,6 @@ var compareVersion = (from, to) => {
|
|
|
88
93
|
}
|
|
89
94
|
return 0;
|
|
90
95
|
};
|
|
91
|
-
var version_default = compareVersion;
|
|
92
96
|
|
|
93
97
|
// src/compare/weak-equal.ts
|
|
94
98
|
var deepWeakEqual = (from, to) => {
|
|
@@ -121,28 +125,72 @@ var deepWeakEqual = (from, to) => {
|
|
|
121
125
|
}
|
|
122
126
|
return true;
|
|
123
127
|
};
|
|
124
|
-
var weak_equal_default = deepWeakEqual;
|
|
125
128
|
|
|
126
129
|
// src/convert/json.ts
|
|
127
130
|
var hash8json = (list, key) => list.reduce((caches, data) => {
|
|
128
131
|
caches[data[key]] = data;
|
|
129
132
|
return caches;
|
|
130
133
|
}, {});
|
|
131
|
-
var json_default = hash8json;
|
|
132
134
|
|
|
133
135
|
// src/convert/object.ts
|
|
134
136
|
var hash8object = (list, key) => list.reduce((caches, data) => {
|
|
135
137
|
caches.set(data[key], data);
|
|
136
138
|
return caches;
|
|
137
139
|
}, /* @__PURE__ */ new Map());
|
|
138
|
-
var object_default = hash8object;
|
|
139
140
|
|
|
140
141
|
// src/convert/strings.ts
|
|
141
142
|
var hash8strings = (list) => list.reduce((caches, data, index) => {
|
|
142
143
|
caches[data] = index;
|
|
143
144
|
return caches;
|
|
144
145
|
}, {});
|
|
145
|
-
|
|
146
|
+
|
|
147
|
+
// src/desens.ts
|
|
148
|
+
var import_lodash_es2 = require("lodash-es");
|
|
149
|
+
var desensEncrypt = (plaintext, encrypt) => {
|
|
150
|
+
const rules = [];
|
|
151
|
+
let point = -1;
|
|
152
|
+
let ciphertext = encrypt(plaintext).reduce((cache, { range, ciphertext: ciphertext2 }) => {
|
|
153
|
+
cache += plaintext.slice(point + 1, range[0]) + ciphertext2;
|
|
154
|
+
point = range[1];
|
|
155
|
+
rules.push({
|
|
156
|
+
range,
|
|
157
|
+
modify: ciphertext2.length
|
|
158
|
+
});
|
|
159
|
+
return cache;
|
|
160
|
+
}, "");
|
|
161
|
+
if (point !== -1) {
|
|
162
|
+
ciphertext += plaintext.slice(point + 1);
|
|
163
|
+
}
|
|
164
|
+
return {
|
|
165
|
+
ciphertext,
|
|
166
|
+
rules
|
|
167
|
+
};
|
|
168
|
+
};
|
|
169
|
+
var desensDecrypt = (ciphertext, rules, decrypt) => {
|
|
170
|
+
Array.isArray(rules) || (rules = [rules]);
|
|
171
|
+
let offset = 0;
|
|
172
|
+
let from = 0;
|
|
173
|
+
return rules.reduce((cache, { range: [start, stop], modify }) => {
|
|
174
|
+
cache += ciphertext.slice(from, start + offset) + decrypt(ciphertext.slice(start + offset, start + offset + modify));
|
|
175
|
+
from = start + offset + modify;
|
|
176
|
+
offset += modify - (stop + 1 - start);
|
|
177
|
+
return cache;
|
|
178
|
+
}, "") + ciphertext.slice(from);
|
|
179
|
+
};
|
|
180
|
+
var desensReplace = (ciphertext, rules, replacer = "*") => {
|
|
181
|
+
Array.isArray(rules) || (rules = [rules]);
|
|
182
|
+
let offset = 0;
|
|
183
|
+
let from = 0;
|
|
184
|
+
return rules.reduce((cache, { range: [start, stop], modify }) => {
|
|
185
|
+
const part = ciphertext.slice(start + offset, start + offset + modify);
|
|
186
|
+
const size = stop + 1 - start;
|
|
187
|
+
const replaceValue = (0, import_lodash_es2.isString)(replacer) ? replacer.repeat(size) : replacer[Symbol.replace](part, size);
|
|
188
|
+
cache += ciphertext.slice(from, start + offset) + replaceValue;
|
|
189
|
+
from = start + offset + modify;
|
|
190
|
+
offset += modify - size;
|
|
191
|
+
return cache;
|
|
192
|
+
}, "") + ciphertext.slice(from);
|
|
193
|
+
};
|
|
146
194
|
|
|
147
195
|
// src/encoding.ts
|
|
148
196
|
var utf8_first_prefix = /^1{2,}/g;
|
|
@@ -153,28 +201,29 @@ var Encodes = {
|
|
|
153
201
|
UTF_16BE: "utf-16be",
|
|
154
202
|
GBK: "gbk"
|
|
155
203
|
};
|
|
156
|
-
var
|
|
157
|
-
|
|
204
|
+
var BOM = {
|
|
205
|
+
UTF_8: [239, 187, 191],
|
|
206
|
+
UTF_16LE: [255, 254],
|
|
207
|
+
UTF_16BE: [254, 255]
|
|
158
208
|
};
|
|
159
209
|
var equal = (uint, list) => {
|
|
160
|
-
|
|
161
|
-
return false;
|
|
162
|
-
return !uint.some((value, index) => value !== list[index]);
|
|
210
|
+
return uint.length === list.length ? !uint.some((value, index) => value !== list[index]) : false;
|
|
163
211
|
};
|
|
164
212
|
var getEncoding = (uint, limit = 1024) => {
|
|
165
213
|
let encoding;
|
|
166
214
|
let offset = 0;
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
}
|
|
215
|
+
for (const key in BOM) {
|
|
216
|
+
const head = BOM[key];
|
|
217
|
+
if (equal(uint.slice(0, head.length), head)) {
|
|
218
|
+
offset = head.length;
|
|
219
|
+
encoding = Encodes[key];
|
|
220
|
+
break;
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
if (!encoding) {
|
|
175
224
|
let isBreak = false;
|
|
176
225
|
top:
|
|
177
|
-
for (let i = 0
|
|
226
|
+
for (let i = 0, max = Math.min(uint.length, limit); i < max; i++) {
|
|
178
227
|
const data = uint[i];
|
|
179
228
|
if (data < 128)
|
|
180
229
|
continue;
|
|
@@ -198,7 +247,6 @@ var getEncoding = (uint, limit = 1024) => {
|
|
|
198
247
|
}
|
|
199
248
|
return { encoding, offset };
|
|
200
249
|
};
|
|
201
|
-
var encoding_default = getEncoding;
|
|
202
250
|
|
|
203
251
|
// src/input-regex.ts
|
|
204
252
|
var RE_REGEX = /[$()*+.[?\\^{|]/g;
|
|
@@ -206,7 +254,6 @@ var RE_STRING = /[$()*+.[?\\^{|-]/g;
|
|
|
206
254
|
function inputRegex(text, flags) {
|
|
207
255
|
return flags === false ? text.replace(RE_STRING, ($0) => "\\" + $0) : new RegExp(text.replace(RE_REGEX, ($0) => "\\" + $0), flags);
|
|
208
256
|
}
|
|
209
|
-
var input_regex_default = inputRegex;
|
|
210
257
|
|
|
211
258
|
// src/is/class.ts
|
|
212
259
|
var re_anonymous = /^function\s+\(|^function\s+anonymous\(/;
|
|
@@ -234,15 +281,22 @@ var isClass = (value, strict = true) => {
|
|
|
234
281
|
}
|
|
235
282
|
return false;
|
|
236
283
|
};
|
|
237
|
-
var class_default = isClass;
|
|
238
284
|
|
|
239
285
|
// src/is/null.ts
|
|
240
286
|
var isNull = (value) => value === void 0 || value === null;
|
|
241
|
-
var null_default = isNull;
|
|
242
287
|
|
|
243
288
|
// src/is/empty.ts
|
|
244
|
-
var isEmpty = (value) =>
|
|
245
|
-
|
|
289
|
+
var isEmpty = (value) => isNull(value) || value === "";
|
|
290
|
+
|
|
291
|
+
// src/load/image.ts
|
|
292
|
+
var loadImage = (src) => {
|
|
293
|
+
return new Promise((resolve) => {
|
|
294
|
+
const img = new Image();
|
|
295
|
+
img.onload = () => resolve(img);
|
|
296
|
+
img.onerror = () => resolve(null);
|
|
297
|
+
img.src = src;
|
|
298
|
+
});
|
|
299
|
+
};
|
|
246
300
|
|
|
247
301
|
// src/memory/basic.ts
|
|
248
302
|
var MemoryBasic = class {
|
|
@@ -361,7 +415,7 @@ var MemoryBasic = class {
|
|
|
361
415
|
const { memorys, list } = this;
|
|
362
416
|
if (!memorys.has(type))
|
|
363
417
|
return this;
|
|
364
|
-
const local =
|
|
418
|
+
const local = hash8strings(this.#reflex(memorys.get(type)));
|
|
365
419
|
const Memory = this.constructor;
|
|
366
420
|
const imitator = new Memory(this.key);
|
|
367
421
|
list.forEach((data, index) => {
|
|
@@ -410,20 +464,19 @@ var deconPowersSum = (sum, sort) => {
|
|
|
410
464
|
}
|
|
411
465
|
return sort === "asc" ? list.reverse() : list;
|
|
412
466
|
};
|
|
413
|
-
var decon_default = deconPowersSum;
|
|
414
467
|
|
|
415
468
|
// src/memory/power.ts
|
|
416
469
|
var MemoryPower = class extends MemoryBasic {
|
|
417
470
|
constructor(key) {
|
|
418
471
|
super(key, {
|
|
419
472
|
mount: (index, reactor) => (reactor || 0) + 2 ** index,
|
|
420
|
-
reflex: (reactor) =>
|
|
473
|
+
reflex: (reactor) => deconPowersSum(reactor, "asc")
|
|
421
474
|
});
|
|
422
475
|
}
|
|
423
476
|
};
|
|
424
477
|
|
|
425
478
|
// src/once.ts
|
|
426
|
-
var
|
|
479
|
+
var once = (func, thisArg) => {
|
|
427
480
|
let local;
|
|
428
481
|
let inited = false;
|
|
429
482
|
return (...list) => inited ? local : (inited = true, local = func.apply(thisArg, list));
|
|
@@ -438,11 +491,33 @@ var rotateRad = (from, rad, visit = [0, 0]) => {
|
|
|
438
491
|
y * Math.cos(rad) - x * Math.sin(rad) + visit[1]
|
|
439
492
|
];
|
|
440
493
|
};
|
|
441
|
-
var rad_default = rotateRad;
|
|
442
494
|
|
|
443
495
|
// src/rotate/angle.ts
|
|
444
|
-
var rotateAngle = (from, angle, visit) =>
|
|
445
|
-
|
|
496
|
+
var rotateAngle = (from, angle, visit) => rotateRad(from, angle / 180 * Math.PI, visit);
|
|
497
|
+
|
|
498
|
+
// src/style/css.ts
|
|
499
|
+
var import_lodash_es3 = require("lodash-es");
|
|
500
|
+
var hump = /[A-Z]/g;
|
|
501
|
+
var css = (...args) => {
|
|
502
|
+
const list = [];
|
|
503
|
+
for (let i = 0; i < args.length; i++) {
|
|
504
|
+
const data = args[i];
|
|
505
|
+
if (!data)
|
|
506
|
+
continue;
|
|
507
|
+
if ((0, import_lodash_es3.isString)(data)) {
|
|
508
|
+
list.push(data);
|
|
509
|
+
} else if (Array.isArray(data)) {
|
|
510
|
+
const result = css(...data);
|
|
511
|
+
result && list.push(result);
|
|
512
|
+
} else {
|
|
513
|
+
for (const key in data) {
|
|
514
|
+
const value = data[key];
|
|
515
|
+
isNull(value) || list.push(`${key.replace(hump, ($0) => "-" + $0.toLocaleLowerCase())}: ${value}`);
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
return list.join(";");
|
|
520
|
+
};
|
|
446
521
|
|
|
447
522
|
// src/table/flex.ts
|
|
448
523
|
var FlexTable = class {
|
|
@@ -575,7 +650,6 @@ var joinPaths = (...list) => {
|
|
|
575
650
|
return "";
|
|
576
651
|
return length === 1 ? list[0] : list.join("/").replace(re, ($0, $1) => `${$1}/`);
|
|
577
652
|
};
|
|
578
|
-
var join_default = joinPaths;
|
|
579
653
|
|
|
580
654
|
// src/url/params.ts
|
|
581
655
|
var connectURLParams = (url, params, isOpenType) => {
|
|
@@ -599,7 +673,6 @@ var connectURLParams = (url, params, isOpenType) => {
|
|
|
599
673
|
const caches = list.join("&");
|
|
600
674
|
return url.includes("?") ? url + "&" + caches : url + "?" + caches;
|
|
601
675
|
};
|
|
602
|
-
var params_default = connectURLParams;
|
|
603
676
|
|
|
604
677
|
// src/wait.ts
|
|
605
|
-
var
|
|
678
|
+
var wait = (delay = 0) => new Promise((resolve) => setTimeout(resolve, delay));
|
package/lib/clamp.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
const clamp = (value, min, max) => {
|
|
2
2
|
if (min > max) {
|
|
3
3
|
const swap = max;
|
|
4
4
|
max = min;
|
|
@@ -7,5 +7,5 @@ var clamp_default = (value, min, max) => {
|
|
|
7
7
|
return Math.min(max, Math.max(min, value));
|
|
8
8
|
};
|
|
9
9
|
export {
|
|
10
|
-
|
|
10
|
+
clamp
|
|
11
11
|
};
|
package/lib/classnames.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { isBoolean, isString } from "lodash-es";
|
|
2
2
|
const add = (a, b) => a ? a + " " + b : b;
|
|
3
|
-
|
|
3
|
+
const classnames = (...list) => list.reduce((caches, data) => {
|
|
4
4
|
if (isString(data)) {
|
|
5
5
|
data && (caches = add(caches, data));
|
|
6
6
|
} else if (Array.isArray(data)) {
|
|
@@ -13,5 +13,5 @@ var classnames_default = (...list) => list.reduce((caches, data) => {
|
|
|
13
13
|
return caches;
|
|
14
14
|
}, "");
|
|
15
15
|
export {
|
|
16
|
-
|
|
16
|
+
classnames
|
|
17
17
|
};
|
package/lib/compare/version.js
CHANGED
package/lib/convert/json.js
CHANGED
package/lib/convert/object.js
CHANGED
package/lib/convert/strings.js
CHANGED
package/lib/desens.js
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { isString } from "lodash-es";
|
|
2
|
+
const desensEncrypt = (plaintext, encrypt) => {
|
|
3
|
+
const rules = [];
|
|
4
|
+
let point = -1;
|
|
5
|
+
let ciphertext = encrypt(plaintext).reduce((cache, { range, ciphertext: ciphertext2 }) => {
|
|
6
|
+
cache += plaintext.slice(point + 1, range[0]) + ciphertext2;
|
|
7
|
+
point = range[1];
|
|
8
|
+
rules.push({
|
|
9
|
+
range,
|
|
10
|
+
modify: ciphertext2.length
|
|
11
|
+
});
|
|
12
|
+
return cache;
|
|
13
|
+
}, "");
|
|
14
|
+
if (point !== -1) {
|
|
15
|
+
ciphertext += plaintext.slice(point + 1);
|
|
16
|
+
}
|
|
17
|
+
return {
|
|
18
|
+
ciphertext,
|
|
19
|
+
rules
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
const desensDecrypt = (ciphertext, rules, decrypt) => {
|
|
23
|
+
Array.isArray(rules) || (rules = [rules]);
|
|
24
|
+
let offset = 0;
|
|
25
|
+
let from = 0;
|
|
26
|
+
return rules.reduce((cache, { range: [start, stop], modify }) => {
|
|
27
|
+
cache += ciphertext.slice(from, start + offset) + decrypt(ciphertext.slice(start + offset, start + offset + modify));
|
|
28
|
+
from = start + offset + modify;
|
|
29
|
+
offset += modify - (stop + 1 - start);
|
|
30
|
+
return cache;
|
|
31
|
+
}, "") + ciphertext.slice(from);
|
|
32
|
+
};
|
|
33
|
+
const desensReplace = (ciphertext, rules, replacer = "*") => {
|
|
34
|
+
Array.isArray(rules) || (rules = [rules]);
|
|
35
|
+
let offset = 0;
|
|
36
|
+
let from = 0;
|
|
37
|
+
return rules.reduce((cache, { range: [start, stop], modify }) => {
|
|
38
|
+
const part = ciphertext.slice(start + offset, start + offset + modify);
|
|
39
|
+
const size = stop + 1 - start;
|
|
40
|
+
const replaceValue = isString(replacer) ? replacer.repeat(size) : replacer[Symbol.replace](part, size);
|
|
41
|
+
cache += ciphertext.slice(from, start + offset) + replaceValue;
|
|
42
|
+
from = start + offset + modify;
|
|
43
|
+
offset += modify - size;
|
|
44
|
+
return cache;
|
|
45
|
+
}, "") + ciphertext.slice(from);
|
|
46
|
+
};
|
|
47
|
+
export {
|
|
48
|
+
desensDecrypt,
|
|
49
|
+
desensEncrypt,
|
|
50
|
+
desensReplace
|
|
51
|
+
};
|
package/lib/encoding.js
CHANGED
|
@@ -6,28 +6,29 @@ const Encodes = {
|
|
|
6
6
|
UTF_16BE: "utf-16be",
|
|
7
7
|
GBK: "gbk"
|
|
8
8
|
};
|
|
9
|
-
const
|
|
10
|
-
|
|
9
|
+
const BOM = {
|
|
10
|
+
UTF_8: [239, 187, 191],
|
|
11
|
+
UTF_16LE: [255, 254],
|
|
12
|
+
UTF_16BE: [254, 255]
|
|
11
13
|
};
|
|
12
14
|
const equal = (uint, list) => {
|
|
13
|
-
|
|
14
|
-
return false;
|
|
15
|
-
return !uint.some((value, index) => value !== list[index]);
|
|
15
|
+
return uint.length === list.length ? !uint.some((value, index) => value !== list[index]) : false;
|
|
16
16
|
};
|
|
17
17
|
const getEncoding = (uint, limit = 1024) => {
|
|
18
18
|
let encoding;
|
|
19
19
|
let offset = 0;
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}
|
|
20
|
+
for (const key in BOM) {
|
|
21
|
+
const head = BOM[key];
|
|
22
|
+
if (equal(uint.slice(0, head.length), head)) {
|
|
23
|
+
offset = head.length;
|
|
24
|
+
encoding = Encodes[key];
|
|
25
|
+
break;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
if (!encoding) {
|
|
28
29
|
let isBreak = false;
|
|
29
30
|
top:
|
|
30
|
-
for (let i = 0
|
|
31
|
+
for (let i = 0, max = Math.min(uint.length, limit); i < max; i++) {
|
|
31
32
|
const data = uint[i];
|
|
32
33
|
if (data < 128)
|
|
33
34
|
continue;
|
|
@@ -51,7 +52,6 @@ const getEncoding = (uint, limit = 1024) => {
|
|
|
51
52
|
}
|
|
52
53
|
return { encoding, offset };
|
|
53
54
|
};
|
|
54
|
-
var encoding_default = getEncoding;
|
|
55
55
|
export {
|
|
56
|
-
|
|
56
|
+
getEncoding
|
|
57
57
|
};
|
package/lib/index.js
CHANGED
|
@@ -1,50 +1,58 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
1
|
+
import { clamp } from "./clamp";
|
|
2
|
+
import { classnames } from "./classnames";
|
|
3
|
+
import { compareVersion } from "./compare/version";
|
|
4
|
+
import { deepWeakEqual } from "./compare/weak-equal";
|
|
5
|
+
import { hash8json } from "./convert/json";
|
|
6
|
+
import { hash8object } from "./convert/object";
|
|
7
|
+
import { hash8strings } from "./convert/strings";
|
|
8
|
+
import { desensEncrypt, desensDecrypt, desensReplace } from "./desens";
|
|
9
|
+
import { getEncoding } from "./encoding";
|
|
10
|
+
import { inputRegex } from "./input-regex";
|
|
11
|
+
import { isClass } from "./is/class";
|
|
12
|
+
import { isEmpty } from "./is/empty";
|
|
13
|
+
import { isNull } from "./is/null";
|
|
14
|
+
import { loadImage } from "./load/image";
|
|
15
|
+
import { MemoryBasic } from "./memory/basic";
|
|
16
|
+
import { MemoryList } from "./memory/list";
|
|
17
|
+
import { MemoryPower } from "./memory/power";
|
|
18
|
+
import { once } from "./once";
|
|
19
|
+
import { deconPowersSum } from "./power/decon";
|
|
20
|
+
import { rotateAngle } from "./rotate/angle";
|
|
21
|
+
import { rotateRad } from "./rotate/rad";
|
|
22
|
+
import { css } from "./style/css";
|
|
23
|
+
import { FlexTable } from "./table/flex";
|
|
24
|
+
import { Union } from "./union";
|
|
25
|
+
import { joinPaths } from "./url/join";
|
|
26
|
+
import { connectURLParams } from "./url/params";
|
|
27
|
+
import { wait } from "./wait";
|
|
25
28
|
export {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
29
|
+
FlexTable,
|
|
30
|
+
MemoryBasic,
|
|
31
|
+
MemoryList,
|
|
32
|
+
MemoryPower,
|
|
33
|
+
Union,
|
|
34
|
+
clamp,
|
|
35
|
+
classnames,
|
|
36
|
+
compareVersion,
|
|
37
|
+
connectURLParams,
|
|
38
|
+
css,
|
|
39
|
+
deconPowersSum,
|
|
40
|
+
deepWeakEqual,
|
|
41
|
+
desensDecrypt,
|
|
42
|
+
desensEncrypt,
|
|
43
|
+
desensReplace,
|
|
44
|
+
getEncoding,
|
|
45
|
+
hash8json,
|
|
46
|
+
hash8object,
|
|
47
|
+
hash8strings,
|
|
48
|
+
inputRegex,
|
|
49
|
+
isClass,
|
|
50
|
+
isEmpty,
|
|
51
|
+
isNull,
|
|
52
|
+
joinPaths,
|
|
53
|
+
loadImage,
|
|
54
|
+
once,
|
|
55
|
+
rotateAngle,
|
|
56
|
+
rotateRad,
|
|
57
|
+
wait
|
|
50
58
|
};
|
package/lib/input-regex.js
CHANGED
|
@@ -3,7 +3,6 @@ const RE_STRING = /[$()*+.[?\\^{|-]/g;
|
|
|
3
3
|
function inputRegex(text, flags) {
|
|
4
4
|
return flags === false ? text.replace(RE_STRING, ($0) => "\\" + $0) : new RegExp(text.replace(RE_REGEX, ($0) => "\\" + $0), flags);
|
|
5
5
|
}
|
|
6
|
-
var input_regex_default = inputRegex;
|
|
7
6
|
export {
|
|
8
|
-
|
|
7
|
+
inputRegex
|
|
9
8
|
};
|
package/lib/is/class.js
CHANGED
package/lib/is/empty.js
CHANGED
package/lib/is/null.js
CHANGED