@md-oss/common 0.1.5 → 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/arrays-6DA6GfsQ.mjs +2 -0
- package/dist/arrays-6DA6GfsQ.mjs.map +1 -0
- package/dist/arrays-DvPJ1GeR.d.cts +163 -0
- package/dist/arrays-DvPJ1GeR.d.mts +163 -0
- package/dist/arrays-bgbansWs.cjs +2 -0
- package/dist/arrays-bgbansWs.cjs.map +1 -0
- package/dist/constants/bytes.cjs +1 -1
- package/dist/constants/bytes.cjs.map +1 -1
- package/dist/constants/bytes.d.cts +31 -1
- package/dist/constants/bytes.d.mts +31 -1
- package/dist/constants/bytes.mjs +1 -1
- package/dist/constants/bytes.mjs.map +1 -1
- package/dist/files-DzKYei0a.mjs +2 -0
- package/dist/files-DzKYei0a.mjs.map +1 -0
- package/dist/files-m1nnj5gT.cjs +2 -0
- package/dist/files-m1nnj5gT.cjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +10 -8
- package/dist/index.d.mts +10 -8
- package/dist/index.mjs +1 -1
- package/dist/mime-types-BmvBrrZ7.cjs.map +1 -1
- package/dist/mime-types-D_K53zgk.mjs.map +1 -1
- package/dist/{mime-types-Bjt4NvnE.d.cts → mime-types-Dajfhq2c.d.cts} +58 -1
- package/dist/{mime-types-Bjt4NvnE.d.mts → mime-types-Dajfhq2c.d.mts} +58 -1
- package/dist/numbers-B_mptknO.cjs +2 -0
- package/dist/numbers-B_mptknO.cjs.map +1 -0
- package/dist/numbers-C2680fmA.d.cts +184 -0
- package/dist/numbers-C2680fmA.d.mts +184 -0
- package/dist/numbers-lJ6gwIpk.mjs +2 -0
- package/dist/numbers-lJ6gwIpk.mjs.map +1 -0
- package/dist/objects-VXf3mqE5.mjs +2 -0
- package/dist/objects-VXf3mqE5.mjs.map +1 -0
- package/dist/objects-fiFExjsf.d.cts +116 -0
- package/dist/objects-fiFExjsf.d.mts +116 -0
- package/dist/objects-wcO6hNA8.cjs +2 -0
- package/dist/objects-wcO6hNA8.cjs.map +1 -0
- package/dist/random-668tofPV.cjs +2 -0
- package/dist/random-668tofPV.cjs.map +1 -0
- package/dist/random-BqJDZAPb.d.cts +131 -0
- package/dist/random-BqJDZAPb.d.mts +131 -0
- package/dist/random-ihslkInn.mjs +2 -0
- package/dist/random-ihslkInn.mjs.map +1 -0
- package/dist/runtime-7fkN5_oL.d.cts +206 -0
- package/dist/runtime-7fkN5_oL.d.mts +206 -0
- package/dist/runtime-Bfs-yn_-.cjs +2 -0
- package/dist/runtime-Bfs-yn_-.cjs.map +1 -0
- package/dist/runtime-CE36Va0l.mjs +2 -0
- package/dist/runtime-CE36Va0l.mjs.map +1 -0
- package/dist/strings-CrzGdnZH.mjs +3 -0
- package/dist/strings-CrzGdnZH.mjs.map +1 -0
- package/dist/strings-_1vAPvzS.cjs +3 -0
- package/dist/strings-_1vAPvzS.cjs.map +1 -0
- package/dist/strings-jE1j-qqa.d.cts +213 -0
- package/dist/strings-jE1j-qqa.d.mts +213 -0
- package/dist/time-BrLHgSth.d.mts +68 -0
- package/dist/time-DmJNWZeL.mjs.map +1 -1
- package/dist/time-ufhllID1.d.cts +68 -0
- package/dist/time-yNkQSJnQ.cjs.map +1 -1
- package/dist/utils/arrays.cjs +1 -1
- package/dist/utils/arrays.d.cts +1 -1
- package/dist/utils/arrays.d.mts +1 -1
- package/dist/utils/arrays.mjs +1 -1
- package/dist/utils/index.cjs +1 -1
- package/dist/utils/index.d.cts +187 -8
- package/dist/utils/index.d.mts +187 -8
- package/dist/utils/index.mjs +1 -1
- package/dist/utils/mime-types.d.cts +1 -1
- package/dist/utils/mime-types.d.mts +1 -1
- package/dist/utils/numbers.cjs +1 -1
- package/dist/utils/numbers.d.cts +1 -1
- package/dist/utils/numbers.d.mts +1 -1
- package/dist/utils/numbers.mjs +1 -1
- package/dist/utils/objects.cjs +1 -1
- package/dist/utils/objects.d.cts +1 -1
- package/dist/utils/objects.d.mts +1 -1
- package/dist/utils/objects.mjs +1 -1
- package/dist/utils/random.cjs +1 -1
- package/dist/utils/random.d.cts +1 -1
- package/dist/utils/random.d.mts +1 -1
- package/dist/utils/random.mjs +1 -1
- package/dist/utils/runtime.cjs +1 -1
- package/dist/utils/runtime.d.cts +1 -1
- package/dist/utils/runtime.d.mts +1 -1
- package/dist/utils/runtime.mjs +1 -1
- package/dist/utils/strings.cjs +1 -1
- package/dist/utils/strings.d.cts +1 -1
- package/dist/utils/strings.d.mts +1 -1
- package/dist/utils/strings.mjs +1 -1
- package/dist/utils/time.d.cts +1 -1
- package/dist/utils/time.d.mts +1 -1
- package/package.json +2 -2
- package/dist/arrays-BkHBzTDO.mjs +0 -2
- package/dist/arrays-BkHBzTDO.mjs.map +0 -1
- package/dist/arrays-CElcW69H.d.cts +0 -43
- package/dist/arrays-CElcW69H.d.mts +0 -43
- package/dist/arrays-DaB1Xn47.cjs +0 -2
- package/dist/arrays-DaB1Xn47.cjs.map +0 -1
- package/dist/numbers-BmUSgeah.d.cts +0 -46
- package/dist/numbers-BmUSgeah.d.mts +0 -46
- package/dist/numbers-Bx9JTSQe.mjs +0 -2
- package/dist/numbers-Bx9JTSQe.mjs.map +0 -1
- package/dist/numbers-DuVx9Qiu.cjs +0 -2
- package/dist/numbers-DuVx9Qiu.cjs.map +0 -1
- package/dist/objects--cO_X3EV.mjs +0 -2
- package/dist/objects--cO_X3EV.mjs.map +0 -1
- package/dist/objects-CnGoVkh6.cjs +0 -2
- package/dist/objects-CnGoVkh6.cjs.map +0 -1
- package/dist/objects-cf8j7rS8.d.cts +0 -26
- package/dist/objects-cf8j7rS8.d.mts +0 -26
- package/dist/random-D1e1NTOt.cjs +0 -2
- package/dist/random-D1e1NTOt.cjs.map +0 -1
- package/dist/random-DbidGSrQ.mjs +0 -2
- package/dist/random-DbidGSrQ.mjs.map +0 -1
- package/dist/random-DpNyGGAZ.d.cts +0 -28
- package/dist/random-DpNyGGAZ.d.mts +0 -28
- package/dist/runtime-B-jA8ZxR.cjs +0 -2
- package/dist/runtime-B-jA8ZxR.cjs.map +0 -1
- package/dist/runtime-CbfL6Fgj.mjs +0 -2
- package/dist/runtime-CbfL6Fgj.mjs.map +0 -1
- package/dist/runtime-T8Kcf7Af.d.cts +0 -28
- package/dist/runtime-T8Kcf7Af.d.mts +0 -28
- package/dist/strings-B0BRwNX9.mjs +0 -3
- package/dist/strings-B0BRwNX9.mjs.map +0 -1
- package/dist/strings-DV446vv-.cjs +0 -3
- package/dist/strings-DV446vv-.cjs.map +0 -1
- package/dist/strings-DhPbrpq7.d.cts +0 -47
- package/dist/strings-DhPbrpq7.d.mts +0 -47
- package/dist/time-8KLG8kBO.d.cts +0 -29
- package/dist/time-D8Wfqzu6.d.mts +0 -29
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
type StringifyArrayOptions<T> = {
|
|
2
|
+
maxItems: number;
|
|
3
|
+
maxItemLength?: number;
|
|
4
|
+
maxTotalLength?: number;
|
|
5
|
+
stringify: (item: T) => string;
|
|
6
|
+
prefix?: string;
|
|
7
|
+
suffix?: string;
|
|
8
|
+
joinString?: string;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Truncate a string to a maximum length, adding a suffix if truncated
|
|
12
|
+
* @param input - String to truncate
|
|
13
|
+
* @param length - Maximum length
|
|
14
|
+
* @param suffix - Suffix to add (default: "...")
|
|
15
|
+
* @returns Truncated string
|
|
16
|
+
* @example truncate("Hello World", 8) // "Hello..."
|
|
17
|
+
*/
|
|
18
|
+
declare const truncate: (input: string, length: number, suffix?: string) => string;
|
|
19
|
+
/**
|
|
20
|
+
* Capitalize the first letter of a string
|
|
21
|
+
* @param input - String to capitalize
|
|
22
|
+
* @returns Capitalized string
|
|
23
|
+
* @example capitalize("hello world") // "Hello world"
|
|
24
|
+
*/
|
|
25
|
+
declare const capitalize: (input: string) => string;
|
|
26
|
+
/**
|
|
27
|
+
* Capitalize the first letter of each word
|
|
28
|
+
* @param input - String to capitalize
|
|
29
|
+
* @returns String with each word capitalized
|
|
30
|
+
* @example capitalizeWords("hello world") // "Hello World"
|
|
31
|
+
*/
|
|
32
|
+
declare const capitalizeWords: (input: string) => string;
|
|
33
|
+
/**
|
|
34
|
+
* Create a URL-friendly slug from a string
|
|
35
|
+
* @param input - String to slugify
|
|
36
|
+
* @returns Slugified string
|
|
37
|
+
* @example slugify("Hello World!") // "hello-world"
|
|
38
|
+
*/
|
|
39
|
+
declare const slugify: (input: string) => string;
|
|
40
|
+
/**
|
|
41
|
+
* Escape HTML special characters
|
|
42
|
+
* @param input - String to escape
|
|
43
|
+
* @returns Escaped string
|
|
44
|
+
* @example escapeHtml("<div>Hello</div>") // "<div>Hello</div>"
|
|
45
|
+
*/
|
|
46
|
+
declare const escapeHtml: (input: string) => string;
|
|
47
|
+
/**
|
|
48
|
+
* Unescape HTML entities
|
|
49
|
+
* @param input - String to unescape
|
|
50
|
+
* @returns Unescaped string
|
|
51
|
+
* @example unescapeHtml("<div>") // "<div>"
|
|
52
|
+
*/
|
|
53
|
+
declare const unescapeHtml: (input: string) => string;
|
|
54
|
+
/**
|
|
55
|
+
* Reverse a string
|
|
56
|
+
* @param input - String to reverse
|
|
57
|
+
* @returns Reversed string
|
|
58
|
+
* @example reverse("hello") // "olleh"
|
|
59
|
+
*/
|
|
60
|
+
declare const reverse: (input: string) => string;
|
|
61
|
+
/**
|
|
62
|
+
* Count occurrences of a substring
|
|
63
|
+
* @param input - String to search in
|
|
64
|
+
* @param search - Substring to count
|
|
65
|
+
* @param caseSensitive - Whether to be case sensitive (default: true)
|
|
66
|
+
* @returns Number of occurrences
|
|
67
|
+
* @example countOccurrences("hello hello world", "hello") // 2
|
|
68
|
+
*/
|
|
69
|
+
declare const countOccurrences: (input: string, search: string, caseSensitive?: boolean) => number;
|
|
70
|
+
/**
|
|
71
|
+
* Check if a string contains only letters
|
|
72
|
+
* @param input - String to check
|
|
73
|
+
* @returns True if only letters
|
|
74
|
+
* @example isAlpha("hello") // true, isAlpha("hello123") // false
|
|
75
|
+
*/
|
|
76
|
+
declare const isAlpha: (input: string) => boolean;
|
|
77
|
+
/**
|
|
78
|
+
* Check if a string contains only alphanumeric characters
|
|
79
|
+
* @param input - String to check
|
|
80
|
+
* @returns True if alphanumeric
|
|
81
|
+
* @example isAlphanumeric("hello123") // true, isAlphanumeric("hello-123") // false
|
|
82
|
+
*/
|
|
83
|
+
declare const isAlphanumeric: (input: string) => boolean;
|
|
84
|
+
/**
|
|
85
|
+
* Pad a string to a certain length with a character
|
|
86
|
+
* @param input - String to pad
|
|
87
|
+
* @param length - Target length
|
|
88
|
+
* @param char - Character to pad with (default: " ")
|
|
89
|
+
* @param direction - Direction to pad ("left", "right", or "both")
|
|
90
|
+
* @returns Padded string
|
|
91
|
+
* @example pad("hello", 10, "*", "right") // "hello*****"
|
|
92
|
+
*/
|
|
93
|
+
declare const pad: (input: string, length: number, char?: string, direction?: "left" | "right" | "both") => string;
|
|
94
|
+
/**
|
|
95
|
+
* Stringify an array with various formatting options
|
|
96
|
+
* @param arr - Array to stringify
|
|
97
|
+
* @param options - Formatting options (max items, max length, etc.)
|
|
98
|
+
* @returns Object with result string and truncation info
|
|
99
|
+
* @example stringifyArray([1, 2, 3], {maxItems: 2, stringify: String}) // {result: "1, 2", truncatedItems: 1}
|
|
100
|
+
*/
|
|
101
|
+
declare const stringifyArray: <T>(arr: T[], options: StringifyArrayOptions<T>) => {
|
|
102
|
+
result: string;
|
|
103
|
+
truncatedItems: number;
|
|
104
|
+
};
|
|
105
|
+
/**
|
|
106
|
+
* Display array as string with formatting and optional truncation message
|
|
107
|
+
* @param arr - Array to display
|
|
108
|
+
* @param options - Display options
|
|
109
|
+
* @returns Formatted string
|
|
110
|
+
*/
|
|
111
|
+
declare const displayArray: <T>(arr: T[], options: StringifyArrayOptions<T> & {
|
|
112
|
+
emptyOutput: string;
|
|
113
|
+
}) => string;
|
|
114
|
+
/**
|
|
115
|
+
* Convert a word to plural form (simple English pluralization)
|
|
116
|
+
* @param input - Word to pluralize
|
|
117
|
+
* @param count - Count to determine if plural is needed
|
|
118
|
+
* @returns Pluralized word
|
|
119
|
+
* @example pluralize("cat", 2) // "cats", pluralize("cat", 1) // "cat"
|
|
120
|
+
*/
|
|
121
|
+
declare const pluralize: (input: string, count: number) => string;
|
|
122
|
+
/**
|
|
123
|
+
* Convert string to snake_case
|
|
124
|
+
* @param input - String to convert
|
|
125
|
+
* @returns snake_case string
|
|
126
|
+
* @example snakeCase("helloWorld") // "hello_world"
|
|
127
|
+
*/
|
|
128
|
+
declare const snakeCase: (input: string) => string;
|
|
129
|
+
/**
|
|
130
|
+
* Convert string to Title Case
|
|
131
|
+
* @param input - String to convert
|
|
132
|
+
* @returns Title Case string
|
|
133
|
+
* @example titleCase("hello world") // "Hello World"
|
|
134
|
+
*/
|
|
135
|
+
declare const titleCase: (input: string) => string;
|
|
136
|
+
/**
|
|
137
|
+
* Convert string to kebab-case
|
|
138
|
+
* @param input - String to convert
|
|
139
|
+
* @returns kebab-case string
|
|
140
|
+
* @example kebabCase("helloWorld") // "hello-world"
|
|
141
|
+
*/
|
|
142
|
+
declare const kebabCase: (input: string) => string;
|
|
143
|
+
/**
|
|
144
|
+
* Convert string to camelCase
|
|
145
|
+
* @param input - String to convert
|
|
146
|
+
* @returns camelCase string
|
|
147
|
+
* @example camelCase("hello world") // "helloWorld"
|
|
148
|
+
*/
|
|
149
|
+
declare const camelCase: (input: string) => string;
|
|
150
|
+
/**
|
|
151
|
+
* Convert string to PascalCase
|
|
152
|
+
* @param input - String to convert
|
|
153
|
+
* @returns PascalCase string
|
|
154
|
+
* @example pascalCase("hello world") // "HelloWorld"
|
|
155
|
+
*/
|
|
156
|
+
declare const pascalCase: (input: string) => string;
|
|
157
|
+
/**
|
|
158
|
+
* Split a string on uppercase letters
|
|
159
|
+
* @param input - String to split
|
|
160
|
+
* @param splitChar - Character to insert (default: " ")
|
|
161
|
+
* @returns Split string
|
|
162
|
+
* @example splitOnUppercase("helloWorld") // "hello World"
|
|
163
|
+
*/
|
|
164
|
+
declare const splitOnUppercase: (input: string, splitChar?: string) => string;
|
|
165
|
+
/**
|
|
166
|
+
* Replace template tags in a string with custom delimiters
|
|
167
|
+
* @param input - String with template tags
|
|
168
|
+
* @param placeholders - Object with key-value pairs
|
|
169
|
+
* @param delimiters - Opening and closing delimiters (default: ["{", "}"])
|
|
170
|
+
* @returns String with replaced tags
|
|
171
|
+
* @example replaceTags("Hello {name}!", {name: "World"}) // "Hello World!"
|
|
172
|
+
* @example replaceTags("Hello {{name}}!", {name: "World"}, ["{{", "}}"])
|
|
173
|
+
* @example replaceTags("Hello [name]!", {name: "World"}, ["[", "]"])
|
|
174
|
+
*/
|
|
175
|
+
declare const replaceTags: (input: string, placeholders: Record<string, string>, delimiters?: [string, string]) => string;
|
|
176
|
+
/**
|
|
177
|
+
* Check if a string is a valid URL
|
|
178
|
+
* @param input - String to check
|
|
179
|
+
* @returns True if valid URL
|
|
180
|
+
* @example isUrl("https://example.com") // true
|
|
181
|
+
*/
|
|
182
|
+
declare const isUrl: (input: string) => boolean;
|
|
183
|
+
|
|
184
|
+
type strings_StringifyArrayOptions<T> = StringifyArrayOptions<T>;
|
|
185
|
+
declare const strings_camelCase: typeof camelCase;
|
|
186
|
+
declare const strings_capitalize: typeof capitalize;
|
|
187
|
+
declare const strings_capitalizeWords: typeof capitalizeWords;
|
|
188
|
+
declare const strings_countOccurrences: typeof countOccurrences;
|
|
189
|
+
declare const strings_displayArray: typeof displayArray;
|
|
190
|
+
declare const strings_escapeHtml: typeof escapeHtml;
|
|
191
|
+
declare const strings_isAlpha: typeof isAlpha;
|
|
192
|
+
declare const strings_isAlphanumeric: typeof isAlphanumeric;
|
|
193
|
+
declare const strings_isUrl: typeof isUrl;
|
|
194
|
+
declare const strings_kebabCase: typeof kebabCase;
|
|
195
|
+
declare const strings_pad: typeof pad;
|
|
196
|
+
declare const strings_pascalCase: typeof pascalCase;
|
|
197
|
+
declare const strings_pluralize: typeof pluralize;
|
|
198
|
+
declare const strings_replaceTags: typeof replaceTags;
|
|
199
|
+
declare const strings_reverse: typeof reverse;
|
|
200
|
+
declare const strings_slugify: typeof slugify;
|
|
201
|
+
declare const strings_snakeCase: typeof snakeCase;
|
|
202
|
+
declare const strings_splitOnUppercase: typeof splitOnUppercase;
|
|
203
|
+
declare const strings_stringifyArray: typeof stringifyArray;
|
|
204
|
+
declare const strings_titleCase: typeof titleCase;
|
|
205
|
+
declare const strings_truncate: typeof truncate;
|
|
206
|
+
declare const strings_unescapeHtml: typeof unescapeHtml;
|
|
207
|
+
declare namespace strings {
|
|
208
|
+
export { strings_camelCase as camelCase, strings_capitalize as capitalize, strings_capitalizeWords as capitalizeWords, strings_countOccurrences as countOccurrences, strings_displayArray as displayArray, strings_escapeHtml as escapeHtml, strings_isAlpha as isAlpha, strings_isAlphanumeric as isAlphanumeric, strings_isUrl as isUrl, strings_kebabCase as kebabCase, strings_pad as pad, strings_pascalCase as pascalCase, strings_pluralize as pluralize, strings_replaceTags as replaceTags, strings_reverse as reverse, strings_slugify as slugify, strings_snakeCase as snakeCase, strings_splitOnUppercase as splitOnUppercase, strings_stringifyArray as stringifyArray, strings_titleCase as titleCase, strings_truncate as truncate, strings_unescapeHtml as unescapeHtml };
|
|
209
|
+
export type { strings_StringifyArrayOptions as StringifyArrayOptions };
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
export { capitalizeWords as a, slugify as b, capitalize as c, countOccurrences as d, escapeHtml as e, isAlphanumeric as f, stringifyArray as g, displayArray as h, isAlpha as i, pluralize as j, snakeCase as k, titleCase as l, kebabCase as m, camelCase as n, pascalCase as o, pad as p, splitOnUppercase as q, reverse as r, strings as s, truncate as t, unescapeHtml as u, replaceTags as v, isUrl as w };
|
|
213
|
+
export type { StringifyArrayOptions as S };
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
type StringifyArrayOptions<T> = {
|
|
2
|
+
maxItems: number;
|
|
3
|
+
maxItemLength?: number;
|
|
4
|
+
maxTotalLength?: number;
|
|
5
|
+
stringify: (item: T) => string;
|
|
6
|
+
prefix?: string;
|
|
7
|
+
suffix?: string;
|
|
8
|
+
joinString?: string;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Truncate a string to a maximum length, adding a suffix if truncated
|
|
12
|
+
* @param input - String to truncate
|
|
13
|
+
* @param length - Maximum length
|
|
14
|
+
* @param suffix - Suffix to add (default: "...")
|
|
15
|
+
* @returns Truncated string
|
|
16
|
+
* @example truncate("Hello World", 8) // "Hello..."
|
|
17
|
+
*/
|
|
18
|
+
declare const truncate: (input: string, length: number, suffix?: string) => string;
|
|
19
|
+
/**
|
|
20
|
+
* Capitalize the first letter of a string
|
|
21
|
+
* @param input - String to capitalize
|
|
22
|
+
* @returns Capitalized string
|
|
23
|
+
* @example capitalize("hello world") // "Hello world"
|
|
24
|
+
*/
|
|
25
|
+
declare const capitalize: (input: string) => string;
|
|
26
|
+
/**
|
|
27
|
+
* Capitalize the first letter of each word
|
|
28
|
+
* @param input - String to capitalize
|
|
29
|
+
* @returns String with each word capitalized
|
|
30
|
+
* @example capitalizeWords("hello world") // "Hello World"
|
|
31
|
+
*/
|
|
32
|
+
declare const capitalizeWords: (input: string) => string;
|
|
33
|
+
/**
|
|
34
|
+
* Create a URL-friendly slug from a string
|
|
35
|
+
* @param input - String to slugify
|
|
36
|
+
* @returns Slugified string
|
|
37
|
+
* @example slugify("Hello World!") // "hello-world"
|
|
38
|
+
*/
|
|
39
|
+
declare const slugify: (input: string) => string;
|
|
40
|
+
/**
|
|
41
|
+
* Escape HTML special characters
|
|
42
|
+
* @param input - String to escape
|
|
43
|
+
* @returns Escaped string
|
|
44
|
+
* @example escapeHtml("<div>Hello</div>") // "<div>Hello</div>"
|
|
45
|
+
*/
|
|
46
|
+
declare const escapeHtml: (input: string) => string;
|
|
47
|
+
/**
|
|
48
|
+
* Unescape HTML entities
|
|
49
|
+
* @param input - String to unescape
|
|
50
|
+
* @returns Unescaped string
|
|
51
|
+
* @example unescapeHtml("<div>") // "<div>"
|
|
52
|
+
*/
|
|
53
|
+
declare const unescapeHtml: (input: string) => string;
|
|
54
|
+
/**
|
|
55
|
+
* Reverse a string
|
|
56
|
+
* @param input - String to reverse
|
|
57
|
+
* @returns Reversed string
|
|
58
|
+
* @example reverse("hello") // "olleh"
|
|
59
|
+
*/
|
|
60
|
+
declare const reverse: (input: string) => string;
|
|
61
|
+
/**
|
|
62
|
+
* Count occurrences of a substring
|
|
63
|
+
* @param input - String to search in
|
|
64
|
+
* @param search - Substring to count
|
|
65
|
+
* @param caseSensitive - Whether to be case sensitive (default: true)
|
|
66
|
+
* @returns Number of occurrences
|
|
67
|
+
* @example countOccurrences("hello hello world", "hello") // 2
|
|
68
|
+
*/
|
|
69
|
+
declare const countOccurrences: (input: string, search: string, caseSensitive?: boolean) => number;
|
|
70
|
+
/**
|
|
71
|
+
* Check if a string contains only letters
|
|
72
|
+
* @param input - String to check
|
|
73
|
+
* @returns True if only letters
|
|
74
|
+
* @example isAlpha("hello") // true, isAlpha("hello123") // false
|
|
75
|
+
*/
|
|
76
|
+
declare const isAlpha: (input: string) => boolean;
|
|
77
|
+
/**
|
|
78
|
+
* Check if a string contains only alphanumeric characters
|
|
79
|
+
* @param input - String to check
|
|
80
|
+
* @returns True if alphanumeric
|
|
81
|
+
* @example isAlphanumeric("hello123") // true, isAlphanumeric("hello-123") // false
|
|
82
|
+
*/
|
|
83
|
+
declare const isAlphanumeric: (input: string) => boolean;
|
|
84
|
+
/**
|
|
85
|
+
* Pad a string to a certain length with a character
|
|
86
|
+
* @param input - String to pad
|
|
87
|
+
* @param length - Target length
|
|
88
|
+
* @param char - Character to pad with (default: " ")
|
|
89
|
+
* @param direction - Direction to pad ("left", "right", or "both")
|
|
90
|
+
* @returns Padded string
|
|
91
|
+
* @example pad("hello", 10, "*", "right") // "hello*****"
|
|
92
|
+
*/
|
|
93
|
+
declare const pad: (input: string, length: number, char?: string, direction?: "left" | "right" | "both") => string;
|
|
94
|
+
/**
|
|
95
|
+
* Stringify an array with various formatting options
|
|
96
|
+
* @param arr - Array to stringify
|
|
97
|
+
* @param options - Formatting options (max items, max length, etc.)
|
|
98
|
+
* @returns Object with result string and truncation info
|
|
99
|
+
* @example stringifyArray([1, 2, 3], {maxItems: 2, stringify: String}) // {result: "1, 2", truncatedItems: 1}
|
|
100
|
+
*/
|
|
101
|
+
declare const stringifyArray: <T>(arr: T[], options: StringifyArrayOptions<T>) => {
|
|
102
|
+
result: string;
|
|
103
|
+
truncatedItems: number;
|
|
104
|
+
};
|
|
105
|
+
/**
|
|
106
|
+
* Display array as string with formatting and optional truncation message
|
|
107
|
+
* @param arr - Array to display
|
|
108
|
+
* @param options - Display options
|
|
109
|
+
* @returns Formatted string
|
|
110
|
+
*/
|
|
111
|
+
declare const displayArray: <T>(arr: T[], options: StringifyArrayOptions<T> & {
|
|
112
|
+
emptyOutput: string;
|
|
113
|
+
}) => string;
|
|
114
|
+
/**
|
|
115
|
+
* Convert a word to plural form (simple English pluralization)
|
|
116
|
+
* @param input - Word to pluralize
|
|
117
|
+
* @param count - Count to determine if plural is needed
|
|
118
|
+
* @returns Pluralized word
|
|
119
|
+
* @example pluralize("cat", 2) // "cats", pluralize("cat", 1) // "cat"
|
|
120
|
+
*/
|
|
121
|
+
declare const pluralize: (input: string, count: number) => string;
|
|
122
|
+
/**
|
|
123
|
+
* Convert string to snake_case
|
|
124
|
+
* @param input - String to convert
|
|
125
|
+
* @returns snake_case string
|
|
126
|
+
* @example snakeCase("helloWorld") // "hello_world"
|
|
127
|
+
*/
|
|
128
|
+
declare const snakeCase: (input: string) => string;
|
|
129
|
+
/**
|
|
130
|
+
* Convert string to Title Case
|
|
131
|
+
* @param input - String to convert
|
|
132
|
+
* @returns Title Case string
|
|
133
|
+
* @example titleCase("hello world") // "Hello World"
|
|
134
|
+
*/
|
|
135
|
+
declare const titleCase: (input: string) => string;
|
|
136
|
+
/**
|
|
137
|
+
* Convert string to kebab-case
|
|
138
|
+
* @param input - String to convert
|
|
139
|
+
* @returns kebab-case string
|
|
140
|
+
* @example kebabCase("helloWorld") // "hello-world"
|
|
141
|
+
*/
|
|
142
|
+
declare const kebabCase: (input: string) => string;
|
|
143
|
+
/**
|
|
144
|
+
* Convert string to camelCase
|
|
145
|
+
* @param input - String to convert
|
|
146
|
+
* @returns camelCase string
|
|
147
|
+
* @example camelCase("hello world") // "helloWorld"
|
|
148
|
+
*/
|
|
149
|
+
declare const camelCase: (input: string) => string;
|
|
150
|
+
/**
|
|
151
|
+
* Convert string to PascalCase
|
|
152
|
+
* @param input - String to convert
|
|
153
|
+
* @returns PascalCase string
|
|
154
|
+
* @example pascalCase("hello world") // "HelloWorld"
|
|
155
|
+
*/
|
|
156
|
+
declare const pascalCase: (input: string) => string;
|
|
157
|
+
/**
|
|
158
|
+
* Split a string on uppercase letters
|
|
159
|
+
* @param input - String to split
|
|
160
|
+
* @param splitChar - Character to insert (default: " ")
|
|
161
|
+
* @returns Split string
|
|
162
|
+
* @example splitOnUppercase("helloWorld") // "hello World"
|
|
163
|
+
*/
|
|
164
|
+
declare const splitOnUppercase: (input: string, splitChar?: string) => string;
|
|
165
|
+
/**
|
|
166
|
+
* Replace template tags in a string with custom delimiters
|
|
167
|
+
* @param input - String with template tags
|
|
168
|
+
* @param placeholders - Object with key-value pairs
|
|
169
|
+
* @param delimiters - Opening and closing delimiters (default: ["{", "}"])
|
|
170
|
+
* @returns String with replaced tags
|
|
171
|
+
* @example replaceTags("Hello {name}!", {name: "World"}) // "Hello World!"
|
|
172
|
+
* @example replaceTags("Hello {{name}}!", {name: "World"}, ["{{", "}}"])
|
|
173
|
+
* @example replaceTags("Hello [name]!", {name: "World"}, ["[", "]"])
|
|
174
|
+
*/
|
|
175
|
+
declare const replaceTags: (input: string, placeholders: Record<string, string>, delimiters?: [string, string]) => string;
|
|
176
|
+
/**
|
|
177
|
+
* Check if a string is a valid URL
|
|
178
|
+
* @param input - String to check
|
|
179
|
+
* @returns True if valid URL
|
|
180
|
+
* @example isUrl("https://example.com") // true
|
|
181
|
+
*/
|
|
182
|
+
declare const isUrl: (input: string) => boolean;
|
|
183
|
+
|
|
184
|
+
type strings_StringifyArrayOptions<T> = StringifyArrayOptions<T>;
|
|
185
|
+
declare const strings_camelCase: typeof camelCase;
|
|
186
|
+
declare const strings_capitalize: typeof capitalize;
|
|
187
|
+
declare const strings_capitalizeWords: typeof capitalizeWords;
|
|
188
|
+
declare const strings_countOccurrences: typeof countOccurrences;
|
|
189
|
+
declare const strings_displayArray: typeof displayArray;
|
|
190
|
+
declare const strings_escapeHtml: typeof escapeHtml;
|
|
191
|
+
declare const strings_isAlpha: typeof isAlpha;
|
|
192
|
+
declare const strings_isAlphanumeric: typeof isAlphanumeric;
|
|
193
|
+
declare const strings_isUrl: typeof isUrl;
|
|
194
|
+
declare const strings_kebabCase: typeof kebabCase;
|
|
195
|
+
declare const strings_pad: typeof pad;
|
|
196
|
+
declare const strings_pascalCase: typeof pascalCase;
|
|
197
|
+
declare const strings_pluralize: typeof pluralize;
|
|
198
|
+
declare const strings_replaceTags: typeof replaceTags;
|
|
199
|
+
declare const strings_reverse: typeof reverse;
|
|
200
|
+
declare const strings_slugify: typeof slugify;
|
|
201
|
+
declare const strings_snakeCase: typeof snakeCase;
|
|
202
|
+
declare const strings_splitOnUppercase: typeof splitOnUppercase;
|
|
203
|
+
declare const strings_stringifyArray: typeof stringifyArray;
|
|
204
|
+
declare const strings_titleCase: typeof titleCase;
|
|
205
|
+
declare const strings_truncate: typeof truncate;
|
|
206
|
+
declare const strings_unescapeHtml: typeof unescapeHtml;
|
|
207
|
+
declare namespace strings {
|
|
208
|
+
export { strings_camelCase as camelCase, strings_capitalize as capitalize, strings_capitalizeWords as capitalizeWords, strings_countOccurrences as countOccurrences, strings_displayArray as displayArray, strings_escapeHtml as escapeHtml, strings_isAlpha as isAlpha, strings_isAlphanumeric as isAlphanumeric, strings_isUrl as isUrl, strings_kebabCase as kebabCase, strings_pad as pad, strings_pascalCase as pascalCase, strings_pluralize as pluralize, strings_replaceTags as replaceTags, strings_reverse as reverse, strings_slugify as slugify, strings_snakeCase as snakeCase, strings_splitOnUppercase as splitOnUppercase, strings_stringifyArray as stringifyArray, strings_titleCase as titleCase, strings_truncate as truncate, strings_unescapeHtml as unescapeHtml };
|
|
209
|
+
export type { strings_StringifyArrayOptions as StringifyArrayOptions };
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
export { capitalizeWords as a, slugify as b, capitalize as c, countOccurrences as d, escapeHtml as e, isAlphanumeric as f, stringifyArray as g, displayArray as h, isAlpha as i, pluralize as j, snakeCase as k, titleCase as l, kebabCase as m, camelCase as n, pascalCase as o, pad as p, splitOnUppercase as q, reverse as r, strings as s, truncate as t, unescapeHtml as u, replaceTags as v, isUrl as w };
|
|
213
|
+
export type { StringifyArrayOptions as S };
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { TimeMagic } from './constants/time.mjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Convert a timestamp in milliseconds to Unix timestamp (seconds)
|
|
5
|
+
* @param timestamp - Timestamp in milliseconds
|
|
6
|
+
* @returns Unix timestamp in seconds
|
|
7
|
+
* @example unix(1609459200000) // 1609459200
|
|
8
|
+
*/
|
|
9
|
+
declare const unix: (timestamp: number) => number;
|
|
10
|
+
/**
|
|
11
|
+
* Get current Unix timestamp in seconds
|
|
12
|
+
* @returns Current Unix timestamp
|
|
13
|
+
* @example unixNow() // Current time in seconds
|
|
14
|
+
*/
|
|
15
|
+
declare const unixNow: () => number;
|
|
16
|
+
/**
|
|
17
|
+
* Convert milliseconds to human readable format
|
|
18
|
+
* @param ms - Milliseconds to format
|
|
19
|
+
* @param maxParts - Maximum number of time parts to show (default: 2)
|
|
20
|
+
* @param msDisplay - What to display for very small values (default: "Just now")
|
|
21
|
+
* @returns Human readable string
|
|
22
|
+
* @example humanReadableMs(90000) // "1 minute and 30 seconds"
|
|
23
|
+
* @example humanReadableMs(3600000, 1) // "1 hour"
|
|
24
|
+
*/
|
|
25
|
+
declare const humanReadableMs: (ms: number, maxParts?: number, msDisplay?: string | ((ms: number) => string)) => string;
|
|
26
|
+
/**
|
|
27
|
+
* Convert high-resolution time to milliseconds
|
|
28
|
+
* @param hrTime - High-resolution time tuple [seconds, nanoseconds]
|
|
29
|
+
* @returns Time in milliseconds
|
|
30
|
+
* @example hrTimeToMs([1, 500000000]) // 1500 (1.5 seconds)
|
|
31
|
+
*/
|
|
32
|
+
declare const hrTimeToMs: (hrTime: [number, number]) => number;
|
|
33
|
+
/**
|
|
34
|
+
* Convert BigInt duration to human readable string
|
|
35
|
+
* @param start - Start time from process.hrtime.bigint()
|
|
36
|
+
* @returns Human readable duration string
|
|
37
|
+
* @example bigIntDurationToHumanReadable(startTime) // "123.456ms"
|
|
38
|
+
*/
|
|
39
|
+
declare const bigIntDurationToHumanReadable: (start: bigint) => string;
|
|
40
|
+
/**
|
|
41
|
+
* Calculate average occurrences per interval from an array of dates
|
|
42
|
+
* @param dates - Array of dates
|
|
43
|
+
* @param interval - Interval in milliseconds
|
|
44
|
+
* @returns Average number of occurrences per interval
|
|
45
|
+
* @example occurrencesPerInterval([date1, date2, date3], 60000) // Avg per minute
|
|
46
|
+
*/
|
|
47
|
+
declare const occurrencesPerInterval: (dates: Date[], interval: number) => number;
|
|
48
|
+
|
|
49
|
+
declare const time_TimeMagic: typeof TimeMagic;
|
|
50
|
+
declare const time_bigIntDurationToHumanReadable: typeof bigIntDurationToHumanReadable;
|
|
51
|
+
declare const time_hrTimeToMs: typeof hrTimeToMs;
|
|
52
|
+
declare const time_humanReadableMs: typeof humanReadableMs;
|
|
53
|
+
declare const time_occurrencesPerInterval: typeof occurrencesPerInterval;
|
|
54
|
+
declare const time_unix: typeof unix;
|
|
55
|
+
declare const time_unixNow: typeof unixNow;
|
|
56
|
+
declare namespace time {
|
|
57
|
+
export {
|
|
58
|
+
time_TimeMagic as TimeMagic,
|
|
59
|
+
time_bigIntDurationToHumanReadable as bigIntDurationToHumanReadable,
|
|
60
|
+
time_hrTimeToMs as hrTimeToMs,
|
|
61
|
+
time_humanReadableMs as humanReadableMs,
|
|
62
|
+
time_occurrencesPerInterval as occurrencesPerInterval,
|
|
63
|
+
time_unix as unix,
|
|
64
|
+
time_unixNow as unixNow,
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export { unixNow as a, hrTimeToMs as b, bigIntDurationToHumanReadable as c, humanReadableMs as h, occurrencesPerInterval as o, time as t, unix as u };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"time-DmJNWZeL.mjs","sources":["../src/utils/time.ts"],"sourcesContent":["import { TimeMagic } from '../constants/time';\n\nconst unix = (timestamp: number): number =>\n\tMath.floor(timestamp / TimeMagic.MILLISECONDS_PER_SECOND);\n\nconst unixNow = (): number => unix(Date.now());\n\nconst humanReadableMs = (\n\tms: number,\n\tmaxParts = 2,\n\tmsDisplay: string | ((ms: number) => string) = 'Just now'\n): string => {\n\tconst days = (ms / TimeMagic.MILLISECONDS_PER_DAY) | 0;\n\tconst hours =\n\t\t((ms % TimeMagic.MILLISECONDS_PER_DAY) / TimeMagic.MILLISECONDS_PER_HOUR) |\n\t\t0;\n\tconst minutes =\n\t\t((ms % TimeMagic.MILLISECONDS_PER_HOUR) /\n\t\t\tTimeMagic.MILLISECONDS_PER_MINUTE) |\n\t\t0;\n\tconst seconds =\n\t\t((ms % TimeMagic.MILLISECONDS_PER_MINUTE) /\n\t\t\tTimeMagic.MILLISECONDS_PER_SECOND) |\n\t\t0;\n\n\tconst parts = [];\n\tif (days > 0) parts.push(`${days} day${days === 1 ? '' : 's'}`);\n\tif (hours > 0) parts.push(`${hours} hour${hours === 1 ? '' : 's'}`);\n\tif (minutes > 0) parts.push(`${minutes} minute${minutes === 1 ? '' : 's'}`);\n\tif (seconds > 0) parts.push(`${seconds} second${seconds === 1 ? '' : 's'}`);\n\n\tconst formattedParts = parts.slice(0, maxParts);\n\tconst lastPart = formattedParts.pop();\n\n\tif (formattedParts.length > 0) {\n\t\treturn `${formattedParts.join(', ')}${formattedParts.length > 1 ? ',' : ''} and ${lastPart}`;\n\t} else\n\t\treturn (\n\t\t\tlastPart ?? (typeof msDisplay === 'function' ? msDisplay(ms) : msDisplay)\n\t\t);\n};\n\nconst hrTimeToMs = (hrTime: [number, number]): number =>\n\thrTime[0] * 1e3 + hrTime[1] / 1e6;\n\nconst bigIntDurationToHumanReadable = (start: bigint): string => {\n\tconst end = process.hrtime.bigint();\n\tconst ms = Number(end - start) / 1e6;\n\treturn `${ms.toFixed(3)}ms`;\n};\n\nconst occurrencesPerInterval = (dates: Date[], interval: number): number => {\n\tif (dates.length === 0) return 0;\n\n\tlet totalCount = 0;\n\tlet intervalCount = 0;\n\tconst map: Record<string, number> = {};\n\tconst baseTime = dates[0].getTime();\n\n\t// Iterate through the dates and count them in their respective intervals\n\tfor (const date of dates) {\n\t\tconst timeDiff = date.getTime() - baseTime;\n\t\tconst intervalIndex = Math.floor(timeDiff / interval);\n\n\t\tif (map[intervalIndex]) {\n\t\t\tmap[intervalIndex]++;\n\t\t} else {\n\t\t\tmap[intervalIndex] = 1;\n\t\t}\n\t}\n\n\t// Calculate the total count and number of intervals\n\tfor (const key in map) {\n\t\tconst val = map[key];\n\t\tif (!val) continue;\n\t\ttotalCount += val;\n\t\tintervalCount++;\n\t}\n\n\t// Calculate the average\n\treturn totalCount / intervalCount;\n};\n\nexport {\n\tunix,\n\tunixNow,\n\thumanReadableMs,\n\thrTimeToMs,\n\tbigIntDurationToHumanReadable,\n\toccurrencesPerInterval,\n\tTimeMagic,\n};\n"],"names":["unix","__name","timestamp","TimeMagic","unixNow","humanReadableMs","ms","maxParts","msDisplay","days","hours","minutes","seconds","parts","formattedParts","lastPart","hrTimeToMs","hrTime","bigIntDurationToHumanReadable","start","end","occurrencesPerInterval","dates","interval","totalCount","intervalCount","map","baseTime","date","timeDiff","intervalIndex","key","val"],"mappings":"
|
|
1
|
+
{"version":3,"file":"time-DmJNWZeL.mjs","sources":["../src/utils/time.ts"],"sourcesContent":["import { TimeMagic } from '../constants/time';\n\n/**\n * Convert a timestamp in milliseconds to Unix timestamp (seconds)\n * @param timestamp - Timestamp in milliseconds\n * @returns Unix timestamp in seconds\n * @example unix(1609459200000) // 1609459200\n */\nconst unix = (timestamp: number): number =>\n\tMath.floor(timestamp / TimeMagic.MILLISECONDS_PER_SECOND);\n\n/**\n * Get current Unix timestamp in seconds\n * @returns Current Unix timestamp\n * @example unixNow() // Current time in seconds\n */\nconst unixNow = (): number => unix(Date.now());\n\n/**\n * Convert milliseconds to human readable format\n * @param ms - Milliseconds to format\n * @param maxParts - Maximum number of time parts to show (default: 2)\n * @param msDisplay - What to display for very small values (default: \"Just now\")\n * @returns Human readable string\n * @example humanReadableMs(90000) // \"1 minute and 30 seconds\"\n * @example humanReadableMs(3600000, 1) // \"1 hour\"\n */\nconst humanReadableMs = (\n\tms: number,\n\tmaxParts = 2,\n\tmsDisplay: string | ((ms: number) => string) = 'Just now'\n): string => {\n\tconst days = (ms / TimeMagic.MILLISECONDS_PER_DAY) | 0;\n\tconst hours =\n\t\t((ms % TimeMagic.MILLISECONDS_PER_DAY) / TimeMagic.MILLISECONDS_PER_HOUR) |\n\t\t0;\n\tconst minutes =\n\t\t((ms % TimeMagic.MILLISECONDS_PER_HOUR) /\n\t\t\tTimeMagic.MILLISECONDS_PER_MINUTE) |\n\t\t0;\n\tconst seconds =\n\t\t((ms % TimeMagic.MILLISECONDS_PER_MINUTE) /\n\t\t\tTimeMagic.MILLISECONDS_PER_SECOND) |\n\t\t0;\n\n\tconst parts = [];\n\tif (days > 0) parts.push(`${days} day${days === 1 ? '' : 's'}`);\n\tif (hours > 0) parts.push(`${hours} hour${hours === 1 ? '' : 's'}`);\n\tif (minutes > 0) parts.push(`${minutes} minute${minutes === 1 ? '' : 's'}`);\n\tif (seconds > 0) parts.push(`${seconds} second${seconds === 1 ? '' : 's'}`);\n\n\tconst formattedParts = parts.slice(0, maxParts);\n\tconst lastPart = formattedParts.pop();\n\n\tif (formattedParts.length > 0) {\n\t\treturn `${formattedParts.join(', ')}${formattedParts.length > 1 ? ',' : ''} and ${lastPart}`;\n\t} else\n\t\treturn (\n\t\t\tlastPart ?? (typeof msDisplay === 'function' ? msDisplay(ms) : msDisplay)\n\t\t);\n};\n\n/**\n * Convert high-resolution time to milliseconds\n * @param hrTime - High-resolution time tuple [seconds, nanoseconds]\n * @returns Time in milliseconds\n * @example hrTimeToMs([1, 500000000]) // 1500 (1.5 seconds)\n */\nconst hrTimeToMs = (hrTime: [number, number]): number =>\n\thrTime[0] * 1e3 + hrTime[1] / 1e6;\n\n/**\n * Convert BigInt duration to human readable string\n * @param start - Start time from process.hrtime.bigint()\n * @returns Human readable duration string\n * @example bigIntDurationToHumanReadable(startTime) // \"123.456ms\"\n */\nconst bigIntDurationToHumanReadable = (start: bigint): string => {\n\tconst end = process.hrtime.bigint();\n\tconst ms = Number(end - start) / 1e6;\n\treturn `${ms.toFixed(3)}ms`;\n};\n\n/**\n * Calculate average occurrences per interval from an array of dates\n * @param dates - Array of dates\n * @param interval - Interval in milliseconds\n * @returns Average number of occurrences per interval\n * @example occurrencesPerInterval([date1, date2, date3], 60000) // Avg per minute\n */\nconst occurrencesPerInterval = (dates: Date[], interval: number): number => {\n\tif (dates.length === 0) return 0;\n\n\tlet totalCount = 0;\n\tlet intervalCount = 0;\n\tconst map: Record<string, number> = {};\n\tconst baseTime = dates[0].getTime();\n\n\t// Iterate through the dates and count them in their respective intervals\n\tfor (const date of dates) {\n\t\tconst timeDiff = date.getTime() - baseTime;\n\t\tconst intervalIndex = Math.floor(timeDiff / interval);\n\n\t\tif (map[intervalIndex]) {\n\t\t\tmap[intervalIndex]++;\n\t\t} else {\n\t\t\tmap[intervalIndex] = 1;\n\t\t}\n\t}\n\n\t// Calculate the total count and number of intervals\n\tfor (const key in map) {\n\t\tconst val = map[key];\n\t\tif (!val) continue;\n\t\ttotalCount += val;\n\t\tintervalCount++;\n\t}\n\n\t// Calculate the average\n\treturn totalCount / intervalCount;\n};\n\nexport {\n\tunix,\n\tunixNow,\n\thumanReadableMs,\n\thrTimeToMs,\n\tbigIntDurationToHumanReadable,\n\toccurrencesPerInterval,\n\tTimeMagic,\n};\n"],"names":["unix","__name","timestamp","TimeMagic","unixNow","humanReadableMs","ms","maxParts","msDisplay","days","hours","minutes","seconds","parts","formattedParts","lastPart","hrTimeToMs","hrTime","bigIntDurationToHumanReadable","start","end","occurrencesPerInterval","dates","interval","totalCount","intervalCount","map","baseTime","date","timeDiff","intervalIndex","key","val"],"mappings":"gIAQA,MAAMA,EAAOC,EAACC,GACb,KAAK,MAAMA,EAAYC,EAAU,uBAAuB,EAD5C,QAQPC,EAAUH,EAAA,IAAcD,EAAK,KAAK,KAAK,EAA7B,WAWVK,EAAkBJ,EAAA,CACvBK,EACAC,EAAW,EACXC,EAA+C,aACnC,CACZ,MAAMC,EAAQH,EAAKH,EAAU,qBAAwB,EAC/CO,EACHJ,EAAKH,EAAU,qBAAwBA,EAAU,sBACnD,EACKQ,EACHL,EAAKH,EAAU,sBAChBA,EAAU,wBACX,EACKS,EACHN,EAAKH,EAAU,wBAChBA,EAAU,wBACX,EAEKU,EAAQ,CAAA,EACVJ,EAAO,GAAGI,EAAM,KAAK,GAAGJ,CAAI,OAAOA,IAAS,EAAI,GAAK,GAAG,EAAE,EAC1DC,EAAQ,GAAGG,EAAM,KAAK,GAAGH,CAAK,QAAQA,IAAU,EAAI,GAAK,GAAG,EAAE,EAC9DC,EAAU,GAAGE,EAAM,KAAK,GAAGF,CAAO,UAAUA,IAAY,EAAI,GAAK,GAAG,EAAE,EACtEC,EAAU,GAAGC,EAAM,KAAK,GAAGD,CAAO,UAAUA,IAAY,EAAI,GAAK,GAAG,EAAE,EAE1E,MAAME,EAAiBD,EAAM,MAAM,EAAGN,CAAQ,EACxCQ,EAAWD,EAAe,IAAA,EAEhC,OAAIA,EAAe,OAAS,EACpB,GAAGA,EAAe,KAAK,IAAI,CAAC,GAAGA,EAAe,OAAS,EAAI,IAAM,EAAE,QAAQC,CAAQ,GAGzFA,IAAa,OAAOP,GAAc,WAAaA,EAAUF,CAAE,EAAIE,EAElE,EAjCwB,mBAyClBQ,EAAaf,EAACgB,GACnBA,EAAO,CAAC,EAAI,IAAMA,EAAO,CAAC,EAAI,IADZ,cASbC,EAAgCjB,EAACkB,GAA0B,CAChE,MAAMC,EAAM,QAAQ,OAAO,OAAA,EAE3B,MAAO,IADI,OAAOA,EAAMD,CAAK,EAAI,KACpB,QAAQ,CAAC,CAAC,IACxB,EAJsC,iCAahCE,EAAyBpB,EAAA,CAACqB,EAAeC,IAA6B,CAC3E,GAAID,EAAM,SAAW,EAAG,MAAO,GAE/B,IAAIE,EAAa,EACbC,EAAgB,EACpB,MAAMC,EAA8B,CAAA,EAC9BC,EAAWL,EAAM,CAAC,EAAE,QAAA,EAG1B,UAAWM,KAAQN,EAAO,CACzB,MAAMO,EAAWD,EAAK,QAAA,EAAYD,EAC5BG,EAAgB,KAAK,MAAMD,EAAWN,CAAQ,EAEhDG,EAAII,CAAa,EACpBJ,EAAII,CAAa,IAEjBJ,EAAII,CAAa,EAAI,CAEvB,CAGA,UAAWC,KAAOL,EAAK,CACtB,MAAMM,EAAMN,EAAIK,CAAG,EACdC,IACLR,GAAcQ,EACdP,IACD,CAGA,OAAOD,EAAaC,CACrB,EA9B+B"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { TimeMagic } from './constants/time.cjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Convert a timestamp in milliseconds to Unix timestamp (seconds)
|
|
5
|
+
* @param timestamp - Timestamp in milliseconds
|
|
6
|
+
* @returns Unix timestamp in seconds
|
|
7
|
+
* @example unix(1609459200000) // 1609459200
|
|
8
|
+
*/
|
|
9
|
+
declare const unix: (timestamp: number) => number;
|
|
10
|
+
/**
|
|
11
|
+
* Get current Unix timestamp in seconds
|
|
12
|
+
* @returns Current Unix timestamp
|
|
13
|
+
* @example unixNow() // Current time in seconds
|
|
14
|
+
*/
|
|
15
|
+
declare const unixNow: () => number;
|
|
16
|
+
/**
|
|
17
|
+
* Convert milliseconds to human readable format
|
|
18
|
+
* @param ms - Milliseconds to format
|
|
19
|
+
* @param maxParts - Maximum number of time parts to show (default: 2)
|
|
20
|
+
* @param msDisplay - What to display for very small values (default: "Just now")
|
|
21
|
+
* @returns Human readable string
|
|
22
|
+
* @example humanReadableMs(90000) // "1 minute and 30 seconds"
|
|
23
|
+
* @example humanReadableMs(3600000, 1) // "1 hour"
|
|
24
|
+
*/
|
|
25
|
+
declare const humanReadableMs: (ms: number, maxParts?: number, msDisplay?: string | ((ms: number) => string)) => string;
|
|
26
|
+
/**
|
|
27
|
+
* Convert high-resolution time to milliseconds
|
|
28
|
+
* @param hrTime - High-resolution time tuple [seconds, nanoseconds]
|
|
29
|
+
* @returns Time in milliseconds
|
|
30
|
+
* @example hrTimeToMs([1, 500000000]) // 1500 (1.5 seconds)
|
|
31
|
+
*/
|
|
32
|
+
declare const hrTimeToMs: (hrTime: [number, number]) => number;
|
|
33
|
+
/**
|
|
34
|
+
* Convert BigInt duration to human readable string
|
|
35
|
+
* @param start - Start time from process.hrtime.bigint()
|
|
36
|
+
* @returns Human readable duration string
|
|
37
|
+
* @example bigIntDurationToHumanReadable(startTime) // "123.456ms"
|
|
38
|
+
*/
|
|
39
|
+
declare const bigIntDurationToHumanReadable: (start: bigint) => string;
|
|
40
|
+
/**
|
|
41
|
+
* Calculate average occurrences per interval from an array of dates
|
|
42
|
+
* @param dates - Array of dates
|
|
43
|
+
* @param interval - Interval in milliseconds
|
|
44
|
+
* @returns Average number of occurrences per interval
|
|
45
|
+
* @example occurrencesPerInterval([date1, date2, date3], 60000) // Avg per minute
|
|
46
|
+
*/
|
|
47
|
+
declare const occurrencesPerInterval: (dates: Date[], interval: number) => number;
|
|
48
|
+
|
|
49
|
+
declare const time_TimeMagic: typeof TimeMagic;
|
|
50
|
+
declare const time_bigIntDurationToHumanReadable: typeof bigIntDurationToHumanReadable;
|
|
51
|
+
declare const time_hrTimeToMs: typeof hrTimeToMs;
|
|
52
|
+
declare const time_humanReadableMs: typeof humanReadableMs;
|
|
53
|
+
declare const time_occurrencesPerInterval: typeof occurrencesPerInterval;
|
|
54
|
+
declare const time_unix: typeof unix;
|
|
55
|
+
declare const time_unixNow: typeof unixNow;
|
|
56
|
+
declare namespace time {
|
|
57
|
+
export {
|
|
58
|
+
time_TimeMagic as TimeMagic,
|
|
59
|
+
time_bigIntDurationToHumanReadable as bigIntDurationToHumanReadable,
|
|
60
|
+
time_hrTimeToMs as hrTimeToMs,
|
|
61
|
+
time_humanReadableMs as humanReadableMs,
|
|
62
|
+
time_occurrencesPerInterval as occurrencesPerInterval,
|
|
63
|
+
time_unix as unix,
|
|
64
|
+
time_unixNow as unixNow,
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export { unixNow as a, hrTimeToMs as b, bigIntDurationToHumanReadable as c, humanReadableMs as h, occurrencesPerInterval as o, time as t, unix as u };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"time-yNkQSJnQ.cjs","sources":["../src/utils/time.ts"],"sourcesContent":["import { TimeMagic } from '../constants/time';\n\nconst unix = (timestamp: number): number =>\n\tMath.floor(timestamp / TimeMagic.MILLISECONDS_PER_SECOND);\n\nconst unixNow = (): number => unix(Date.now());\n\nconst humanReadableMs = (\n\tms: number,\n\tmaxParts = 2,\n\tmsDisplay: string | ((ms: number) => string) = 'Just now'\n): string => {\n\tconst days = (ms / TimeMagic.MILLISECONDS_PER_DAY) | 0;\n\tconst hours =\n\t\t((ms % TimeMagic.MILLISECONDS_PER_DAY) / TimeMagic.MILLISECONDS_PER_HOUR) |\n\t\t0;\n\tconst minutes =\n\t\t((ms % TimeMagic.MILLISECONDS_PER_HOUR) /\n\t\t\tTimeMagic.MILLISECONDS_PER_MINUTE) |\n\t\t0;\n\tconst seconds =\n\t\t((ms % TimeMagic.MILLISECONDS_PER_MINUTE) /\n\t\t\tTimeMagic.MILLISECONDS_PER_SECOND) |\n\t\t0;\n\n\tconst parts = [];\n\tif (days > 0) parts.push(`${days} day${days === 1 ? '' : 's'}`);\n\tif (hours > 0) parts.push(`${hours} hour${hours === 1 ? '' : 's'}`);\n\tif (minutes > 0) parts.push(`${minutes} minute${minutes === 1 ? '' : 's'}`);\n\tif (seconds > 0) parts.push(`${seconds} second${seconds === 1 ? '' : 's'}`);\n\n\tconst formattedParts = parts.slice(0, maxParts);\n\tconst lastPart = formattedParts.pop();\n\n\tif (formattedParts.length > 0) {\n\t\treturn `${formattedParts.join(', ')}${formattedParts.length > 1 ? ',' : ''} and ${lastPart}`;\n\t} else\n\t\treturn (\n\t\t\tlastPart ?? (typeof msDisplay === 'function' ? msDisplay(ms) : msDisplay)\n\t\t);\n};\n\nconst hrTimeToMs = (hrTime: [number, number]): number =>\n\thrTime[0] * 1e3 + hrTime[1] / 1e6;\n\nconst bigIntDurationToHumanReadable = (start: bigint): string => {\n\tconst end = process.hrtime.bigint();\n\tconst ms = Number(end - start) / 1e6;\n\treturn `${ms.toFixed(3)}ms`;\n};\n\nconst occurrencesPerInterval = (dates: Date[], interval: number): number => {\n\tif (dates.length === 0) return 0;\n\n\tlet totalCount = 0;\n\tlet intervalCount = 0;\n\tconst map: Record<string, number> = {};\n\tconst baseTime = dates[0].getTime();\n\n\t// Iterate through the dates and count them in their respective intervals\n\tfor (const date of dates) {\n\t\tconst timeDiff = date.getTime() - baseTime;\n\t\tconst intervalIndex = Math.floor(timeDiff / interval);\n\n\t\tif (map[intervalIndex]) {\n\t\t\tmap[intervalIndex]++;\n\t\t} else {\n\t\t\tmap[intervalIndex] = 1;\n\t\t}\n\t}\n\n\t// Calculate the total count and number of intervals\n\tfor (const key in map) {\n\t\tconst val = map[key];\n\t\tif (!val) continue;\n\t\ttotalCount += val;\n\t\tintervalCount++;\n\t}\n\n\t// Calculate the average\n\treturn totalCount / intervalCount;\n};\n\nexport {\n\tunix,\n\tunixNow,\n\thumanReadableMs,\n\thrTimeToMs,\n\tbigIntDurationToHumanReadable,\n\toccurrencesPerInterval,\n\tTimeMagic,\n};\n"],"names":["unix","__name","timestamp","TimeMagic","unixNow","humanReadableMs","ms","maxParts","msDisplay","days","hours","minutes","seconds","parts","formattedParts","lastPart","hrTimeToMs","hrTime","bigIntDurationToHumanReadable","start","end","occurrencesPerInterval","dates","interval","totalCount","intervalCount","map","baseTime","date","timeDiff","intervalIndex","key","val"],"mappings":"
|
|
1
|
+
{"version":3,"file":"time-yNkQSJnQ.cjs","sources":["../src/utils/time.ts"],"sourcesContent":["import { TimeMagic } from '../constants/time';\n\n/**\n * Convert a timestamp in milliseconds to Unix timestamp (seconds)\n * @param timestamp - Timestamp in milliseconds\n * @returns Unix timestamp in seconds\n * @example unix(1609459200000) // 1609459200\n */\nconst unix = (timestamp: number): number =>\n\tMath.floor(timestamp / TimeMagic.MILLISECONDS_PER_SECOND);\n\n/**\n * Get current Unix timestamp in seconds\n * @returns Current Unix timestamp\n * @example unixNow() // Current time in seconds\n */\nconst unixNow = (): number => unix(Date.now());\n\n/**\n * Convert milliseconds to human readable format\n * @param ms - Milliseconds to format\n * @param maxParts - Maximum number of time parts to show (default: 2)\n * @param msDisplay - What to display for very small values (default: \"Just now\")\n * @returns Human readable string\n * @example humanReadableMs(90000) // \"1 minute and 30 seconds\"\n * @example humanReadableMs(3600000, 1) // \"1 hour\"\n */\nconst humanReadableMs = (\n\tms: number,\n\tmaxParts = 2,\n\tmsDisplay: string | ((ms: number) => string) = 'Just now'\n): string => {\n\tconst days = (ms / TimeMagic.MILLISECONDS_PER_DAY) | 0;\n\tconst hours =\n\t\t((ms % TimeMagic.MILLISECONDS_PER_DAY) / TimeMagic.MILLISECONDS_PER_HOUR) |\n\t\t0;\n\tconst minutes =\n\t\t((ms % TimeMagic.MILLISECONDS_PER_HOUR) /\n\t\t\tTimeMagic.MILLISECONDS_PER_MINUTE) |\n\t\t0;\n\tconst seconds =\n\t\t((ms % TimeMagic.MILLISECONDS_PER_MINUTE) /\n\t\t\tTimeMagic.MILLISECONDS_PER_SECOND) |\n\t\t0;\n\n\tconst parts = [];\n\tif (days > 0) parts.push(`${days} day${days === 1 ? '' : 's'}`);\n\tif (hours > 0) parts.push(`${hours} hour${hours === 1 ? '' : 's'}`);\n\tif (minutes > 0) parts.push(`${minutes} minute${minutes === 1 ? '' : 's'}`);\n\tif (seconds > 0) parts.push(`${seconds} second${seconds === 1 ? '' : 's'}`);\n\n\tconst formattedParts = parts.slice(0, maxParts);\n\tconst lastPart = formattedParts.pop();\n\n\tif (formattedParts.length > 0) {\n\t\treturn `${formattedParts.join(', ')}${formattedParts.length > 1 ? ',' : ''} and ${lastPart}`;\n\t} else\n\t\treturn (\n\t\t\tlastPart ?? (typeof msDisplay === 'function' ? msDisplay(ms) : msDisplay)\n\t\t);\n};\n\n/**\n * Convert high-resolution time to milliseconds\n * @param hrTime - High-resolution time tuple [seconds, nanoseconds]\n * @returns Time in milliseconds\n * @example hrTimeToMs([1, 500000000]) // 1500 (1.5 seconds)\n */\nconst hrTimeToMs = (hrTime: [number, number]): number =>\n\thrTime[0] * 1e3 + hrTime[1] / 1e6;\n\n/**\n * Convert BigInt duration to human readable string\n * @param start - Start time from process.hrtime.bigint()\n * @returns Human readable duration string\n * @example bigIntDurationToHumanReadable(startTime) // \"123.456ms\"\n */\nconst bigIntDurationToHumanReadable = (start: bigint): string => {\n\tconst end = process.hrtime.bigint();\n\tconst ms = Number(end - start) / 1e6;\n\treturn `${ms.toFixed(3)}ms`;\n};\n\n/**\n * Calculate average occurrences per interval from an array of dates\n * @param dates - Array of dates\n * @param interval - Interval in milliseconds\n * @returns Average number of occurrences per interval\n * @example occurrencesPerInterval([date1, date2, date3], 60000) // Avg per minute\n */\nconst occurrencesPerInterval = (dates: Date[], interval: number): number => {\n\tif (dates.length === 0) return 0;\n\n\tlet totalCount = 0;\n\tlet intervalCount = 0;\n\tconst map: Record<string, number> = {};\n\tconst baseTime = dates[0].getTime();\n\n\t// Iterate through the dates and count them in their respective intervals\n\tfor (const date of dates) {\n\t\tconst timeDiff = date.getTime() - baseTime;\n\t\tconst intervalIndex = Math.floor(timeDiff / interval);\n\n\t\tif (map[intervalIndex]) {\n\t\t\tmap[intervalIndex]++;\n\t\t} else {\n\t\t\tmap[intervalIndex] = 1;\n\t\t}\n\t}\n\n\t// Calculate the total count and number of intervals\n\tfor (const key in map) {\n\t\tconst val = map[key];\n\t\tif (!val) continue;\n\t\ttotalCount += val;\n\t\tintervalCount++;\n\t}\n\n\t// Calculate the average\n\treturn totalCount / intervalCount;\n};\n\nexport {\n\tunix,\n\tunixNow,\n\thumanReadableMs,\n\thrTimeToMs,\n\tbigIntDurationToHumanReadable,\n\toccurrencesPerInterval,\n\tTimeMagic,\n};\n"],"names":["unix","__name","timestamp","TimeMagic","unixNow","humanReadableMs","ms","maxParts","msDisplay","days","hours","minutes","seconds","parts","formattedParts","lastPart","hrTimeToMs","hrTime","bigIntDurationToHumanReadable","start","end","occurrencesPerInterval","dates","interval","totalCount","intervalCount","map","baseTime","date","timeDiff","intervalIndex","key","val"],"mappings":"kIAQA,MAAMA,EAAOC,EAACC,GACb,KAAK,MAAMA,EAAYC,EAAAA,UAAU,uBAAuB,EAD5C,QAQPC,EAAUH,EAAA,IAAcD,EAAK,KAAK,KAAK,EAA7B,WAWVK,EAAkBJ,EAAA,CACvBK,EACAC,EAAW,EACXC,EAA+C,aACnC,CACZ,MAAMC,EAAQH,EAAKH,EAAAA,UAAU,qBAAwB,EAC/CO,EACHJ,EAAKH,EAAAA,UAAU,qBAAwBA,EAAAA,UAAU,sBACnD,EACKQ,EACHL,EAAKH,EAAAA,UAAU,sBAChBA,EAAAA,UAAU,wBACX,EACKS,EACHN,EAAKH,EAAAA,UAAU,wBAChBA,EAAAA,UAAU,wBACX,EAEKU,EAAQ,CAAA,EACVJ,EAAO,GAAGI,EAAM,KAAK,GAAGJ,CAAI,OAAOA,IAAS,EAAI,GAAK,GAAG,EAAE,EAC1DC,EAAQ,GAAGG,EAAM,KAAK,GAAGH,CAAK,QAAQA,IAAU,EAAI,GAAK,GAAG,EAAE,EAC9DC,EAAU,GAAGE,EAAM,KAAK,GAAGF,CAAO,UAAUA,IAAY,EAAI,GAAK,GAAG,EAAE,EACtEC,EAAU,GAAGC,EAAM,KAAK,GAAGD,CAAO,UAAUA,IAAY,EAAI,GAAK,GAAG,EAAE,EAE1E,MAAME,EAAiBD,EAAM,MAAM,EAAGN,CAAQ,EACxCQ,EAAWD,EAAe,IAAA,EAEhC,OAAIA,EAAe,OAAS,EACpB,GAAGA,EAAe,KAAK,IAAI,CAAC,GAAGA,EAAe,OAAS,EAAI,IAAM,EAAE,QAAQC,CAAQ,GAGzFA,IAAa,OAAOP,GAAc,WAAaA,EAAUF,CAAE,EAAIE,EAElE,EAjCwB,mBAyClBQ,EAAaf,EAACgB,GACnBA,EAAO,CAAC,EAAI,IAAMA,EAAO,CAAC,EAAI,IADZ,cASbC,EAAgCjB,EAACkB,GAA0B,CAChE,MAAMC,EAAM,QAAQ,OAAO,OAAA,EAE3B,MAAO,IADI,OAAOA,EAAMD,CAAK,EAAI,KACpB,QAAQ,CAAC,CAAC,IACxB,EAJsC,iCAahCE,EAAyBpB,EAAA,CAACqB,EAAeC,IAA6B,CAC3E,GAAID,EAAM,SAAW,EAAG,MAAO,GAE/B,IAAIE,EAAa,EACbC,EAAgB,EACpB,MAAMC,EAA8B,CAAA,EAC9BC,EAAWL,EAAM,CAAC,EAAE,QAAA,EAG1B,UAAWM,KAAQN,EAAO,CACzB,MAAMO,EAAWD,EAAK,QAAA,EAAYD,EAC5BG,EAAgB,KAAK,MAAMD,EAAWN,CAAQ,EAEhDG,EAAII,CAAa,EACpBJ,EAAII,CAAa,IAEjBJ,EAAII,CAAa,EAAI,CAEvB,CAGA,UAAWC,KAAOL,EAAK,CACtB,MAAMM,EAAMN,EAAIK,CAAG,EACdC,IACLR,GAAcQ,EACdP,IACD,CAGA,OAAOD,EAAaC,CACrB,EA9B+B"}
|
package/dist/utils/arrays.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";require("../strings-
|
|
1
|
+
"use strict";require("../strings-_1vAPvzS.cjs");var r=require("../arrays-bgbansWs.cjs");exports.chunk=r.chunk,exports.difference=r.difference,exports.flatten=r.flatten,exports.flattenDeep=r.flattenDeep,exports.groupBy=r.groupBy,exports.intersection=r.intersection,exports.isBooleanArray=r.isBooleanArray,exports.isNumberArray=r.isNumberArray,exports.isObjectArray=r.isObjectArray,exports.isStringArray=r.isStringArray,exports.join=r.join,exports.partition=r.partition,exports.shuffle=r.shuffle,exports.union=r.union,exports.unique=r.unique,exports.uniqueBy=r.uniqueBy;
|
|
2
2
|
//# sourceMappingURL=arrays.cjs.map
|
package/dist/utils/arrays.d.cts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { J as JoinOptions, c as chunk, d as isBooleanArray,
|
|
1
|
+
export { J as JoinOptions, c as chunk, e as difference, f as flatten, d as flattenDeep, h as groupBy, i as intersection, m as isBooleanArray, l as isNumberArray, n as isObjectArray, k as isStringArray, j as join, p as partition, s as shuffle, g as union, u as unique, b as uniqueBy } from '../arrays-DvPJ1GeR.cjs';
|
package/dist/utils/arrays.d.mts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { J as JoinOptions, c as chunk, d as isBooleanArray,
|
|
1
|
+
export { J as JoinOptions, c as chunk, e as difference, f as flatten, d as flattenDeep, h as groupBy, i as intersection, m as isBooleanArray, l as isNumberArray, n as isObjectArray, k as isStringArray, j as join, p as partition, s as shuffle, g as union, u as unique, b as uniqueBy } from '../arrays-DvPJ1GeR.mjs';
|
package/dist/utils/arrays.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../strings-
|
|
1
|
+
import"../strings-CrzGdnZH.mjs";import{c as r,e as i,f as n,d as t,h as o,i as u,m as f,l as p,n as y,k as c,j as l,p as m,s as A,g as b,u as g,b as h}from"../arrays-6DA6GfsQ.mjs";export{r as chunk,i as difference,n as flatten,t as flattenDeep,o as groupBy,u as intersection,f as isBooleanArray,p as isNumberArray,y as isObjectArray,c as isStringArray,l as join,m as partition,A as shuffle,b as union,g as unique,h as uniqueBy};
|
|
2
2
|
//# sourceMappingURL=arrays.mjs.map
|
package/dist/utils/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var r=require("../arrays-
|
|
1
|
+
"use strict";var r=require("../arrays-bgbansWs.cjs"),e=require("../files-m1nnj5gT.cjs"),i=require("../mime-types-BmvBrrZ7.cjs"),s=require("../numbers-B_mptknO.cjs"),t=require("../objects-wcO6hNA8.cjs"),u=require("../random-668tofPV.cjs"),l=require("../runtime-Bfs-yn_-.cjs"),a=require("../strings-_1vAPvzS.cjs"),m=require("../time-yNkQSJnQ.cjs");require("node:fs"),require("node:path"),require("../constants/bytes.cjs"),require("../constants/time.cjs"),exports.ArrayUtils=r.arrays,exports.FileUtils=e.files,exports.MimeTypeUtils=i.mimeTypes,exports.NumberUtils=s.numbers,exports.ObjectUtils=t.objects,exports.RandomUtils=u.random,exports.RuntimeUtils=l.runtime,exports.StringUtils=a.strings,exports.TimeUtils=m.time;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|