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