@h3ravel/support 0.10.3 → 0.11.0
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/chunk-PECeCxCb.js +15 -0
- package/dist/index.cjs +952 -80
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +397 -58
- package/dist/index.d.ts +394 -58
- package/dist/index.js +884 -81
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -24,8 +24,9 @@ type TGeneric<V = any, K extends string = string> = Record<K, V>;
|
|
|
24
24
|
type XGeneric<V = TGeneric, T = any> = {
|
|
25
25
|
[key: string]: T;
|
|
26
26
|
} & V;
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
declare namespace Arr_d_exports {
|
|
28
|
+
export { alternate, chunk, collapse, combine, find, first, flatten, forget, isEmpty, isNotEmpty, last, pop, prepend, range, reverse, shift, take };
|
|
29
|
+
}
|
|
29
30
|
/**
|
|
30
31
|
* Splits an array into chunks of a specified size.
|
|
31
32
|
*
|
|
@@ -35,6 +36,40 @@ type XGeneric<V = TGeneric, T = any> = {
|
|
|
35
36
|
* @returns An array of chunks (arrays)
|
|
36
37
|
*/
|
|
37
38
|
declare const chunk: <T>(arr: T[], size?: number) => T[][];
|
|
39
|
+
/**
|
|
40
|
+
* Collapse an array of arrays into a single array.
|
|
41
|
+
*/
|
|
42
|
+
declare const collapse: <T>(arr: (T | T[])[]) => T[];
|
|
43
|
+
/**
|
|
44
|
+
* Alternates between two arrays, creating a zipped result.
|
|
45
|
+
*/
|
|
46
|
+
declare const alternate: <T>(a: T[], b: T[]) => T[];
|
|
47
|
+
/**
|
|
48
|
+
* Combine arrays and sum their values element by element.
|
|
49
|
+
*/
|
|
50
|
+
declare const combine: (...arr: number[][]) => number[];
|
|
51
|
+
/** Find the value associated with a given key. */
|
|
52
|
+
declare const find: <T>(key: T, arr: T[]) => T | null;
|
|
53
|
+
/** Returns a new array without the given indices. */
|
|
54
|
+
declare const forget: <T>(arr: T[], keys: number[]) => T[];
|
|
55
|
+
/** Remove the first element and return tuple [el, rest]. */
|
|
56
|
+
declare const first: <T>(arr: T[]) => [T, T[]];
|
|
57
|
+
/** Remove the last element and return tuple [el, rest]. */
|
|
58
|
+
declare const last: <T>(arr: T[]) => [T, T[]];
|
|
59
|
+
/** Check if array is empty. */
|
|
60
|
+
declare const isEmpty: <T>(arr: T[]) => boolean;
|
|
61
|
+
/** Check if array is empty. */
|
|
62
|
+
declare const isNotEmpty: <T>(arr: T[]) => boolean;
|
|
63
|
+
/** Pop the element off the end of array. */
|
|
64
|
+
declare const pop: <T>(arr: T[]) => T[];
|
|
65
|
+
/** Add elements to the beginning of array. */
|
|
66
|
+
declare const prepend: <T>(arr: T[], ...elements: T[]) => T[];
|
|
67
|
+
/** Take first n elements of array. */
|
|
68
|
+
declare const take: <T>(amount: number, arr: T[]) => T[];
|
|
69
|
+
/** Create a new array in reverse order. */
|
|
70
|
+
declare const reverse: <T>(arr: T[]) => T[];
|
|
71
|
+
/** Alias for first element removal. */
|
|
72
|
+
declare const shift: <T>(arr: T[]) => [T, T[]];
|
|
38
73
|
/**
|
|
39
74
|
* Generates an array of sequential numbers.
|
|
40
75
|
*
|
|
@@ -43,22 +78,126 @@ declare const chunk: <T>(arr: T[], size?: number) => T[][];
|
|
|
43
78
|
* @returns An array of numbers from startAt to startAt + size - 1
|
|
44
79
|
*/
|
|
45
80
|
declare const range: (size: number, startAt?: number) => number[];
|
|
46
|
-
|
|
47
|
-
|
|
81
|
+
/** Flatten multi-dimensional arrays into single level. */
|
|
82
|
+
declare const flatten: <T>(arr: T[]) => T[];
|
|
83
|
+
declare namespace Crypto_d_exports {
|
|
84
|
+
export { PasswordOptions, base64Decode, base64Encode, caesarCipher, checksum, hash, hmac, random, randomColor, randomPassword, randomSecure, secureToken, uuid, verifyChecksum, xor };
|
|
85
|
+
}
|
|
48
86
|
/**
|
|
49
|
-
*
|
|
87
|
+
* Generate a random UUID string.
|
|
50
88
|
*
|
|
51
|
-
* @
|
|
89
|
+
* @returns A random UUID string
|
|
52
90
|
*/
|
|
53
|
-
declare const
|
|
91
|
+
declare const uuid: () => string;
|
|
54
92
|
/**
|
|
55
|
-
*
|
|
93
|
+
* Generate a random string of specified length.
|
|
56
94
|
*
|
|
57
|
-
* @param
|
|
95
|
+
* @param length - Length of the random string (default: 16)
|
|
96
|
+
* @param charset - Character set to use (default: alphanumeric)
|
|
97
|
+
* @returns A random string
|
|
58
98
|
*/
|
|
59
|
-
declare const
|
|
60
|
-
|
|
61
|
-
|
|
99
|
+
declare const random: (length?: number, charset?: string) => string;
|
|
100
|
+
/**
|
|
101
|
+
* Secure random string generator that uses crypto.randomBytes.
|
|
102
|
+
*
|
|
103
|
+
* @param length - Length of the random string (default: 32)
|
|
104
|
+
* @returns A cryptographically secure random string
|
|
105
|
+
*/
|
|
106
|
+
declare const randomSecure: (length?: number) => string;
|
|
107
|
+
/**
|
|
108
|
+
* Hash a string using the specified algorithm.
|
|
109
|
+
*
|
|
110
|
+
* @param data - Data to hash
|
|
111
|
+
* @param algorithm - Hash algorithm (default: 'sha256')
|
|
112
|
+
* @returns Hexadecimal hash string
|
|
113
|
+
*/
|
|
114
|
+
declare const hash: (data: string, algorithm?: string) => string;
|
|
115
|
+
/**
|
|
116
|
+
* Hash a string with salt using HMAC.
|
|
117
|
+
*
|
|
118
|
+
* @param data - Data to hash
|
|
119
|
+
* @param key - Secret key for HMAC
|
|
120
|
+
* @param algorithm - Hash algorithm (default: 'sha256')
|
|
121
|
+
* @returns Hexadecimal hash string
|
|
122
|
+
*/
|
|
123
|
+
declare const hmac: (data: string, key: string, algorithm?: string) => string;
|
|
124
|
+
/**
|
|
125
|
+
* Encode data to base64.
|
|
126
|
+
*
|
|
127
|
+
* @param data - Data to encode
|
|
128
|
+
* @returns Base64 encoded string
|
|
129
|
+
*/
|
|
130
|
+
declare const base64Encode: (data: string) => string;
|
|
131
|
+
/**
|
|
132
|
+
* Decode base64 data.
|
|
133
|
+
*
|
|
134
|
+
* @param data - Base64 string to decode
|
|
135
|
+
* @returns Decoded string
|
|
136
|
+
*/
|
|
137
|
+
declare const base64Decode: (data: string) => string;
|
|
138
|
+
/**
|
|
139
|
+
* Simple XOR encryption/decryption.
|
|
140
|
+
*
|
|
141
|
+
* @param data - Data to encrypt/decrypt
|
|
142
|
+
* @param key - Encryption key
|
|
143
|
+
* @returns Encrypted/decrypted string
|
|
144
|
+
*/
|
|
145
|
+
declare const xor: (data: string, key: string) => string;
|
|
146
|
+
/**
|
|
147
|
+
* Generate a random hex color code.
|
|
148
|
+
*
|
|
149
|
+
* @returns A hex color code string (e.g., '#a3b2f3')
|
|
150
|
+
*/
|
|
151
|
+
declare const randomColor: () => string;
|
|
152
|
+
/**
|
|
153
|
+
* Generate a secure password using configurable parameters.
|
|
154
|
+
*
|
|
155
|
+
* @param length - Password length (default: 16)
|
|
156
|
+
* @param options - Character options
|
|
157
|
+
* @returns A secure password string
|
|
158
|
+
*/
|
|
159
|
+
interface PasswordOptions {
|
|
160
|
+
useUppercase?: boolean;
|
|
161
|
+
useLowercase?: boolean;
|
|
162
|
+
useNumbers?: boolean;
|
|
163
|
+
useSymbols?: boolean;
|
|
164
|
+
}
|
|
165
|
+
declare const randomPassword: (length?: number, options?: PasswordOptions) => string;
|
|
166
|
+
/**
|
|
167
|
+
* Generate a cryptographically secure token for APIs, sessions, etc.
|
|
168
|
+
*
|
|
169
|
+
* @param strength - Token strength (bytes) (default: 32)
|
|
170
|
+
* @returns A secure token string
|
|
171
|
+
*/
|
|
172
|
+
declare const secureToken: (strength?: number) => string;
|
|
173
|
+
/**
|
|
174
|
+
* Create a checksum for data integrity verification.
|
|
175
|
+
*
|
|
176
|
+
* @param data - Data to create checksum for
|
|
177
|
+
* @param algorithm - Hash algorithm (default: 'sha256')
|
|
178
|
+
* @returns SHA256 checksum
|
|
179
|
+
*/
|
|
180
|
+
declare const checksum: (data: string, algorithm?: string) => string;
|
|
181
|
+
/**
|
|
182
|
+
* Verify data integrity using checksum.
|
|
183
|
+
*
|
|
184
|
+
* @param data - Data to verify
|
|
185
|
+
* @param expectedChecksum - Expected checksum
|
|
186
|
+
* @param algorithm - Hash algorithm (default: 'sha256')
|
|
187
|
+
* @returns True if checksums match
|
|
188
|
+
*/
|
|
189
|
+
declare const verifyChecksum: (data: string, expectedChecksum: string, algorithm?: string) => boolean;
|
|
190
|
+
/**
|
|
191
|
+
* Simple Caesar cipher implementation.
|
|
192
|
+
*
|
|
193
|
+
* @param text - Text to encrypt/decrypt
|
|
194
|
+
* @param shift - Number of positions to shift (default: 13)
|
|
195
|
+
* @returns Encrypted/decrypted text
|
|
196
|
+
*/
|
|
197
|
+
declare const caesarCipher: (text: string, shift?: number) => string;
|
|
198
|
+
declare namespace Number_d_exports {
|
|
199
|
+
export { abbreviate, humanize, toBytes, toHumanTime };
|
|
200
|
+
}
|
|
62
201
|
/**
|
|
63
202
|
* Abbreviates large numbers using SI symbols (K, M, B...)
|
|
64
203
|
* and formats the output according to the given locale.
|
|
@@ -95,8 +234,9 @@ declare const toBytes: (bytes?: number, decimals?: number, bits?: boolean) => st
|
|
|
95
234
|
* @returns A formatted time string
|
|
96
235
|
*/
|
|
97
236
|
declare const toHumanTime: (seconds?: number, worded?: boolean) => string;
|
|
98
|
-
|
|
99
|
-
|
|
237
|
+
declare namespace Obj_d_exports {
|
|
238
|
+
export { dot, extractProperties, getValue, modObj, safeDot, setNested, slugifyKeys };
|
|
239
|
+
}
|
|
100
240
|
/**
|
|
101
241
|
* Flattens a nested object into a single-level object
|
|
102
242
|
* with dot-separated keys.
|
|
@@ -175,8 +315,9 @@ declare const setNested: (obj: Record<string, any>, key: string, value: any) =>
|
|
|
175
315
|
* @returns A new object with slugified keys
|
|
176
316
|
*/
|
|
177
317
|
declare const slugifyKeys: <T extends object>(obj: T, only?: string[], separator?: string) => KeysToSnakeCase<T>;
|
|
178
|
-
|
|
179
|
-
|
|
318
|
+
declare namespace Str_d_exports {
|
|
319
|
+
export { after, afterLast, before, beforeLast, capitalize, chop, esc, firstLines, isInteger, isNumber, lastLines, padString, pluralize, replacePunctuation, rot, singularize, slugify, split, ss, sub, subString, substitute, substr, translate, truncate };
|
|
320
|
+
}
|
|
180
321
|
/**
|
|
181
322
|
* Get the portion of the string after the first occurrence of the given value.
|
|
182
323
|
*
|
|
@@ -209,69 +350,264 @@ declare const before: (value: string, search: string) => string;
|
|
|
209
350
|
* @returns
|
|
210
351
|
*/
|
|
211
352
|
declare const beforeLast: (value: string, search: string) => string;
|
|
353
|
+
/** Capitalizes the first character of a string. */
|
|
354
|
+
declare function capitalize(str: string): string;
|
|
355
|
+
/**
|
|
356
|
+
* Returns the pluralized form of a word based on the given number.
|
|
357
|
+
*/
|
|
358
|
+
declare const pluralize: (word: string, count: number) => string;
|
|
359
|
+
/** Converts a plural English word into its singular form. */
|
|
360
|
+
declare const singularize: (word: string) => string;
|
|
361
|
+
/** Converts a string into a slug format. */
|
|
362
|
+
declare const slugify: (str: string, joiner?: string) => string;
|
|
363
|
+
/** Truncates a string to a specified length and appends an ellipsis if needed. */
|
|
364
|
+
declare const subString: (str: string, len: number, ellipsis?: string) => string;
|
|
365
|
+
/** Substitute placeholders { key } using object with dot notation. */
|
|
366
|
+
declare const substitute: (str: string, data?: Record<string, unknown>, def?: string) => string | undefined;
|
|
367
|
+
/** Truncate string removing HTML tags and append suffix if needed. */
|
|
368
|
+
declare const truncate: (str: string, len?: number, suffix?: string) => string;
|
|
369
|
+
/** Get substring from offset/length similar to PHP substr. */
|
|
370
|
+
declare const substr: (string: string, offset: number, length?: number) => string;
|
|
371
|
+
/** Get substring by start/stop indexes. */
|
|
372
|
+
declare const sub: (string: string, start: number, stop: number) => string;
|
|
373
|
+
/** Escape string for JSON encoding (returns string without quotes). */
|
|
374
|
+
declare const esc: (string: string) => string;
|
|
375
|
+
/** Padding to a fixed size, right by default. */
|
|
376
|
+
declare const padString: (string: string, size: number, padString?: string, padRight?: boolean) => string;
|
|
377
|
+
/** Split by delimiter with edge-case rule. */
|
|
378
|
+
declare const split: (string: string, delimiter: string) => string[];
|
|
379
|
+
/** Returns all the characters except the last. */
|
|
380
|
+
declare const chop: (string: string) => string;
|
|
381
|
+
/** Number checks. */
|
|
382
|
+
declare const isNumber: (string: string) => boolean;
|
|
383
|
+
declare const isInteger: (string: string) => boolean;
|
|
384
|
+
/** ROT-N cipher. */
|
|
385
|
+
declare const rot: (string: string, n?: number) => string;
|
|
386
|
+
/** Replace trailing punctuation with new format. */
|
|
387
|
+
declare const replacePunctuation: (string: string, newFormat: string) => string;
|
|
388
|
+
/** Array/object driven text replacement. */
|
|
389
|
+
declare const translate: (string: string, replacements: Record<string, string> | Array<[string, string]>) => string;
|
|
390
|
+
/** Strip slashes recursively. */
|
|
391
|
+
declare const ss: (string: string) => string;
|
|
392
|
+
/** First and last N lines. */
|
|
393
|
+
declare const firstLines: (string: string, amount?: number) => string;
|
|
394
|
+
declare const lastLines: (string: string, amount?: number) => string;
|
|
395
|
+
declare namespace Time_d_exports {
|
|
396
|
+
export { TimeFormat, TimeUnit, add, dayOfYear, diff, end, firstDayOfMonth, format, fromNow, fromTimestamp, isBetween, isLeapYear, lastDayOfMonth, now, randomTime, start, subtract, unix };
|
|
397
|
+
}
|
|
398
|
+
type TimeFormat = 'Y-m-d' | 'Y-m-d H:i:s' | 'd-m-Y' | 'd/m/Y' | 'M j, Y' | 'F j, Y' | 'D j M' | 'timestamp' | 'unix';
|
|
399
|
+
type TimeUnit = 'milliseconds' | 'seconds' | 'minutes' | 'hours' | 'days';
|
|
212
400
|
/**
|
|
213
|
-
*
|
|
401
|
+
* Get current timestamp in milliseconds.
|
|
214
402
|
*
|
|
215
|
-
* @
|
|
216
|
-
* @returns The string with the first character capitalized
|
|
403
|
+
* @returns Current timestamp as number
|
|
217
404
|
*/
|
|
218
|
-
declare
|
|
405
|
+
declare const now: () => number;
|
|
219
406
|
/**
|
|
220
|
-
*
|
|
407
|
+
* Get current Unix timestamp.
|
|
221
408
|
*
|
|
222
|
-
* @
|
|
223
|
-
* @param count - The number determining pluralization
|
|
224
|
-
* @returns Singular if count === 1, otherwise plural form
|
|
409
|
+
* @returns Current Unix timestamp
|
|
225
410
|
*/
|
|
226
|
-
declare const
|
|
411
|
+
declare const unix: () => number;
|
|
227
412
|
/**
|
|
228
|
-
*
|
|
413
|
+
* Format a date string according to a specified format (UTC-based for determinism).
|
|
229
414
|
*
|
|
230
|
-
* @param
|
|
231
|
-
* @
|
|
415
|
+
* @param date - Date string or Date object
|
|
416
|
+
* @param format - Format to output (default: 'Y-m-d H:i:s')
|
|
417
|
+
* @returns Formatted date string
|
|
232
418
|
*/
|
|
233
|
-
declare const
|
|
419
|
+
declare const format: (date: string | Date, format?: TimeFormat) => string;
|
|
234
420
|
/**
|
|
235
|
-
*
|
|
236
|
-
* Handles camelCase, spaces, and non-alphanumeric characters.
|
|
421
|
+
* Create a date for a given timestamp.
|
|
237
422
|
*
|
|
238
|
-
* @param
|
|
239
|
-
* @
|
|
240
|
-
* @returns A slugified string
|
|
423
|
+
* @param timestamp - Unix timestamp
|
|
424
|
+
* @returns Date object
|
|
241
425
|
*/
|
|
242
|
-
declare const
|
|
426
|
+
declare const fromTimestamp: (timestamp: number) => Date;
|
|
243
427
|
/**
|
|
244
|
-
*
|
|
428
|
+
* Return the difference for given date in seconds.
|
|
245
429
|
*
|
|
246
|
-
* @param
|
|
247
|
-
* @param
|
|
248
|
-
* @
|
|
249
|
-
* @returns The truncated string
|
|
430
|
+
* @param date - Date to compare
|
|
431
|
+
* @param referenceDate - Reference date (optional, defaults to now)
|
|
432
|
+
* @returns Number of seconds difference
|
|
250
433
|
*/
|
|
251
|
-
declare const
|
|
434
|
+
declare const diff: (date: string | Date, referenceDate?: string | Date) => number;
|
|
435
|
+
/**
|
|
436
|
+
* Subtract time from the given date.
|
|
437
|
+
*/
|
|
438
|
+
declare const subtract: (date: string | Date, amount?: number, unit?: TimeUnit) => Date;
|
|
439
|
+
/**
|
|
440
|
+
* Add time to the given date.
|
|
441
|
+
*/
|
|
442
|
+
declare const add: (date: string | Date, amount?: number, unit?: TimeUnit) => Date;
|
|
443
|
+
/**
|
|
444
|
+
* Start time of a specific unit.
|
|
445
|
+
*/
|
|
446
|
+
declare const start: (date: string | Date, unit?: TimeUnit) => Date;
|
|
447
|
+
/**
|
|
448
|
+
* End time of a specific unit.
|
|
449
|
+
*/
|
|
450
|
+
declare const end: (date: string | Date, unit?: TimeUnit) => Date;
|
|
451
|
+
/**
|
|
452
|
+
* Get the difference in days from today.
|
|
453
|
+
*/
|
|
454
|
+
declare const fromNow: (date: string | Date) => number;
|
|
252
455
|
/**
|
|
253
|
-
*
|
|
456
|
+
* Get a random time between the specified hour and minute.
|
|
457
|
+
*/
|
|
458
|
+
declare const randomTime: (startHour?: number, startMinute?: number, endHour?: number, endMinute?: number) => Date;
|
|
459
|
+
/**
|
|
460
|
+
* Check if the current time is between the specified durations.
|
|
461
|
+
*/
|
|
462
|
+
declare const isBetween: (startTime: string, endTime: string) => boolean;
|
|
463
|
+
/** Day of year, first/last day of month, leap year checks. */
|
|
464
|
+
declare const dayOfYear: (date?: string | Date) => number;
|
|
465
|
+
declare const firstDayOfMonth: (date?: string | Date) => Date;
|
|
466
|
+
declare const lastDayOfMonth: (date?: string | Date) => Date;
|
|
467
|
+
declare const isLeapYear: (year?: number) => boolean;
|
|
468
|
+
//#endregion
|
|
469
|
+
//#region src/Helpers/DumpDie.d.ts
|
|
470
|
+
/**
|
|
471
|
+
* Dump something and kill the process for quick debugging. Based on Laravel's dd()
|
|
254
472
|
*
|
|
255
|
-
*
|
|
256
|
-
|
|
257
|
-
|
|
473
|
+
* @param args
|
|
474
|
+
*/
|
|
475
|
+
declare const dd: (...args: unknown[]) => never;
|
|
476
|
+
/**
|
|
477
|
+
* Dump something but keep the process for quick debugging. Based on Laravel's dump()
|
|
258
478
|
*
|
|
259
|
-
* @param
|
|
260
|
-
* @param data - Object containing values to substitute. Supports nested keys via dot notation.
|
|
261
|
-
* @param def - Default value to use if a key is missing. (Optional)
|
|
262
|
-
* @returns The substituted string or undefined if the input string or data is invalid.
|
|
479
|
+
* @param args
|
|
263
480
|
*/
|
|
264
|
-
declare const
|
|
481
|
+
declare const dump: (...args: unknown[]) => void;
|
|
482
|
+
//#endregion
|
|
483
|
+
//#region src/GlobalBootstrap.d.ts
|
|
265
484
|
/**
|
|
266
|
-
*
|
|
267
|
-
*
|
|
485
|
+
* Global helpers interface that mirrors Laravel's helpers
|
|
486
|
+
* and provides convenient access to all utility functions
|
|
487
|
+
*/
|
|
488
|
+
interface GlobalHelpers {
|
|
489
|
+
Arr: typeof Arr_d_exports;
|
|
490
|
+
chunk: typeof chunk;
|
|
491
|
+
collapse: typeof collapse;
|
|
492
|
+
alternate: typeof alternate;
|
|
493
|
+
combine: typeof combine;
|
|
494
|
+
find: typeof find;
|
|
495
|
+
forget: typeof forget;
|
|
496
|
+
first: typeof first;
|
|
497
|
+
last: typeof last;
|
|
498
|
+
isEmpty: typeof isEmpty;
|
|
499
|
+
isNotEmpty: typeof isNotEmpty;
|
|
500
|
+
pop: typeof pop;
|
|
501
|
+
prepend: typeof prepend;
|
|
502
|
+
take: typeof take;
|
|
503
|
+
reverse: typeof reverse;
|
|
504
|
+
shift: typeof shift;
|
|
505
|
+
range: typeof range;
|
|
506
|
+
flatten: typeof flatten;
|
|
507
|
+
Str: typeof Str_d_exports;
|
|
508
|
+
after: typeof after;
|
|
509
|
+
afterLast: typeof afterLast;
|
|
510
|
+
before: typeof before;
|
|
511
|
+
beforeLast: typeof beforeLast;
|
|
512
|
+
capitalize: typeof capitalize;
|
|
513
|
+
pluralize: typeof pluralize;
|
|
514
|
+
singularize: typeof singularize;
|
|
515
|
+
slugify: typeof slugify;
|
|
516
|
+
subString: typeof subString;
|
|
517
|
+
substitute: typeof substitute;
|
|
518
|
+
truncate: typeof truncate;
|
|
519
|
+
substr: typeof substr;
|
|
520
|
+
sub: typeof sub;
|
|
521
|
+
esc: typeof esc;
|
|
522
|
+
padString: typeof padString;
|
|
523
|
+
split: typeof split;
|
|
524
|
+
chop: typeof chop;
|
|
525
|
+
isNumber: typeof isNumber;
|
|
526
|
+
isInteger: typeof isInteger;
|
|
527
|
+
rot: typeof rot;
|
|
528
|
+
replacePunctuation: typeof replacePunctuation;
|
|
529
|
+
translate: typeof translate;
|
|
530
|
+
ss: typeof ss;
|
|
531
|
+
firstLines: typeof firstLines;
|
|
532
|
+
lastLines: typeof lastLines;
|
|
533
|
+
Obj: typeof Obj_d_exports;
|
|
534
|
+
dot: typeof dot;
|
|
535
|
+
extractProperties: typeof extractProperties;
|
|
536
|
+
getValue: typeof getValue;
|
|
537
|
+
modObj: typeof modObj;
|
|
538
|
+
safeDot: typeof safeDot;
|
|
539
|
+
setNested: typeof setNested;
|
|
540
|
+
slugifyKeys: typeof slugifyKeys;
|
|
541
|
+
Crypto: typeof Crypto_d_exports;
|
|
542
|
+
uuid: typeof uuid;
|
|
543
|
+
random: typeof random;
|
|
544
|
+
randomSecure: typeof randomSecure;
|
|
545
|
+
hash: typeof hash;
|
|
546
|
+
hmac: typeof hmac;
|
|
547
|
+
base64Encode: typeof base64Encode;
|
|
548
|
+
base64Decode: typeof base64Decode;
|
|
549
|
+
xor: typeof xor;
|
|
550
|
+
randomColor: typeof randomColor;
|
|
551
|
+
randomPassword: typeof randomPassword;
|
|
552
|
+
secureToken: typeof secureToken;
|
|
553
|
+
checksum: typeof checksum;
|
|
554
|
+
verifyChecksum: typeof verifyChecksum;
|
|
555
|
+
caesarCipher: typeof caesarCipher;
|
|
556
|
+
Time: typeof Time_d_exports;
|
|
557
|
+
now: typeof now;
|
|
558
|
+
unix: typeof unix;
|
|
559
|
+
format: typeof format;
|
|
560
|
+
fromTimestamp: typeof fromTimestamp;
|
|
561
|
+
diff: typeof diff;
|
|
562
|
+
subtract: typeof subtract;
|
|
563
|
+
add: typeof add;
|
|
564
|
+
start: typeof start;
|
|
565
|
+
end: typeof end;
|
|
566
|
+
fromNow: typeof fromNow;
|
|
567
|
+
randomTime: typeof randomTime;
|
|
568
|
+
isBetween: typeof isBetween;
|
|
569
|
+
dayOfYear: typeof dayOfYear;
|
|
570
|
+
firstDayOfMonth: typeof firstDayOfMonth;
|
|
571
|
+
lastDayOfMonth: typeof lastDayOfMonth;
|
|
572
|
+
isLeapYear: typeof isLeapYear;
|
|
573
|
+
Number: typeof Number_d_exports;
|
|
574
|
+
abbreviate: typeof abbreviate;
|
|
575
|
+
humanize: typeof humanize;
|
|
576
|
+
toBytes: typeof toBytes;
|
|
577
|
+
toHumanTime: typeof toHumanTime;
|
|
578
|
+
dump: typeof dump;
|
|
579
|
+
dd: typeof dd;
|
|
580
|
+
}
|
|
581
|
+
/**
|
|
582
|
+
* Bootstrap the global helpers into the global scope.
|
|
583
|
+
* This enables optional global access to all helper functions.
|
|
584
|
+
*
|
|
585
|
+
* Example usage:
|
|
586
|
+
* ```typescript
|
|
587
|
+
* import { bootstrap } from '@h3ravel/support'
|
|
268
588
|
*
|
|
269
|
-
*
|
|
270
|
-
*
|
|
271
|
-
*
|
|
272
|
-
*
|
|
589
|
+
* // Make helpers globally available
|
|
590
|
+
* bootstrap()
|
|
591
|
+
*
|
|
592
|
+
* // Now you can use:
|
|
593
|
+
* Arr.chunk([1, 2, 3, 4], 2)
|
|
594
|
+
* // or directly:
|
|
595
|
+
* chunk([1, 2, 3, 4], 2)
|
|
596
|
+
* Str.capitalize('hello world')
|
|
597
|
+
* // or directly:
|
|
598
|
+
* capitalize('hello world')
|
|
599
|
+
* ```
|
|
600
|
+
*
|
|
601
|
+
* @param target - The target object to attach helpers to (default: globalThis)
|
|
273
602
|
*/
|
|
274
|
-
declare
|
|
603
|
+
declare function bootstrap(target?: any): void;
|
|
604
|
+
/**
|
|
605
|
+
* Clean up global helpers by removing them from the global scope.
|
|
606
|
+
* This function removes all global helper attachments.
|
|
607
|
+
*
|
|
608
|
+
* @param target - The target object to clean up (default: globalThis)
|
|
609
|
+
*/
|
|
610
|
+
declare function cleanBootstrap(target?: any): void;
|
|
275
611
|
//#endregion
|
|
276
|
-
export { CamelToSnakeCase, KeysToSnakeCase, SnakeToCamelCase, SnakeToTitleCase, TGeneric, XGeneric, abbreviate, after, afterLast, before, beforeLast, capitalize, chunk, dd, dot, dump, extractProperties, getValue, humanize, modObj, pluralize, range, safeDot, setNested, singularize, slugify, slugifyKeys, subString, substitute, toBytes, toHumanTime, truncate };
|
|
612
|
+
export { CamelToSnakeCase, GlobalHelpers, KeysToSnakeCase, PasswordOptions, SnakeToCamelCase, SnakeToTitleCase, TGeneric, TimeFormat, TimeUnit, XGeneric, abbreviate, add, after, afterLast, alternate, base64Decode, base64Encode, before, beforeLast, bootstrap, caesarCipher, capitalize, checksum, chop, chunk, cleanBootstrap, collapse, combine, dayOfYear, dd, diff, dot, dump, end, esc, extractProperties, find, first, firstDayOfMonth, firstLines, flatten, forget, format, fromNow, fromTimestamp, getValue, hash, hmac, humanize, isBetween, isEmpty, isInteger, isLeapYear, isNotEmpty, isNumber, last, lastDayOfMonth, lastLines, modObj, now, padString, pluralize, pop, prepend, random, randomColor, randomPassword, randomSecure, randomTime, range, replacePunctuation, reverse, rot, safeDot, secureToken, setNested, shift, singularize, slugify, slugifyKeys, split, ss, start, sub, subString, substitute, substr, subtract, take, toBytes, toHumanTime, translate, truncate, unix, uuid, verifyChecksum, xor };
|
|
277
613
|
//# sourceMappingURL=index.d.ts.map
|