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