@sapphire/time-utilities 1.7.1 → 1.7.3
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/index.d.ts.map +1 -0
- package/dist/index.global.js +7 -455
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +8 -19
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +0 -6
- package/dist/index.mjs.map +1 -1
- package/dist/lib/Cron.d.ts.map +1 -0
- package/package.json +3 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAClD,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,yBAAyB,CAAC;AACxC,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC"}
|
package/dist/index.global.js
CHANGED
|
@@ -4,25 +4,20 @@ var SapphireTimeUtilities = (() => {
|
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
6
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
7
|
-
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
8
7
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
9
8
|
var __export = (target, all) => {
|
|
10
9
|
for (var name in all)
|
|
11
10
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
12
11
|
};
|
|
13
|
-
var
|
|
14
|
-
if (
|
|
15
|
-
for (let key of __getOwnPropNames(
|
|
16
|
-
if (!__hasOwnProp.call(
|
|
17
|
-
__defProp(
|
|
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 });
|
|
18
17
|
}
|
|
19
|
-
return
|
|
18
|
+
return to;
|
|
20
19
|
};
|
|
21
|
-
var __toCommonJS =
|
|
22
|
-
return (module, temp) => {
|
|
23
|
-
return cache && cache.get(module) || (temp = __reExport(__markAsModule({}), module, 1), cache && cache.set(module, temp), temp);
|
|
24
|
-
};
|
|
25
|
-
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
20
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
26
21
|
var __publicField = (obj, key, value) => {
|
|
27
22
|
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
28
23
|
return value;
|
|
@@ -159,448 +154,11 @@ var SapphireTimeUtilities = (() => {
|
|
|
159
154
|
};
|
|
160
155
|
|
|
161
156
|
// ../utilities/dist/index.mjs
|
|
162
|
-
var __defProp2 = Object.defineProperty;
|
|
163
|
-
var __name2 = /* @__PURE__ */ __name((target, value) => __defProp2(target, "name", { value, configurable: true }), "__name");
|
|
164
|
-
function arrayStrictEquals(arr1, arr2) {
|
|
165
|
-
if (arr1 === arr2)
|
|
166
|
-
return true;
|
|
167
|
-
if (arr1.length !== arr2.length)
|
|
168
|
-
return false;
|
|
169
|
-
for (let i = 0; i < arr1.length; i++) {
|
|
170
|
-
if (arr1[i] !== arr2[i] || typeof arr1[i] !== typeof arr2[i])
|
|
171
|
-
return false;
|
|
172
|
-
}
|
|
173
|
-
return true;
|
|
174
|
-
}
|
|
175
|
-
__name(arrayStrictEquals, "arrayStrictEquals");
|
|
176
|
-
__name2(arrayStrictEquals, "arrayStrictEquals");
|
|
177
|
-
function chunk(array, chunkSize) {
|
|
178
|
-
if (!Array.isArray(array))
|
|
179
|
-
throw new TypeError("entries must be an array.");
|
|
180
|
-
if (!Number.isInteger(chunkSize))
|
|
181
|
-
throw new TypeError("chunkSize must be an integer.");
|
|
182
|
-
if (chunkSize < 1)
|
|
183
|
-
throw new RangeError("chunkSize must be 1 or greater.");
|
|
184
|
-
const clone = array.slice();
|
|
185
|
-
const chunks = [];
|
|
186
|
-
while (clone.length)
|
|
187
|
-
chunks.push(clone.splice(0, chunkSize));
|
|
188
|
-
return chunks;
|
|
189
|
-
}
|
|
190
|
-
__name(chunk, "chunk");
|
|
191
|
-
__name2(chunk, "chunk");
|
|
192
|
-
function classExtends(value, base) {
|
|
193
|
-
let ctor = value;
|
|
194
|
-
while (ctor !== null) {
|
|
195
|
-
if (ctor === base)
|
|
196
|
-
return true;
|
|
197
|
-
ctor = Object.getPrototypeOf(ctor);
|
|
198
|
-
}
|
|
199
|
-
return false;
|
|
200
|
-
}
|
|
201
|
-
__name(classExtends, "classExtends");
|
|
202
|
-
__name2(classExtends, "classExtends");
|
|
203
157
|
var zws = String.fromCharCode(8203);
|
|
204
|
-
function codeBlock(language, expression) {
|
|
205
|
-
if (typeof expression === "string") {
|
|
206
|
-
if (expression.length === 0)
|
|
207
|
-
return `\`\`\`${zws}\`\`\``;
|
|
208
|
-
return `\`\`\`${language}
|
|
209
|
-
${expression.replace(/```/, `\`${zws}\`\``).replace(/`$/g, `\`${zws}`)}\`\`\``;
|
|
210
|
-
}
|
|
211
|
-
return `\`\`\`${language}
|
|
212
|
-
${expression || zws}\`\`\``;
|
|
213
|
-
}
|
|
214
|
-
__name(codeBlock, "codeBlock");
|
|
215
|
-
__name2(codeBlock, "codeBlock");
|
|
216
|
-
function splitText(str, length, char = " ") {
|
|
217
|
-
const x = str.substring(0, length).lastIndexOf(char);
|
|
218
|
-
const pos = x === -1 ? length : x;
|
|
219
|
-
return str.substring(0, pos);
|
|
220
|
-
}
|
|
221
|
-
__name(splitText, "splitText");
|
|
222
|
-
__name2(splitText, "splitText");
|
|
223
|
-
function cutText(str, length) {
|
|
224
|
-
if (str.length < length)
|
|
225
|
-
return str;
|
|
226
|
-
const cut = splitText(str, length - 3);
|
|
227
|
-
if (cut.length < length - 3)
|
|
228
|
-
return `${cut}...`;
|
|
229
|
-
return `${cut.slice(0, length - 3)}...`;
|
|
230
|
-
}
|
|
231
|
-
__name(cutText, "cutText");
|
|
232
|
-
__name2(cutText, "cutText");
|
|
233
|
-
function debounce(func, options = {}) {
|
|
234
|
-
var _a;
|
|
235
|
-
let lastArgs;
|
|
236
|
-
let result;
|
|
237
|
-
let timerId;
|
|
238
|
-
let lastCallTime;
|
|
239
|
-
let lastInvokeTime = 0;
|
|
240
|
-
const wait = (_a = options.wait) != null ? _a : 0;
|
|
241
|
-
const maxWait = typeof options.maxWait === "number" ? Math.max(options.maxWait, wait) : null;
|
|
242
|
-
function invokeFunc(time) {
|
|
243
|
-
const args = lastArgs;
|
|
244
|
-
lastArgs = void 0;
|
|
245
|
-
lastInvokeTime = time;
|
|
246
|
-
result = func(...args);
|
|
247
|
-
return result;
|
|
248
|
-
}
|
|
249
|
-
__name(invokeFunc, "invokeFunc");
|
|
250
|
-
__name2(invokeFunc, "invokeFunc");
|
|
251
|
-
function leadingEdge(time) {
|
|
252
|
-
lastInvokeTime = time;
|
|
253
|
-
timerId = setTimeout(timerExpired, wait);
|
|
254
|
-
return result;
|
|
255
|
-
}
|
|
256
|
-
__name(leadingEdge, "leadingEdge");
|
|
257
|
-
__name2(leadingEdge, "leadingEdge");
|
|
258
|
-
function remainingWait(time) {
|
|
259
|
-
const timeSinceLastCall = time - lastCallTime;
|
|
260
|
-
const timeSinceLastInvoke = time - lastInvokeTime;
|
|
261
|
-
const result2 = wait - timeSinceLastCall;
|
|
262
|
-
return maxWait === null ? result2 : Math.min(result2, maxWait - timeSinceLastInvoke);
|
|
263
|
-
}
|
|
264
|
-
__name(remainingWait, "remainingWait");
|
|
265
|
-
__name2(remainingWait, "remainingWait");
|
|
266
|
-
function shouldInvoke(time) {
|
|
267
|
-
const timeSinceLastCall = time - lastCallTime;
|
|
268
|
-
const timeSinceLastInvoke = time - lastInvokeTime;
|
|
269
|
-
return lastCallTime === void 0 || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxWait !== null && timeSinceLastInvoke >= maxWait;
|
|
270
|
-
}
|
|
271
|
-
__name(shouldInvoke, "shouldInvoke");
|
|
272
|
-
__name2(shouldInvoke, "shouldInvoke");
|
|
273
|
-
function timerExpired() {
|
|
274
|
-
const time = Date.now();
|
|
275
|
-
if (shouldInvoke(time)) {
|
|
276
|
-
trailingEdge(time);
|
|
277
|
-
return;
|
|
278
|
-
}
|
|
279
|
-
timerId = setTimeout(timerExpired, remainingWait(time));
|
|
280
|
-
}
|
|
281
|
-
__name(timerExpired, "timerExpired");
|
|
282
|
-
__name2(timerExpired, "timerExpired");
|
|
283
|
-
function trailingEdge(time) {
|
|
284
|
-
timerId = void 0;
|
|
285
|
-
return invokeFunc(time);
|
|
286
|
-
}
|
|
287
|
-
__name(trailingEdge, "trailingEdge");
|
|
288
|
-
__name2(trailingEdge, "trailingEdge");
|
|
289
|
-
function cancel() {
|
|
290
|
-
if (timerId !== void 0) {
|
|
291
|
-
clearTimeout(timerId);
|
|
292
|
-
}
|
|
293
|
-
lastInvokeTime = 0;
|
|
294
|
-
lastArgs = void 0;
|
|
295
|
-
lastCallTime = void 0;
|
|
296
|
-
timerId = void 0;
|
|
297
|
-
}
|
|
298
|
-
__name(cancel, "cancel");
|
|
299
|
-
__name2(cancel, "cancel");
|
|
300
|
-
function flush() {
|
|
301
|
-
return timerId === void 0 ? result : trailingEdge(Date.now());
|
|
302
|
-
}
|
|
303
|
-
__name(flush, "flush");
|
|
304
|
-
__name2(flush, "flush");
|
|
305
|
-
function debounced(...args) {
|
|
306
|
-
const time = Date.now();
|
|
307
|
-
const isInvoking = shouldInvoke(time);
|
|
308
|
-
lastArgs = args;
|
|
309
|
-
lastCallTime = time;
|
|
310
|
-
if (isInvoking) {
|
|
311
|
-
if (timerId === void 0) {
|
|
312
|
-
return leadingEdge(lastCallTime);
|
|
313
|
-
}
|
|
314
|
-
if (maxWait !== null) {
|
|
315
|
-
timerId = setTimeout(timerExpired, wait);
|
|
316
|
-
return invokeFunc(lastCallTime);
|
|
317
|
-
}
|
|
318
|
-
}
|
|
319
|
-
if (timerId === void 0) {
|
|
320
|
-
timerId = setTimeout(timerExpired, wait);
|
|
321
|
-
}
|
|
322
|
-
return result;
|
|
323
|
-
}
|
|
324
|
-
__name(debounced, "debounced");
|
|
325
|
-
__name2(debounced, "debounced");
|
|
326
|
-
debounced.cancel = cancel;
|
|
327
|
-
debounced.flush = flush;
|
|
328
|
-
return debounced;
|
|
329
|
-
}
|
|
330
|
-
__name(debounce, "debounce");
|
|
331
|
-
__name2(debounce, "debounce");
|
|
332
|
-
var primitiveTypes = ["string", "bigint", "number", "boolean"];
|
|
333
|
-
function isPrimitive(input) {
|
|
334
|
-
return primitiveTypes.includes(typeof input);
|
|
335
|
-
}
|
|
336
|
-
__name(isPrimitive, "isPrimitive");
|
|
337
|
-
__name2(isPrimitive, "isPrimitive");
|
|
338
|
-
function deepClone(source) {
|
|
339
|
-
if (source === null || isPrimitive(source)) {
|
|
340
|
-
return source;
|
|
341
|
-
}
|
|
342
|
-
if (source instanceof Date) {
|
|
343
|
-
const output = new source.constructor(source);
|
|
344
|
-
return output;
|
|
345
|
-
}
|
|
346
|
-
if (Array.isArray(source)) {
|
|
347
|
-
const output = new source.constructor(source.length);
|
|
348
|
-
for (let i = 0; i < source.length; i++) {
|
|
349
|
-
output[i] = deepClone(source[i]);
|
|
350
|
-
}
|
|
351
|
-
return output;
|
|
352
|
-
}
|
|
353
|
-
if (source instanceof Map) {
|
|
354
|
-
const output = new source.constructor();
|
|
355
|
-
for (const [key, value] of source.entries()) {
|
|
356
|
-
output.set(key, deepClone(value));
|
|
357
|
-
}
|
|
358
|
-
return output;
|
|
359
|
-
}
|
|
360
|
-
if (source instanceof Set) {
|
|
361
|
-
const output = new source.constructor();
|
|
362
|
-
for (const value of source.values()) {
|
|
363
|
-
output.add(deepClone(value));
|
|
364
|
-
}
|
|
365
|
-
return output;
|
|
366
|
-
}
|
|
367
|
-
if (typeof source === "object") {
|
|
368
|
-
const output = new source.constructor();
|
|
369
|
-
for (const [key, value] of Object.entries(source)) {
|
|
370
|
-
Object.defineProperty(output, key, {
|
|
371
|
-
configurable: true,
|
|
372
|
-
enumerable: true,
|
|
373
|
-
value: deepClone(value),
|
|
374
|
-
writable: true
|
|
375
|
-
});
|
|
376
|
-
}
|
|
377
|
-
return output;
|
|
378
|
-
}
|
|
379
|
-
return source;
|
|
380
|
-
}
|
|
381
|
-
__name(deepClone, "deepClone");
|
|
382
|
-
__name2(deepClone, "deepClone");
|
|
383
|
-
function isNullOrUndefined(value) {
|
|
384
|
-
return value === void 0 || value === null;
|
|
385
|
-
}
|
|
386
|
-
__name(isNullOrUndefined, "isNullOrUndefined");
|
|
387
|
-
__name2(isNullOrUndefined, "isNullOrUndefined");
|
|
388
|
-
function filterNullAndUndefined(value) {
|
|
389
|
-
return !isNullOrUndefined(value);
|
|
390
|
-
}
|
|
391
|
-
__name(filterNullAndUndefined, "filterNullAndUndefined");
|
|
392
|
-
__name2(filterNullAndUndefined, "filterNullAndUndefined");
|
|
393
|
-
function isNullOrUndefinedOrEmpty(value) {
|
|
394
|
-
return isNullOrUndefined(value) || value.length === 0;
|
|
395
|
-
}
|
|
396
|
-
__name(isNullOrUndefinedOrEmpty, "isNullOrUndefinedOrEmpty");
|
|
397
|
-
__name2(isNullOrUndefinedOrEmpty, "isNullOrUndefinedOrEmpty");
|
|
398
|
-
function filterNullAndUndefinedAndEmpty(value) {
|
|
399
|
-
return !isNullOrUndefinedOrEmpty(value);
|
|
400
|
-
}
|
|
401
|
-
__name(filterNullAndUndefinedAndEmpty, "filterNullAndUndefinedAndEmpty");
|
|
402
|
-
__name2(filterNullAndUndefinedAndEmpty, "filterNullAndUndefinedAndEmpty");
|
|
403
|
-
function isNullOrUndefinedOrZero(value) {
|
|
404
|
-
return value === 0 || isNullOrUndefined(value);
|
|
405
|
-
}
|
|
406
|
-
__name(isNullOrUndefinedOrZero, "isNullOrUndefinedOrZero");
|
|
407
|
-
__name2(isNullOrUndefinedOrZero, "isNullOrUndefinedOrZero");
|
|
408
|
-
function filterNullAndUndefinedAndZero(value) {
|
|
409
|
-
return !isNullOrUndefinedOrZero(value);
|
|
410
|
-
}
|
|
411
|
-
__name(filterNullAndUndefinedAndZero, "filterNullAndUndefinedAndZero");
|
|
412
|
-
__name2(filterNullAndUndefinedAndZero, "filterNullAndUndefinedAndZero");
|
|
413
|
-
function hasAtLeastOneKeyInMap(map, keys) {
|
|
414
|
-
return keys.some((key) => map.has(key));
|
|
415
|
-
}
|
|
416
|
-
__name(hasAtLeastOneKeyInMap, "hasAtLeastOneKeyInMap");
|
|
417
|
-
__name2(hasAtLeastOneKeyInMap, "hasAtLeastOneKeyInMap");
|
|
418
158
|
var zws2 = String.fromCharCode(8203);
|
|
419
|
-
function inlineCodeBlock(input) {
|
|
420
|
-
return `\`${input.replace(/ /g, "\xA0").replace(/`/g, `\`${zws2}`)}\``;
|
|
421
|
-
}
|
|
422
|
-
__name(inlineCodeBlock, "inlineCodeBlock");
|
|
423
|
-
__name2(inlineCodeBlock, "inlineCodeBlock");
|
|
424
|
-
function isClass(input) {
|
|
425
|
-
return typeof input === "function" && typeof input.prototype === "object";
|
|
426
|
-
}
|
|
427
|
-
__name(isClass, "isClass");
|
|
428
|
-
__name2(isClass, "isClass");
|
|
429
|
-
function isFunction(input) {
|
|
430
|
-
return typeof input === "function";
|
|
431
|
-
}
|
|
432
|
-
__name(isFunction, "isFunction");
|
|
433
|
-
__name2(isFunction, "isFunction");
|
|
434
|
-
function isNumber(input) {
|
|
435
|
-
return typeof input === "number" && !isNaN(input) && Number.isFinite(input);
|
|
436
|
-
}
|
|
437
|
-
__name(isNumber, "isNumber");
|
|
438
|
-
__name2(isNumber, "isNumber");
|
|
439
|
-
function isObject(input, constructorType) {
|
|
440
|
-
return typeof input === "object" && input ? input.constructor === (constructorType != null ? constructorType : Object) : false;
|
|
441
|
-
}
|
|
442
|
-
__name(isObject, "isObject");
|
|
443
|
-
__name2(isObject, "isObject");
|
|
444
|
-
function hasThen(input) {
|
|
445
|
-
return Reflect.has(input, "then") && isFunction(input.then);
|
|
446
|
-
}
|
|
447
|
-
__name(hasThen, "hasThen");
|
|
448
|
-
__name2(hasThen, "hasThen");
|
|
449
|
-
function hasCatch(input) {
|
|
450
|
-
return Reflect.has(input, "catch") && isFunction(input.catch);
|
|
451
|
-
}
|
|
452
|
-
__name(hasCatch, "hasCatch");
|
|
453
|
-
__name2(hasCatch, "hasCatch");
|
|
454
|
-
function isThenable(input) {
|
|
455
|
-
if (typeof input !== "object" || input === null)
|
|
456
|
-
return false;
|
|
457
|
-
return input instanceof Promise || input !== Promise.prototype && hasThen(input) && hasCatch(input);
|
|
458
|
-
}
|
|
459
|
-
__name(isThenable, "isThenable");
|
|
460
|
-
__name2(isThenable, "isThenable");
|
|
461
|
-
function makeObject(path, value, obj = {}) {
|
|
462
|
-
if (path.includes(".")) {
|
|
463
|
-
const route = path.split(".");
|
|
464
|
-
const lastKey = route.pop();
|
|
465
|
-
let reference = obj;
|
|
466
|
-
for (const key of route) {
|
|
467
|
-
if (!reference[key])
|
|
468
|
-
reference[key] = {};
|
|
469
|
-
reference = reference[key];
|
|
470
|
-
}
|
|
471
|
-
reference[lastKey] = value;
|
|
472
|
-
} else {
|
|
473
|
-
obj[path] = value;
|
|
474
|
-
}
|
|
475
|
-
return obj;
|
|
476
|
-
}
|
|
477
|
-
__name(makeObject, "makeObject");
|
|
478
|
-
__name2(makeObject, "makeObject");
|
|
479
|
-
function mergeDefault(base, overwrites) {
|
|
480
|
-
if (!overwrites)
|
|
481
|
-
return deepClone(base);
|
|
482
|
-
for (const [baseKey, baseValue] of Object.entries(base)) {
|
|
483
|
-
const overwritesValueAtBaseKey = Reflect.get(overwrites, baseKey);
|
|
484
|
-
if (typeof overwritesValueAtBaseKey === "undefined") {
|
|
485
|
-
Reflect.set(overwrites, baseKey, deepClone(baseValue));
|
|
486
|
-
} else if (isObject(overwritesValueAtBaseKey)) {
|
|
487
|
-
Reflect.set(overwrites, baseKey, mergeDefault(baseValue != null ? baseValue : {}, overwritesValueAtBaseKey));
|
|
488
|
-
}
|
|
489
|
-
}
|
|
490
|
-
return overwrites;
|
|
491
|
-
}
|
|
492
|
-
__name(mergeDefault, "mergeDefault");
|
|
493
|
-
__name2(mergeDefault, "mergeDefault");
|
|
494
|
-
function mergeObjects(objTarget, objSource) {
|
|
495
|
-
for (const [key, value] of Object.entries(objSource)) {
|
|
496
|
-
const targetValue = Reflect.get(objTarget, key);
|
|
497
|
-
if (isObject(value)) {
|
|
498
|
-
Reflect.set(objTarget, key, isObject(targetValue) ? mergeObjects(targetValue, value) : value);
|
|
499
|
-
} else if (!isObject(targetValue)) {
|
|
500
|
-
Reflect.set(objTarget, key, value);
|
|
501
|
-
}
|
|
502
|
-
}
|
|
503
|
-
return objTarget;
|
|
504
|
-
}
|
|
505
|
-
__name(mergeObjects, "mergeObjects");
|
|
506
|
-
__name2(mergeObjects, "mergeObjects");
|
|
507
|
-
function noop() {
|
|
508
|
-
}
|
|
509
|
-
__name(noop, "noop");
|
|
510
|
-
__name2(noop, "noop");
|
|
511
|
-
function objectToTuples(original, prefix = "") {
|
|
512
|
-
const entries = [];
|
|
513
|
-
for (const [key, value] of Object.entries(original)) {
|
|
514
|
-
if (isObject(value)) {
|
|
515
|
-
entries.push(...objectToTuples(value, `${prefix}${key}.`));
|
|
516
|
-
} else {
|
|
517
|
-
entries.push([`${prefix}${key}`, value]);
|
|
518
|
-
}
|
|
519
|
-
}
|
|
520
|
-
return entries;
|
|
521
|
-
}
|
|
522
|
-
__name(objectToTuples, "objectToTuples");
|
|
523
|
-
__name2(objectToTuples, "objectToTuples");
|
|
524
|
-
function parseURL(url) {
|
|
525
|
-
try {
|
|
526
|
-
return new URL(url);
|
|
527
|
-
} catch {
|
|
528
|
-
return null;
|
|
529
|
-
}
|
|
530
|
-
}
|
|
531
|
-
__name(parseURL, "parseURL");
|
|
532
|
-
__name2(parseURL, "parseURL");
|
|
533
|
-
function partition(array, predicate) {
|
|
534
|
-
if (!Array.isArray(array))
|
|
535
|
-
throw new TypeError("entries must be an array.");
|
|
536
|
-
if (!isFunction(predicate))
|
|
537
|
-
throw new TypeError("predicate must be an function that returns a boolean value.");
|
|
538
|
-
const partitionOne = [];
|
|
539
|
-
const partitionTwo = [];
|
|
540
|
-
for (let i = 0; i < array.length; i++) {
|
|
541
|
-
if (predicate(array[i], i)) {
|
|
542
|
-
partitionOne.push(array[i]);
|
|
543
|
-
} else {
|
|
544
|
-
partitionTwo.push(array[i]);
|
|
545
|
-
}
|
|
546
|
-
}
|
|
547
|
-
return [partitionOne, partitionTwo];
|
|
548
|
-
}
|
|
549
|
-
__name(partition, "partition");
|
|
550
|
-
__name2(partition, "partition");
|
|
551
159
|
function range(min, max, step) {
|
|
552
160
|
return new Array(Math.floor((max - min) / step) + 1).fill(0).map((_val, i) => min + i * step);
|
|
553
161
|
}
|
|
554
|
-
__name(range, "range");
|
|
555
|
-
__name2(range, "range");
|
|
556
|
-
var REGEXPESC = /[-/\\^$*+?.()|[\]{}]/g;
|
|
557
|
-
function regExpEsc(str) {
|
|
558
|
-
return str.replace(REGEXPESC, "\\$&");
|
|
559
|
-
}
|
|
560
|
-
__name(regExpEsc, "regExpEsc");
|
|
561
|
-
__name2(regExpEsc, "regExpEsc");
|
|
562
|
-
function roundNumber(num, scale = 0) {
|
|
563
|
-
if (!num.toString().includes("e")) {
|
|
564
|
-
return Number(`${Math.round(Number(`${num}e+${scale}`))}e-${scale}`);
|
|
565
|
-
}
|
|
566
|
-
const arr = `${num}`.split("e");
|
|
567
|
-
let sig = "";
|
|
568
|
-
if (Number(arr[1]) + scale > 0) {
|
|
569
|
-
sig = "+";
|
|
570
|
-
}
|
|
571
|
-
return Number(`${Math.round(Number(`${Number(arr[0])}e${sig}${Number(arr[1]) + scale}`))}e-${scale}`);
|
|
572
|
-
}
|
|
573
|
-
__name(roundNumber, "roundNumber");
|
|
574
|
-
__name2(roundNumber, "roundNumber");
|
|
575
|
-
var TO_TITLE_CASE = /[A-Za-zÀ-ÖØ-öø-ÿ]\S*/g;
|
|
576
|
-
var baseVariants = {
|
|
577
|
-
textchannel: "TextChannel",
|
|
578
|
-
voicechannel: "VoiceChannel",
|
|
579
|
-
categorychannel: "CategoryChannel",
|
|
580
|
-
guildmember: "GuildMember"
|
|
581
|
-
};
|
|
582
|
-
function toTitleCase(str, options = {}) {
|
|
583
|
-
const { additionalVariants = {}, caseSensitive } = options;
|
|
584
|
-
const titleCaseVariants = {
|
|
585
|
-
...baseVariants,
|
|
586
|
-
...caseSensitive ? additionalVariants : Object.entries(additionalVariants).reduce((variants, [key, variant]) => ({ ...variants, [key.toLowerCase()]: variant }), {})
|
|
587
|
-
};
|
|
588
|
-
return str.replace(TO_TITLE_CASE, (txt) => {
|
|
589
|
-
var _a;
|
|
590
|
-
return (_a = titleCaseVariants[caseSensitive ? txt : txt.toLowerCase()]) != null ? _a : txt.charAt(0).toUpperCase() + txt.substring(1).toLowerCase();
|
|
591
|
-
});
|
|
592
|
-
}
|
|
593
|
-
__name(toTitleCase, "toTitleCase");
|
|
594
|
-
__name2(toTitleCase, "toTitleCase");
|
|
595
|
-
function tryParse(value) {
|
|
596
|
-
try {
|
|
597
|
-
return JSON.parse(value);
|
|
598
|
-
} catch (err) {
|
|
599
|
-
return value;
|
|
600
|
-
}
|
|
601
|
-
}
|
|
602
|
-
__name(tryParse, "tryParse");
|
|
603
|
-
__name2(tryParse, "tryParse");
|
|
604
162
|
|
|
605
163
|
// src/lib/Cron.ts
|
|
606
164
|
var Cron = class {
|
|
@@ -682,7 +240,6 @@ ${expression || zws}\`\`\``;
|
|
|
682
240
|
return range(min, max, parseInt(step, 10) || 1);
|
|
683
241
|
}
|
|
684
242
|
};
|
|
685
|
-
__name(Cron, "Cron");
|
|
686
243
|
|
|
687
244
|
// src/lib/Duration.ts
|
|
688
245
|
var tokens2 = /* @__PURE__ */ new Map([
|
|
@@ -751,7 +308,6 @@ ${expression || zws}\`\`\``;
|
|
|
751
308
|
}
|
|
752
309
|
};
|
|
753
310
|
var Duration = _Duration;
|
|
754
|
-
__name(Duration, "Duration");
|
|
755
311
|
__publicField(Duration, "kPatternRegex", /(-?\d*\.?\d+(?:e[-+]?\d+)?)\s*([a-zμ]*)/gi);
|
|
756
312
|
__publicField(Duration, "kCommaRegex", /,/g);
|
|
757
313
|
__publicField(Duration, "kAanRegex", /\ban?\b/gi);
|
|
@@ -791,13 +347,11 @@ ${expression || zws}\`\`\``;
|
|
|
791
347
|
return `${negative ? "-" : ""}${output.join(rightSeparator) || addUnit(0, this.units.second, leftSeparator)}`;
|
|
792
348
|
}
|
|
793
349
|
};
|
|
794
|
-
__name(DurationFormatter, "DurationFormatter");
|
|
795
350
|
function addUnit(time, unit, separator) {
|
|
796
351
|
if (Reflect.has(unit, time))
|
|
797
352
|
return `${time}${separator}${Reflect.get(unit, time)}`;
|
|
798
353
|
return `${time}${separator}${unit.DEFAULT}`;
|
|
799
354
|
}
|
|
800
|
-
__name(addUnit, "addUnit");
|
|
801
355
|
|
|
802
356
|
// src/lib/TimerManager.ts
|
|
803
357
|
var TimerManager = class extends null {
|
|
@@ -831,7 +385,6 @@ ${expression || zws}\`\`\``;
|
|
|
831
385
|
this.storedIntervals.clear();
|
|
832
386
|
}
|
|
833
387
|
};
|
|
834
|
-
__name(TimerManager, "TimerManager");
|
|
835
388
|
__publicField(TimerManager, "storedTimeouts", /* @__PURE__ */ new Set());
|
|
836
389
|
__publicField(TimerManager, "storedIntervals", /* @__PURE__ */ new Set());
|
|
837
390
|
|
|
@@ -992,7 +545,6 @@ ${expression || zws}\`\`\``;
|
|
|
992
545
|
return time instanceof Date ? time : new Date(time);
|
|
993
546
|
}
|
|
994
547
|
};
|
|
995
|
-
__name(Timestamp, "Timestamp");
|
|
996
548
|
return __toCommonJS(src_exports);
|
|
997
549
|
})();
|
|
998
550
|
/**
|