toolbox-x 1.2.1 → 2.0.1
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/{Color-Dsut0Bex.d.cts → Color-BCsnSEmt.d.cts} +1 -1
- package/dist/{Color-DCfoQk_-.d.mts → Color-CKmhtXdG.d.mts} +1 -1
- package/dist/{Stylog-DXZtHAbp.d.mts → Stylog-CXpN-oeY.d.mts} +5 -5
- package/dist/{Stylog-TyLCTRtT.d.cts → Stylog-DJOVxym_.d.cts} +5 -5
- package/dist/{area-CcRQ6TfR.d.cts → area-CHhwLR12.d.cts} +3 -3
- package/dist/{area-CvSC96va.d.mts → area-DOqFLNcr.d.mts} +3 -3
- package/dist/{array-B6jWzJ4F.d.mts → array-BNbTIBni.d.mts} +1 -1
- package/dist/{array-CqDu610k.d.cts → array-CL3apdfa.d.cts} +1 -1
- package/dist/{basics-KobRNhV-.d.cts → basics-B9aytOct.d.cts} +5 -5
- package/dist/{basics-V5M2oltn.d.mts → basics-BNQqY5WD.d.mts} +5 -5
- package/dist/{basics-K8BDSYD6.cjs → basics-CJmdhXoo.cjs} +567 -14
- package/dist/{basics-1_M7UvCn.mjs → basics-CebgkY-n.mjs} +449 -16
- package/dist/{case-uKFzt5TY.cjs → case-Bd7QLHYw.cjs} +3 -3
- package/dist/{case-KdrBKjjK.d.mts → case-Bkkm6Mqi.d.mts} +12 -12
- package/dist/{case-BQwn5N-k.mjs → case-DBC4Rj0h.mjs} +3 -3
- package/dist/{case--Vjea9DS.d.cts → case-DFD3Ml1p.d.cts} +12 -12
- package/dist/change-case.cjs +1 -1
- package/dist/change-case.d.cts +1 -1
- package/dist/change-case.d.mts +1 -1
- package/dist/change-case.mjs +1 -1
- package/dist/colors.d.cts +2 -2
- package/dist/colors.d.mts +2 -2
- package/dist/{constants-C4RW7Lei.cjs → constants-Dz5vxNQ9.cjs} +37 -0
- package/dist/{constants-rNhoy4DH.mjs → constants-j-iXjwDl.mjs} +32 -1
- package/dist/constants.cjs +1 -1
- package/dist/constants.d.cts +1 -1
- package/dist/constants.d.mts +1 -1
- package/dist/constants.mjs +1 -1
- package/dist/converter.cjs +2 -2
- package/dist/converter.d.cts +2 -2
- package/dist/converter.d.mts +2 -2
- package/dist/converter.mjs +2 -2
- package/dist/date.cjs +51 -10
- package/dist/date.d.cts +22 -5
- package/dist/date.d.mts +22 -5
- package/dist/date.mjs +49 -11
- package/dist/dom.cjs +5 -6
- package/dist/dom.d.cts +3 -3
- package/dist/dom.d.mts +3 -3
- package/dist/dom.mjs +4 -5
- package/dist/{form-DoQGMTOc.d.mts → form-CC9T9WnX.d.cts} +2 -2
- package/dist/{form-mP-nl8EC.d.cts → form-CheKmgjj.d.mts} +2 -2
- package/dist/guards-B2s2wlVN.mjs +425 -0
- package/dist/{guards-C0smSAKC.mjs → guards-BK1QuvFZ.mjs} +2 -2
- package/dist/{guards-ClGDJrQp.cjs → guards-Bsh6Bfdq.cjs} +2 -2
- package/dist/{guards-0VjySrPM.cjs → guards-DMJcjPDt.cjs} +279 -3
- package/dist/guards.cjs +9 -8
- package/dist/guards.d.cts +6 -5
- package/dist/guards.d.mts +6 -5
- package/dist/guards.mjs +5 -5
- package/dist/{hash-BcoFHSu1.d.cts → hash-C0Wr7H8v.d.mts} +1 -1
- package/dist/{hash-GYRx2ee_.d.mts → hash-DJ8b9VHB.d.cts} +1 -1
- package/dist/hash.cjs +8 -8
- package/dist/hash.d.cts +8 -8
- package/dist/hash.d.mts +8 -8
- package/dist/hash.mjs +4 -5
- package/dist/{http-status-xrlR-LlB.d.mts → http-status-BSee6mB5.d.mts} +1 -1
- package/dist/{http-status-C0DOpCDf.d.cts → http-status-DJn87B_Y.d.cts} +1 -1
- package/dist/http-status.cjs +4 -4
- package/dist/http-status.d.cts +6 -6
- package/dist/http-status.d.mts +6 -6
- package/dist/http-status.mjs +4 -4
- package/dist/index-01oaUuP6.d.mts +292 -0
- package/dist/index-CgwlWrZM.d.cts +292 -0
- package/dist/index.cjs +67 -248
- package/dist/index.d.cts +25 -280
- package/dist/index.d.mts +25 -280
- package/dist/index.mjs +11 -194
- package/dist/{object-ChFVh95z.d.cts → object-Mglyg4AW.d.cts} +28 -1
- package/dist/{object-ChFVh95z.d.mts → object-Mglyg4AW.d.mts} +28 -1
- package/dist/{objectify-DEnFpPt1.mjs → objectify-CQa8gQib.mjs} +3 -4
- package/dist/{objectify-DewBSJP_.cjs → objectify-xQvZS3UI.cjs} +5 -6
- package/dist/paginator.d.cts +1 -1
- package/dist/paginator.d.mts +1 -1
- package/dist/{parse-DovagZFA.cjs → parse-BWu3UbOk.cjs} +4 -4
- package/dist/{parse-BhZ6-tKg.mjs → parse-CNDdS-sy.mjs} +4 -4
- package/dist/{pluralizer-CdG-VJ6t.d.cts → pluralizer-BGMC8LLz.d.cts} +1 -1
- package/dist/{pluralizer-D2Lh8CdU.d.mts → pluralizer-CQNzRhwR.d.mts} +1 -1
- package/dist/pluralizer.cjs +6 -6
- package/dist/pluralizer.d.cts +6 -6
- package/dist/pluralizer.d.mts +6 -6
- package/dist/pluralizer.mjs +6 -6
- package/dist/{specials-Cye93-uo.mjs → specials-Hq5Ncd6y.mjs} +2 -2
- package/dist/{specials-BM6cx43o.cjs → specials-dkYP1Nh2.cjs} +2 -2
- package/dist/{string-Dq2b8rcN.d.cts → string-BDwBuik3.d.cts} +4 -2
- package/dist/{string-CkwTVFeL.d.mts → string-_1ImwUJT.d.mts} +4 -2
- package/dist/stylog.cjs +5 -5
- package/dist/stylog.d.cts +2 -2
- package/dist/stylog.d.mts +2 -2
- package/dist/stylog.mjs +5 -5
- package/dist/types/array.d.cts +1 -1
- package/dist/types/array.d.mts +1 -1
- package/dist/types/colors.d.cts +1 -1
- package/dist/types/colors.d.mts +1 -1
- package/dist/types/converter.d.cts +1 -1
- package/dist/types/converter.d.mts +1 -1
- package/dist/types/date.d.cts +2 -2
- package/dist/types/date.d.mts +2 -2
- package/dist/types/form.d.cts +1 -1
- package/dist/types/form.d.mts +1 -1
- package/dist/types/hash.d.cts +1 -1
- package/dist/types/hash.d.mts +1 -1
- package/dist/types/http-status.d.cts +1 -1
- package/dist/types/http-status.d.mts +1 -1
- package/dist/types/index.d.cts +2 -2
- package/dist/types/index.d.mts +2 -2
- package/dist/types/number.d.cts +1 -1
- package/dist/types/number.d.mts +1 -1
- package/dist/types/object.d.cts +2 -2
- package/dist/types/object.d.mts +2 -2
- package/dist/types/pluralizer.d.cts +1 -1
- package/dist/types/pluralizer.d.mts +1 -1
- package/dist/types/string.d.cts +2 -2
- package/dist/types/string.d.mts +2 -2
- package/dist/types/stylog.d.cts +1 -1
- package/dist/types/stylog.d.mts +1 -1
- package/dist/types/utils.d.cts +1 -1
- package/dist/types/utils.d.mts +1 -1
- package/dist/{utilities-CzyXCRHM.cjs → utilities-CWV1GPGY.cjs} +1 -1
- package/dist/{utilities-B9axOvOX.mjs → utilities-DPscNbS1.mjs} +1 -1
- package/dist/{uuid-DgTBxcVu.d.cts → uuid-CiJtSUbo.d.cts} +3 -3
- package/dist/{uuid-Yc3Uu8qr.d.mts → uuid-D-gjPs4Q.d.mts} +3 -3
- package/dist/verbalizer.cjs +3 -3
- package/dist/verbalizer.d.cts +3 -3
- package/dist/verbalizer.d.mts +3 -3
- package/dist/verbalizer.mjs +3 -3
- package/package.json +7 -6
- package/dist/guards-DeO4ukiK.mjs +0 -221
- package/dist/utils-BxguWSoa.cjs +0 -568
- package/dist/utils-DXovsTKs.mjs +0 -449
|
@@ -132,11 +132,11 @@ function convertStringCase(value, format, options) {
|
|
|
132
132
|
return start.concat(body, end);
|
|
133
133
|
}
|
|
134
134
|
case "snake_case": {
|
|
135
|
-
const body = tokens.map(
|
|
135
|
+
const body = tokens.map(lowerCase).join("_");
|
|
136
136
|
return start.concat(body, end);
|
|
137
137
|
}
|
|
138
138
|
case "kebab-case": {
|
|
139
|
-
const body = tokens.map(
|
|
139
|
+
const body = tokens.map(lowerCase).join("-");
|
|
140
140
|
return start.concat(body, end);
|
|
141
141
|
}
|
|
142
142
|
case "Title Case": {
|
|
@@ -195,7 +195,7 @@ function _getDelimiterRegex(delims) {
|
|
|
195
195
|
/** Normalizes delimiters + splits the string */
|
|
196
196
|
function _normalizeDelimiters(str, delims) {
|
|
197
197
|
const delRegExp = _getDelimiterRegex(delims);
|
|
198
|
-
return str.replace(/(\p{Ll}?\d+|(?<=\p{Lu}))(\p{Lu})/gu, "$1 $2").replace(delRegExp, " ").replace(/\s+/g, " ").trim().split(" ").filter(Boolean);
|
|
198
|
+
return str.replace(/(\p{Ll}?\d+|(?<=\p{Lu}|\p{Ll}))(\p{Lu})/gu, "$1 $2").replace(delRegExp, " ").replace(/\s+/g, " ").trim().split(" ").filter(Boolean);
|
|
199
199
|
}
|
|
200
200
|
/** Capitalize a string (first letter capital, rest lowercase) */
|
|
201
201
|
function _capitalize(str) {
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import { B as
|
|
17
|
+
import { A as KebabCase, B as StringCaseOptions, E as DotCase, H as TrainCase, L as SentenceCase, M as PascalCase, N as PascalSnakeCase, P as PathCase, R as SnakeCase, V as TitleCase, _ as ConstantCase, h as CaseFormat, m as CapitalizeOptions, p as CamelCase, u as $WidenEmpty } from "./string-BDwBuik3.cjs";
|
|
18
18
|
|
|
19
19
|
//#region src/string/case.d.ts
|
|
20
20
|
/**
|
|
@@ -124,7 +124,7 @@ declare function capitalizeString(string: string, options?: CapitalizeOptions):
|
|
|
124
124
|
* @param del Additional delimiter characters to recognize.
|
|
125
125
|
* @returns The `camelCase` formatted string.
|
|
126
126
|
*/
|
|
127
|
-
declare function toCamelCase<Str extends string, Del extends string = ''>(str: Str, ...del: Del[]): CamelCase<Str, Del
|
|
127
|
+
declare function toCamelCase<Str extends string, Del extends string = ''>(str: Str, ...del: Del[]): $WidenEmpty<CamelCase<Str, Del>>;
|
|
128
128
|
/**
|
|
129
129
|
* * Converts a string into `PascalCase`, using the optional custom delimiters in addition to the default delimiters.
|
|
130
130
|
*
|
|
@@ -145,7 +145,7 @@ declare function toCamelCase<Str extends string, Del extends string = ''>(str: S
|
|
|
145
145
|
* @param del Additional delimiter characters to recognize.
|
|
146
146
|
* @returns The `PascalCase` formatted string.
|
|
147
147
|
*/
|
|
148
|
-
declare function toPascalCase<Str extends string, Del extends string = ''>(str: Str, ...del: Del[]): PascalCase<Str, Del
|
|
148
|
+
declare function toPascalCase<Str extends string, Del extends string = ''>(str: Str, ...del: Del[]): $WidenEmpty<PascalCase<Str, Del>>;
|
|
149
149
|
/**
|
|
150
150
|
* * Converts a string into `snake_case`, using the optional custom delimiters in addition to the default delimiters.
|
|
151
151
|
*
|
|
@@ -165,7 +165,7 @@ declare function toPascalCase<Str extends string, Del extends string = ''>(str:
|
|
|
165
165
|
* @param del Additional delimiter characters to recognize.
|
|
166
166
|
* @returns The `snake_case` formatted string.
|
|
167
167
|
*/
|
|
168
|
-
declare function toSnakeCase<Str extends string, Del extends string = ''>(str: Str, ...del: Del[]): SnakeCase<Str, Del
|
|
168
|
+
declare function toSnakeCase<Str extends string, Del extends string = ''>(str: Str, ...del: Del[]): $WidenEmpty<SnakeCase<Str, Del>>;
|
|
169
169
|
/**
|
|
170
170
|
* * Converts a string into `kebab-case`, using the optional custom delimiters in addition to the default delimiters.
|
|
171
171
|
*
|
|
@@ -185,7 +185,7 @@ declare function toSnakeCase<Str extends string, Del extends string = ''>(str: S
|
|
|
185
185
|
* @param del Additional delimiter characters to recognize.
|
|
186
186
|
* @returns The `kebab-case` formatted string.
|
|
187
187
|
*/
|
|
188
|
-
declare function toKebabCase<Str extends string, Del extends string = ''>(str: Str, ...del: Del[]): KebabCase<Str, Del
|
|
188
|
+
declare function toKebabCase<Str extends string, Del extends string = ''>(str: Str, ...del: Del[]): $WidenEmpty<KebabCase<Str, Del>>;
|
|
189
189
|
/**
|
|
190
190
|
* * Converts a string into `Train-Case`, using the optional custom delimiters in addition to the default delimiters.
|
|
191
191
|
*
|
|
@@ -204,7 +204,7 @@ declare function toKebabCase<Str extends string, Del extends string = ''>(str: S
|
|
|
204
204
|
* @param del Additional delimiter characters to recognize.
|
|
205
205
|
* @returns The `Train-Case` formatted string.
|
|
206
206
|
*/
|
|
207
|
-
declare function toTrainCase<Str extends string, Del extends string = ''>(str: Str, ...del: Del[]): TrainCase<Str, Del
|
|
207
|
+
declare function toTrainCase<Str extends string, Del extends string = ''>(str: Str, ...del: Del[]): $WidenEmpty<TrainCase<Str, Del>>;
|
|
208
208
|
/**
|
|
209
209
|
* * Converts a string into `dot.case`, using the optional custom delimiters in addition to the default delimiters.
|
|
210
210
|
*
|
|
@@ -223,7 +223,7 @@ declare function toTrainCase<Str extends string, Del extends string = ''>(str: S
|
|
|
223
223
|
* @param del Additional delimiter characters to recognize.
|
|
224
224
|
* @returns The `dot.case` formatted string.
|
|
225
225
|
*/
|
|
226
|
-
declare function toDotCase<Str extends string, Del extends string = ''>(str: Str, ...del: Del[]): DotCase<Str, Del
|
|
226
|
+
declare function toDotCase<Str extends string, Del extends string = ''>(str: Str, ...del: Del[]): $WidenEmpty<DotCase<Str, Del>>;
|
|
227
227
|
/**
|
|
228
228
|
* * Converts a string into `path/case`, using the optional custom delimiters in addition to the default delimiters.
|
|
229
229
|
*
|
|
@@ -242,7 +242,7 @@ declare function toDotCase<Str extends string, Del extends string = ''>(str: Str
|
|
|
242
242
|
* @param del Additional delimiter characters to recognize.
|
|
243
243
|
* @returns The `path/case` formatted string.
|
|
244
244
|
*/
|
|
245
|
-
declare function toPathCase<Str extends string, Del extends string = ''>(str: Str, ...del: Del[]): PathCase<Str, Del
|
|
245
|
+
declare function toPathCase<Str extends string, Del extends string = ''>(str: Str, ...del: Del[]): $WidenEmpty<PathCase<Str, Del>>;
|
|
246
246
|
/**
|
|
247
247
|
* * Converts a string into `CONSTANT_CASE`, using the optional custom delimiters in addition to the default delimiters.
|
|
248
248
|
*
|
|
@@ -261,7 +261,7 @@ declare function toPathCase<Str extends string, Del extends string = ''>(str: St
|
|
|
261
261
|
* @param del Additional delimiter characters to recognize.
|
|
262
262
|
* @returns The `CONSTANT_CASE` formatted string.
|
|
263
263
|
*/
|
|
264
|
-
declare function toConstantCase<Str extends string, Del extends string = ''>(str: Str, ...del: Del[]): ConstantCase<Str, Del
|
|
264
|
+
declare function toConstantCase<Str extends string, Del extends string = ''>(str: Str, ...del: Del[]): $WidenEmpty<ConstantCase<Str, Del>>;
|
|
265
265
|
/**
|
|
266
266
|
* * Converts a string into `Pascal_Snake_Case`, using the optional custom delimiters in addition to the default delimiters.
|
|
267
267
|
*
|
|
@@ -280,7 +280,7 @@ declare function toConstantCase<Str extends string, Del extends string = ''>(str
|
|
|
280
280
|
* @param del Additional delimiter characters to recognize.
|
|
281
281
|
* @returns The `Pascal_Snake_Case` formatted string.
|
|
282
282
|
*/
|
|
283
|
-
declare function toPascalSnakeCase<Str extends string, Del extends string = ''>(str: Str, ...del: Del[]): PascalSnakeCase<Str, Del
|
|
283
|
+
declare function toPascalSnakeCase<Str extends string, Del extends string = ''>(str: Str, ...del: Del[]): $WidenEmpty<PascalSnakeCase<Str, Del>>;
|
|
284
284
|
/**
|
|
285
285
|
* * Converts a string into `Title Case`, using the optional custom delimiters in addition to the default delimiters.
|
|
286
286
|
*
|
|
@@ -301,7 +301,7 @@ declare function toPascalSnakeCase<Str extends string, Del extends string = ''>(
|
|
|
301
301
|
* @param del Additional delimiter characters to recognize.
|
|
302
302
|
* @returns The `Title Case` formatted string.
|
|
303
303
|
*/
|
|
304
|
-
declare function toTitleCase<Str extends string, Del extends string = ''>(str: Str, ...del: Del[]): TitleCase<Str, Del
|
|
304
|
+
declare function toTitleCase<Str extends string, Del extends string = ''>(str: Str, ...del: Del[]): $WidenEmpty<TitleCase<Str, Del>>;
|
|
305
305
|
/**
|
|
306
306
|
* * Converts a string into `Sentence case`, using the optional custom delimiters in addition to the default delimiters.
|
|
307
307
|
*
|
|
@@ -322,6 +322,6 @@ declare function toTitleCase<Str extends string, Del extends string = ''>(str: S
|
|
|
322
322
|
* @param del Additional delimiter characters to recognize.
|
|
323
323
|
* @returns The `Sentence case` formatted string.
|
|
324
324
|
*/
|
|
325
|
-
declare function toSentenceCase<Str extends string, Del extends string = ''>(str: Str, ...del: Del[]): SentenceCase<Str, Del
|
|
325
|
+
declare function toSentenceCase<Str extends string, Del extends string = ''>(str: Str, ...del: Del[]): $WidenEmpty<SentenceCase<Str, Del>>;
|
|
326
326
|
//#endregion
|
|
327
327
|
export { toDotCase as a, toPascalSnakeCase as c, toSnakeCase as d, toTitleCase as f, toConstantCase as i, toPathCase as l, convertStringCase as n, toKebabCase as o, toTrainCase as p, toCamelCase as r, toPascalCase as s, capitalizeString as t, toSentenceCase as u };
|
package/dist/change-case.cjs
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
18
|
-
const require_case = require('./case-
|
|
18
|
+
const require_case = require('./case-Bd7QLHYw.cjs');
|
|
19
19
|
|
|
20
20
|
exports.capitalizeString = require_case.capitalizeString;
|
|
21
21
|
exports.convertStringCase = require_case.convertStringCase;
|
package/dist/change-case.d.cts
CHANGED
|
@@ -14,5 +14,5 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import { a as toDotCase, c as toPascalSnakeCase, d as toSnakeCase, f as toTitleCase, i as toConstantCase, l as toPathCase, n as convertStringCase, o as toKebabCase, p as toTrainCase, r as toCamelCase, s as toPascalCase, t as capitalizeString, u as toSentenceCase } from "./case
|
|
17
|
+
import { a as toDotCase, c as toPascalSnakeCase, d as toSnakeCase, f as toTitleCase, i as toConstantCase, l as toPathCase, n as convertStringCase, o as toKebabCase, p as toTrainCase, r as toCamelCase, s as toPascalCase, t as capitalizeString, u as toSentenceCase } from "./case-DFD3Ml1p.cjs";
|
|
18
18
|
export { capitalizeString, convertStringCase, toCamelCase, toConstantCase, toDotCase, toKebabCase, toPascalCase, toPascalSnakeCase, toPathCase, toSentenceCase, toSnakeCase, toTitleCase, toTrainCase };
|
package/dist/change-case.d.mts
CHANGED
|
@@ -14,5 +14,5 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import { a as toDotCase, c as toPascalSnakeCase, d as toSnakeCase, f as toTitleCase, i as toConstantCase, l as toPathCase, n as convertStringCase, o as toKebabCase, p as toTrainCase, r as toCamelCase, s as toPascalCase, t as capitalizeString, u as toSentenceCase } from "./case-
|
|
17
|
+
import { a as toDotCase, c as toPascalSnakeCase, d as toSnakeCase, f as toTitleCase, i as toConstantCase, l as toPathCase, n as convertStringCase, o as toKebabCase, p as toTrainCase, r as toCamelCase, s as toPascalCase, t as capitalizeString, u as toSentenceCase } from "./case-Bkkm6Mqi.mjs";
|
|
18
18
|
export { capitalizeString, convertStringCase, toCamelCase, toConstantCase, toDotCase, toKebabCase, toPascalCase, toPascalSnakeCase, toPathCase, toSentenceCase, toSnakeCase, toTitleCase, toTrainCase };
|
package/dist/change-case.mjs
CHANGED
|
@@ -14,6 +14,6 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import { a as toDotCase, c as toPascalSnakeCase, d as toSnakeCase, f as toTitleCase, i as toConstantCase, l as toPathCase, n as convertStringCase, o as toKebabCase, p as toTrainCase, r as toCamelCase, s as toPascalCase, t as capitalizeString, u as toSentenceCase } from "./case-
|
|
17
|
+
import { a as toDotCase, c as toPascalSnakeCase, d as toSnakeCase, f as toTitleCase, i as toConstantCase, l as toPathCase, n as convertStringCase, o as toKebabCase, p as toTrainCase, r as toCamelCase, s as toPascalCase, t as capitalizeString, u as toSentenceCase } from "./case-DBC4Rj0h.mjs";
|
|
18
18
|
|
|
19
19
|
export { capitalizeString, convertStringCase, toCamelCase, toConstantCase, toDotCase, toKebabCase, toPascalCase, toPascalSnakeCase, toPathCase, toSentenceCase, toSnakeCase, toTitleCase, toTrainCase };
|
package/dist/colors.d.cts
CHANGED
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import {
|
|
18
|
-
import { C as RandomColorOptions, S as RandomColor, T as SolidValues, _ as Hex, a as AlphaValues, b as RGB, g as HSLA, h as HSL, l as ColorInputArray, n as $ColorType, t as Color, v as Hex6, x as RGBA, y as Hex8 } from "./Color-
|
|
17
|
+
import { $n as Percent } from "./object-Mglyg4AW.cjs";
|
|
18
|
+
import { C as RandomColorOptions, S as RandomColor, T as SolidValues, _ as Hex, a as AlphaValues, b as RGB, g as HSLA, h as HSL, l as ColorInputArray, n as $ColorType, t as Color, v as Hex6, x as RGBA, y as Hex8 } from "./Color-BCsnSEmt.cjs";
|
|
19
19
|
|
|
20
20
|
//#region src/colors/convert.d.ts
|
|
21
21
|
/**
|
package/dist/colors.d.mts
CHANGED
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import {
|
|
18
|
-
import { C as RandomColorOptions, S as RandomColor, T as SolidValues, _ as Hex, a as AlphaValues, b as RGB, g as HSLA, h as HSL, l as ColorInputArray, n as $ColorType, t as Color, v as Hex6, x as RGBA, y as Hex8 } from "./Color-
|
|
17
|
+
import { $n as Percent } from "./object-Mglyg4AW.mjs";
|
|
18
|
+
import { C as RandomColorOptions, S as RandomColor, T as SolidValues, _ as Hex, a as AlphaValues, b as RGB, g as HSLA, h as HSL, l as ColorInputArray, n as $ColorType, t as Color, v as Hex6, x as RGBA, y as Hex8 } from "./Color-CKmhtXdG.mjs";
|
|
19
19
|
|
|
20
20
|
//#region src/colors/convert.d.ts
|
|
21
21
|
/**
|
|
@@ -167,6 +167,37 @@ const MS_MAP = /* @__PURE__ */ Object.freeze((() => {
|
|
|
167
167
|
milliseconds: 1
|
|
168
168
|
};
|
|
169
169
|
})());
|
|
170
|
+
/** Array of relative time divisions */
|
|
171
|
+
const RELATIVE_TIME_DIVISIONS = [
|
|
172
|
+
{
|
|
173
|
+
amount: 60,
|
|
174
|
+
name: "seconds"
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
amount: 60,
|
|
178
|
+
name: "minutes"
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
amount: 24,
|
|
182
|
+
name: "hours"
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
amount: 7,
|
|
186
|
+
name: "days"
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
amount: 4.34524,
|
|
190
|
+
name: "weeks"
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
amount: 12,
|
|
194
|
+
name: "months"
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
amount: Number.POSITIVE_INFINITY,
|
|
198
|
+
name: "years"
|
|
199
|
+
}
|
|
200
|
+
];
|
|
170
201
|
|
|
171
202
|
//#endregion
|
|
172
203
|
Object.defineProperty(exports, 'DAYS', {
|
|
@@ -187,6 +218,12 @@ Object.defineProperty(exports, 'MS_MAP', {
|
|
|
187
218
|
return MS_MAP;
|
|
188
219
|
}
|
|
189
220
|
});
|
|
221
|
+
Object.defineProperty(exports, 'RELATIVE_TIME_DIVISIONS', {
|
|
222
|
+
enumerable: true,
|
|
223
|
+
get: function () {
|
|
224
|
+
return RELATIVE_TIME_DIVISIONS;
|
|
225
|
+
}
|
|
226
|
+
});
|
|
190
227
|
Object.defineProperty(exports, 'SORTED_TIME_FORMATS', {
|
|
191
228
|
enumerable: true,
|
|
192
229
|
get: function () {
|
|
@@ -166,6 +166,37 @@ const MS_MAP = /* @__PURE__ */ Object.freeze((() => {
|
|
|
166
166
|
milliseconds: 1
|
|
167
167
|
};
|
|
168
168
|
})());
|
|
169
|
+
/** Array of relative time divisions */
|
|
170
|
+
const RELATIVE_TIME_DIVISIONS = [
|
|
171
|
+
{
|
|
172
|
+
amount: 60,
|
|
173
|
+
name: "seconds"
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
amount: 60,
|
|
177
|
+
name: "minutes"
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
amount: 24,
|
|
181
|
+
name: "hours"
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
amount: 7,
|
|
185
|
+
name: "days"
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
amount: 4.34524,
|
|
189
|
+
name: "weeks"
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
amount: 12,
|
|
193
|
+
name: "months"
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
amount: Number.POSITIVE_INFINITY,
|
|
197
|
+
name: "years"
|
|
198
|
+
}
|
|
199
|
+
];
|
|
169
200
|
|
|
170
201
|
//#endregion
|
|
171
|
-
export {
|
|
202
|
+
export { SORTED_TIME_FORMATS as a, RELATIVE_TIME_DIVISIONS as i, MONTHS as n, VEDIC_ZODIAC_SIGNS as o, MS_MAP as r, WESTERN_ZODIAC_SIGNS as s, DAYS as t };
|
package/dist/constants.cjs
CHANGED
|
@@ -18,7 +18,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
18
18
|
const require_constants = require('./constants-D_HkIg02.cjs');
|
|
19
19
|
const require_css_colors = require('./css-colors-DC7oZ46Y.cjs');
|
|
20
20
|
const require_constants$1 = require('./constants-BOs8tjzp.cjs');
|
|
21
|
-
const require_constants$2 = require('./constants-
|
|
21
|
+
const require_constants$2 = require('./constants-Dz5vxNQ9.cjs');
|
|
22
22
|
const require_timezone = require('./timezone-CSz7R0L6.cjs');
|
|
23
23
|
const require_constants$3 = require('./constants-B3nc8psr.cjs');
|
|
24
24
|
const require_constants$4 = require('./constants-DIBRCBIP.cjs');
|
package/dist/constants.d.cts
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
import { t as LOWERCASE } from "./constants-C7wERz5m.cjs";
|
|
18
|
-
import { Ci as
|
|
18
|
+
import { Ci as TIME_ZONE_LABELS, Di as WESTERN_ZODIAC_SIGNS, Ei as VEDIC_ZODIAC_SIGNS, Oi as COUNTRIES, Si as TIME_ZONE_IDS, Ti as MONTHS, _i as UNITS$1, bi as TIME_ZONES, gi as LOCALE_CODES, hi as FRANKFURTER_CURRENCIES, mi as CURRENCY_LOCALES, pi as CURRENCY_CODES, vi as IANA_TZ_IDS, wi as DAYS, xi as TIME_ZONES_NATIVE, yi as NATIVE_TZ_IDS } from "./object-Mglyg4AW.cjs";
|
|
19
19
|
import { t as CSS_COLORS } from "./css-colors-Dqz6Bfnp.cjs";
|
|
20
20
|
import { t as UNITS } from "./constants-D8RzBjsL.cjs";
|
|
21
21
|
import { t as HTTP_STATUS_CODES } from "./constants-DNIXgBkz.cjs";
|
package/dist/constants.d.mts
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
import { t as LOWERCASE } from "./constants-C7wERz5m.mjs";
|
|
18
|
-
import { Ci as
|
|
18
|
+
import { Ci as TIME_ZONE_LABELS, Di as WESTERN_ZODIAC_SIGNS, Ei as VEDIC_ZODIAC_SIGNS, Oi as COUNTRIES, Si as TIME_ZONE_IDS, Ti as MONTHS, _i as UNITS$1, bi as TIME_ZONES, gi as LOCALE_CODES, hi as FRANKFURTER_CURRENCIES, mi as CURRENCY_LOCALES, pi as CURRENCY_CODES, vi as IANA_TZ_IDS, wi as DAYS, xi as TIME_ZONES_NATIVE, yi as NATIVE_TZ_IDS } from "./object-Mglyg4AW.mjs";
|
|
19
19
|
import { t as CSS_COLORS } from "./css-colors-Dqz6Bfnp.mjs";
|
|
20
20
|
import { t as UNITS } from "./constants-D8RzBjsL.mjs";
|
|
21
21
|
import { t as HTTP_STATUS_CODES } from "./constants-DNIXgBkz.mjs";
|
package/dist/constants.mjs
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
import { t as LOWERCASE } from "./constants-B0zJiNqH.mjs";
|
|
18
18
|
import { t as CSS_COLORS } from "./css-colors-B-y4TmeC.mjs";
|
|
19
19
|
import { n as NUMBER_COLOR_PALETTE, t as ALPHABET_COLOR_PALETTE } from "./constants-DCZL77t-.mjs";
|
|
20
|
-
import {
|
|
20
|
+
import { n as MONTHS, o as VEDIC_ZODIAC_SIGNS, s as WESTERN_ZODIAC_SIGNS, t as DAYS } from "./constants-j-iXjwDl.mjs";
|
|
21
21
|
import { a as TIME_ZONE_IDS, i as TIME_ZONES_NATIVE, n as NATIVE_TZ_IDS, o as TIME_ZONE_LABELS, r as TIME_ZONES, t as IANA_TZ_IDS } from "./timezone-avZ4TvDx.mjs";
|
|
22
22
|
import { a as LOCALE_CODES, i as FRANKFURTER_CURRENCIES, n as CURRENCY_CODES, p as UNITS$1, r as CURRENCY_LOCALES } from "./constants-ZyfpysiQ.mjs";
|
|
23
23
|
import { r as UNITS } from "./constants-ByLTHWQm.mjs";
|
package/dist/converter.cjs
CHANGED
|
@@ -97,7 +97,7 @@ var $BaseConverter = class {
|
|
|
97
97
|
*
|
|
98
98
|
* @remarks
|
|
99
99
|
* - This method is automatically called when the instance is used in a string context.
|
|
100
|
-
* - For complex and versatile pluralization, please refer to {@link https://toolbox-x.nazmul-nhb.dev/docs/
|
|
100
|
+
* - For complex and versatile pluralization, please refer to {@link https://toolbox-x.nazmul-nhb.dev/docs/utils/string/pluralizer pluralizer} or {@link https://toolbox-x.nazmul-nhb.dev/docs/classes/pluralizer Pluralizer Class} instead.
|
|
101
101
|
*/
|
|
102
102
|
toString() {
|
|
103
103
|
return this.$withPluralUnit();
|
|
@@ -177,7 +177,7 @@ var $BaseConverter = class {
|
|
|
177
177
|
* @param decimals Number of decimal places for fractional value.
|
|
178
178
|
* @returns Formatted string with proper unit pluralization.
|
|
179
179
|
*
|
|
180
|
-
* @remarks For complex and versatile pluralization, please refer to {@link https://toolbox-x.nazmul-nhb.dev/docs/
|
|
180
|
+
* @remarks For complex and versatile pluralization, please refer to {@link https://toolbox-x.nazmul-nhb.dev/docs/utils/string/pluralizer pluralizer} or {@link https://toolbox-x.nazmul-nhb.dev/docs/classes/pluralizer Pluralizer Class} instead.
|
|
181
181
|
*/
|
|
182
182
|
format(decimals = 2) {
|
|
183
183
|
return this.$withPluralUnit(this.$round(this.value, decimals));
|
package/dist/converter.d.cts
CHANGED
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import {
|
|
18
|
-
import { C as $Length, S as $Mass, b as $Time, c as $Unit, f as Converted, t as $Area, w as $Data, x as $Temperature, y as $Volume } from "./area-
|
|
17
|
+
import { ct as Numeric } from "./object-Mglyg4AW.cjs";
|
|
18
|
+
import { C as $Length, S as $Mass, b as $Time, c as $Unit, f as Converted, t as $Area, w as $Data, x as $Temperature, y as $Volume } from "./area-CHhwLR12.cjs";
|
|
19
19
|
|
|
20
20
|
//#region src/converter/Converter.d.ts
|
|
21
21
|
/**
|
package/dist/converter.d.mts
CHANGED
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import {
|
|
18
|
-
import { C as $Length, S as $Mass, b as $Time, c as $Unit, f as Converted, t as $Area, w as $Data, x as $Temperature, y as $Volume } from "./area-
|
|
17
|
+
import { ct as Numeric } from "./object-Mglyg4AW.mjs";
|
|
18
|
+
import { C as $Length, S as $Mass, b as $Time, c as $Unit, f as Converted, t as $Area, w as $Data, x as $Temperature, y as $Volume } from "./area-DOqFLNcr.mjs";
|
|
19
19
|
|
|
20
20
|
//#region src/converter/Converter.d.ts
|
|
21
21
|
/**
|
package/dist/converter.mjs
CHANGED
|
@@ -96,7 +96,7 @@ var $BaseConverter = class {
|
|
|
96
96
|
*
|
|
97
97
|
* @remarks
|
|
98
98
|
* - This method is automatically called when the instance is used in a string context.
|
|
99
|
-
* - For complex and versatile pluralization, please refer to {@link https://toolbox-x.nazmul-nhb.dev/docs/
|
|
99
|
+
* - For complex and versatile pluralization, please refer to {@link https://toolbox-x.nazmul-nhb.dev/docs/utils/string/pluralizer pluralizer} or {@link https://toolbox-x.nazmul-nhb.dev/docs/classes/pluralizer Pluralizer Class} instead.
|
|
100
100
|
*/
|
|
101
101
|
toString() {
|
|
102
102
|
return this.$withPluralUnit();
|
|
@@ -176,7 +176,7 @@ var $BaseConverter = class {
|
|
|
176
176
|
* @param decimals Number of decimal places for fractional value.
|
|
177
177
|
* @returns Formatted string with proper unit pluralization.
|
|
178
178
|
*
|
|
179
|
-
* @remarks For complex and versatile pluralization, please refer to {@link https://toolbox-x.nazmul-nhb.dev/docs/
|
|
179
|
+
* @remarks For complex and versatile pluralization, please refer to {@link https://toolbox-x.nazmul-nhb.dev/docs/utils/string/pluralizer pluralizer} or {@link https://toolbox-x.nazmul-nhb.dev/docs/classes/pluralizer Pluralizer Class} instead.
|
|
180
180
|
*/
|
|
181
181
|
format(decimals = 2) {
|
|
182
182
|
return this.$withPluralUnit(this.$round(this.value, decimals));
|
package/dist/date.cjs
CHANGED
|
@@ -16,11 +16,12 @@
|
|
|
16
16
|
|
|
17
17
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
18
18
|
const require_primitives = require('./primitives-CBGICrDR.cjs');
|
|
19
|
+
const require_constants = require('./constants-Dz5vxNQ9.cjs');
|
|
19
20
|
const require_timezone = require('./timezone-CSz7R0L6.cjs');
|
|
20
|
-
const require_specials = require('./specials-
|
|
21
|
-
const require_utilities = require('./utilities-
|
|
22
|
-
const require_guards = require('./guards-
|
|
23
|
-
const require_parse = require('./parse-
|
|
21
|
+
const require_specials = require('./specials-dkYP1Nh2.cjs');
|
|
22
|
+
const require_utilities = require('./utilities-CWV1GPGY.cjs');
|
|
23
|
+
const require_guards = require('./guards-Bsh6Bfdq.cjs');
|
|
24
|
+
const require_parse = require('./parse-BWu3UbOk.cjs');
|
|
24
25
|
|
|
25
26
|
//#region src/date/utils.ts
|
|
26
27
|
/**
|
|
@@ -162,15 +163,15 @@ function getTimeZoneIds(offset) {
|
|
|
162
163
|
* - The default format is `'dd, mmm DD, YYYY HH:mm:ss'` (e.g., `'Sun, Apr 06, 2025 16:11:55'`).
|
|
163
164
|
* - By default, local time is used; set `useUTC` to `true` to format in UTC.
|
|
164
165
|
* - The format string supports various tokens for date and time components, as well as literal text enclosed in square brackets.
|
|
165
|
-
* - See {@link https://toolbox-x.nazmul-nhb.dev/docs/
|
|
166
|
-
* - For more complex date/time manipulations, consider using the {@link https://
|
|
166
|
+
* - See {@link https://toolbox-x.nazmul-nhb.dev/docs/utils/date-time/format-date#format-tokens format tokens} for details on supported tokens.
|
|
167
|
+
* - For more complex date/time manipulations, consider using the {@link https://chronos.nazmul-nhb.dev/docs/ chronos-date} library.
|
|
167
168
|
*
|
|
168
169
|
* @returns Date/time string in specified format.
|
|
169
170
|
*/
|
|
170
171
|
function formatDate(options) {
|
|
171
172
|
const { date = /* @__PURE__ */ new Date(), format = "dd, mmm DD, YYYY HH:mm:ss", useUTC = false } = options ?? {};
|
|
172
173
|
const $date = require_parse._dateArgsToDate(date);
|
|
173
|
-
if (isNaN($date.getTime())) return "Invalid Date!";
|
|
174
|
+
if (Number.isNaN($date.getTime())) return "Invalid Date!";
|
|
174
175
|
/** Get unit value for {@link $date} for specific unit in local or UTC time */
|
|
175
176
|
const _getUnitValue = (suffix) => {
|
|
176
177
|
return useUTC ? $date[`getUTC${suffix}`]() : $date[`get${suffix}`]();
|
|
@@ -204,7 +205,7 @@ function formatTimePart(time, format) {
|
|
|
204
205
|
});
|
|
205
206
|
}
|
|
206
207
|
/**
|
|
207
|
-
* * Formats a date as a relative time string (e.g., "5m ago"
|
|
208
|
+
* * Formats a date as a relative time string (e.g., `"5m ago"`, `"2h from now"`).
|
|
208
209
|
*
|
|
209
210
|
* @param date - The date to format, which can be a `Date` object, a date string, or a timestamp number.
|
|
210
211
|
* @param format - Optional format string for dates older than 7 days. Defaults to `'mmm D, yyyy hh:mm a'`.
|
|
@@ -223,7 +224,7 @@ function formatTimePart(time, format) {
|
|
|
223
224
|
*/
|
|
224
225
|
function formatDateRelative(date, format) {
|
|
225
226
|
const $date = require_parse._dateArgsToDate(date);
|
|
226
|
-
if (isNaN($date.getTime())) return "Invalid Date!";
|
|
227
|
+
if (Number.isNaN($date.getTime())) return "Invalid Date!";
|
|
227
228
|
const now = Date.now();
|
|
228
229
|
const then = $date.getTime();
|
|
229
230
|
const diff = Math.abs(now - then);
|
|
@@ -240,6 +241,43 @@ function formatDateRelative(date, format) {
|
|
|
240
241
|
format: format || "mmm D, yyyy hh:mm a"
|
|
241
242
|
});
|
|
242
243
|
}
|
|
244
|
+
/**
|
|
245
|
+
* * Formats a date as a relative time string using {@link Intl.RelativeTimeFormat} native method.
|
|
246
|
+
*
|
|
247
|
+
* @param toDate - The date to format, which can be a `Date` object, a date string, or a timestamp number.
|
|
248
|
+
* @param options - Optional configuration for relative date formatting.
|
|
249
|
+
* @returns A relative time string.
|
|
250
|
+
*
|
|
251
|
+
* @remarks
|
|
252
|
+
* - If `toDate` is provided but `undefined`, current date and time will be used.
|
|
253
|
+
* - If `fromDate` is provided but `undefined`, current date and time will be used.
|
|
254
|
+
* - If any of the provided date value (`toDate` or `fromDate`) is invalid, the function will return `'Invalid Date!'`.
|
|
255
|
+
*
|
|
256
|
+
* @example
|
|
257
|
+
* formatRelativeDateNative(Date.now() - 5 * 60000); // "5m ago"
|
|
258
|
+
* formatRelativeDateNative(Date.now() + 2 * 3600000); // "in 2 hours"
|
|
259
|
+
*/
|
|
260
|
+
function formatRelativeDateNative(toDate, options) {
|
|
261
|
+
const { fromDate = /* @__PURE__ */ new Date(), locale = "en", localeMatcher, numeric = "always", style } = options ?? {};
|
|
262
|
+
const to = require_parse._dateArgsToDate(toDate).getTime();
|
|
263
|
+
const from = require_parse._dateArgsToDate(fromDate).getTime();
|
|
264
|
+
if (Number.isNaN(to) || Number.isNaN(from)) return "Invalid Date!";
|
|
265
|
+
let duration = (to - from) / 1e3;
|
|
266
|
+
const RELATIVE_DATE_FORMATTER = new Intl.RelativeTimeFormat(locale, {
|
|
267
|
+
localeMatcher,
|
|
268
|
+
numeric,
|
|
269
|
+
style
|
|
270
|
+
});
|
|
271
|
+
let formatted = "Just now";
|
|
272
|
+
for (const division of require_constants.RELATIVE_TIME_DIVISIONS) {
|
|
273
|
+
if (Math.abs(duration) < division.amount) {
|
|
274
|
+
formatted = RELATIVE_DATE_FORMATTER.format(Math.round(duration), division.name);
|
|
275
|
+
break;
|
|
276
|
+
}
|
|
277
|
+
duration /= division.amount;
|
|
278
|
+
}
|
|
279
|
+
return formatted;
|
|
280
|
+
}
|
|
243
281
|
/** Get timestamp in ISO 8601 format. */
|
|
244
282
|
function getTimestamp(args, format) {
|
|
245
283
|
let $value;
|
|
@@ -255,7 +293,7 @@ function getTimestamp(args, format) {
|
|
|
255
293
|
$format = format || "utc";
|
|
256
294
|
}
|
|
257
295
|
let date = require_parse._dateArgsToDate($value);
|
|
258
|
-
if (isNaN(date.getTime())) date = /* @__PURE__ */ new Date();
|
|
296
|
+
if (Number.isNaN(date.getTime())) date = /* @__PURE__ */ new Date();
|
|
259
297
|
if ($format === "local") {
|
|
260
298
|
const offsetMins = date.getTimezoneOffset();
|
|
261
299
|
const localDate = /* @__PURE__ */ new Date(date.getTime() - offsetMins * 6e4);
|
|
@@ -306,9 +344,12 @@ exports.extractTimeStringFromUTC = extractTimeFromUTC;
|
|
|
306
344
|
exports.extractTotalMinutesFromTime = getTotalMinutes;
|
|
307
345
|
exports.formatDate = formatDate;
|
|
308
346
|
exports.formatDateRelative = formatDateRelative;
|
|
347
|
+
exports.formatDateRelativeNative = formatRelativeDateNative;
|
|
309
348
|
exports.formatDateTime = formatDate;
|
|
310
349
|
exports.formatRelativeDate = formatDateRelative;
|
|
350
|
+
exports.formatRelativeDateNative = formatRelativeDateNative;
|
|
311
351
|
exports.formatRelativeTime = formatDateRelative;
|
|
352
|
+
exports.formatRelativeTimeNative = formatRelativeDateNative;
|
|
312
353
|
exports.formatTimePart = formatTimePart;
|
|
313
354
|
exports.formatUTCOffset = formatUTCOffset;
|
|
314
355
|
exports.generateGreeting = getGreeting;
|
package/dist/date.d.cts
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import {
|
|
17
|
+
import { Dn as UTCOffset, Gt as GreetingConfigs, Jt as ISODateFormat, Kt as HourMinutes, Mt as DateArgs, Nt as DateFormatOptions, Tn as TimestampOptions, Yt as ISODateTimeString, _n as TimeWithUnit, ct as Numeric, jt as ClockTime, ln as RelativeDateFormatOptions, nt as Maybe, pn as TimeOnlyFormat, un as SafeFormat, wt as $TimeZoneIdentifier, xn as TimeZoneIdNative, yn as TimeZoneDetails } from "./object-Mglyg4AW.cjs";
|
|
18
18
|
|
|
19
19
|
//#region src/date/greet.d.ts
|
|
20
20
|
/**
|
|
@@ -129,8 +129,8 @@ declare function getTimeZoneIds(offset: UTCOffset): TimeZoneIdNative[];
|
|
|
129
129
|
* - The default format is `'dd, mmm DD, YYYY HH:mm:ss'` (e.g., `'Sun, Apr 06, 2025 16:11:55'`).
|
|
130
130
|
* - By default, local time is used; set `useUTC` to `true` to format in UTC.
|
|
131
131
|
* - The format string supports various tokens for date and time components, as well as literal text enclosed in square brackets.
|
|
132
|
-
* - See {@link https://toolbox-x.nazmul-nhb.dev/docs/
|
|
133
|
-
* - For more complex date/time manipulations, consider using the {@link https://
|
|
132
|
+
* - See {@link https://toolbox-x.nazmul-nhb.dev/docs/utils/date-time/format-date#format-tokens format tokens} for details on supported tokens.
|
|
133
|
+
* - For more complex date/time manipulations, consider using the {@link https://chronos.nazmul-nhb.dev/docs/ chronos-date} library.
|
|
134
134
|
*
|
|
135
135
|
* @returns Date/time string in specified format.
|
|
136
136
|
*/
|
|
@@ -157,7 +157,7 @@ declare function formatDate(options?: DateFormatOptions): string;
|
|
|
157
157
|
*/
|
|
158
158
|
declare function formatTimePart(time: string, format?: TimeOnlyFormat): string;
|
|
159
159
|
/**
|
|
160
|
-
* * Formats a date as a relative time string (e.g., "5m ago"
|
|
160
|
+
* * Formats a date as a relative time string (e.g., `"5m ago"`, `"2h from now"`).
|
|
161
161
|
*
|
|
162
162
|
* @param date - The date to format, which can be a `Date` object, a date string, or a timestamp number.
|
|
163
163
|
* @param format - Optional format string for dates older than 7 days. Defaults to `'mmm D, yyyy hh:mm a'`.
|
|
@@ -175,6 +175,23 @@ declare function formatTimePart(time: string, format?: TimeOnlyFormat): string;
|
|
|
175
175
|
* formatDateRelative(Date.now() - 10 * 86400000); // "Apr 6, 2026 04:11 PM" (formatted date string)
|
|
176
176
|
*/
|
|
177
177
|
declare function formatDateRelative(date: Maybe<DateArgs>, format?: SafeFormat): string;
|
|
178
|
+
/**
|
|
179
|
+
* * Formats a date as a relative time string using {@link Intl.RelativeTimeFormat} native method.
|
|
180
|
+
*
|
|
181
|
+
* @param toDate - The date to format, which can be a `Date` object, a date string, or a timestamp number.
|
|
182
|
+
* @param options - Optional configuration for relative date formatting.
|
|
183
|
+
* @returns A relative time string.
|
|
184
|
+
*
|
|
185
|
+
* @remarks
|
|
186
|
+
* - If `toDate` is provided but `undefined`, current date and time will be used.
|
|
187
|
+
* - If `fromDate` is provided but `undefined`, current date and time will be used.
|
|
188
|
+
* - If any of the provided date value (`toDate` or `fromDate`) is invalid, the function will return `'Invalid Date!'`.
|
|
189
|
+
*
|
|
190
|
+
* @example
|
|
191
|
+
* formatRelativeDateNative(Date.now() - 5 * 60000); // "5m ago"
|
|
192
|
+
* formatRelativeDateNative(Date.now() + 2 * 3600000); // "in 2 hours"
|
|
193
|
+
*/
|
|
194
|
+
declare function formatRelativeDateNative(toDate: DateArgs, options?: RelativeDateFormatOptions): string;
|
|
178
195
|
/**
|
|
179
196
|
* * Get timestamp in ISO 8601 format for the current date and time.
|
|
180
197
|
*
|
|
@@ -210,4 +227,4 @@ declare function getTimestamp<F extends ISODateFormat>(value: DateArgs, format?:
|
|
|
210
227
|
*/
|
|
211
228
|
declare function getTimestamp<F extends ISODateFormat>(options: TimestampOptions<F>): ISODateTimeString<F>;
|
|
212
229
|
//#endregion
|
|
213
|
-
export { convertMinutesToTime as convertMinutesToHourMinutes, convertMinutesToTime, convertMinutesToTime as getHourMinutesFromMinutes, convertMinutesToTime as getTimeFromMinutes, formatUTCOffset as convertMinutesToUTCOffset, formatUTCOffset, formatUTCOffset as minutesToUTCOffset, extractHourMinute, extractMinutesFromUTC, extractMinutesFromUTC as getMinutesFromUTC, extractMinutesFromUTC as getTotalMinutesFromUTC, extractTimeFromUTC, extractTimeFromUTC as extractTimeStringFromUTC, extractTimeFromUTC as getTimeStringFromUTC, getTotalMinutes as extractTotalMinutesFromTime, getTotalMinutes, getTotalMinutes as getTotalMinutesFromTime, formatDate, formatDate as formatDateTime, formatDateRelative, formatDateRelative as formatRelativeDate, formatDateRelative as formatRelativeTime, formatTimePart, getGreeting as generateGreeting, getGreeting, getGreeting as greet, getCurrentDateTime, getCurrentDateTime as getCurrentTime, getNativeTimeZoneId, getTimeZoneDetails, getTimeZoneIds, getTimestamp, parseMSec, parseMSec as parseMs };
|
|
230
|
+
export { convertMinutesToTime as convertMinutesToHourMinutes, convertMinutesToTime, convertMinutesToTime as getHourMinutesFromMinutes, convertMinutesToTime as getTimeFromMinutes, formatUTCOffset as convertMinutesToUTCOffset, formatUTCOffset, formatUTCOffset as minutesToUTCOffset, extractHourMinute, extractMinutesFromUTC, extractMinutesFromUTC as getMinutesFromUTC, extractMinutesFromUTC as getTotalMinutesFromUTC, extractTimeFromUTC, extractTimeFromUTC as extractTimeStringFromUTC, extractTimeFromUTC as getTimeStringFromUTC, getTotalMinutes as extractTotalMinutesFromTime, getTotalMinutes, getTotalMinutes as getTotalMinutesFromTime, formatDate, formatDate as formatDateTime, formatDateRelative, formatDateRelative as formatRelativeDate, formatDateRelative as formatRelativeTime, formatRelativeDateNative as formatDateRelativeNative, formatRelativeDateNative, formatRelativeDateNative as formatRelativeTimeNative, formatTimePart, getGreeting as generateGreeting, getGreeting, getGreeting as greet, getCurrentDateTime, getCurrentDateTime as getCurrentTime, getNativeTimeZoneId, getTimeZoneDetails, getTimeZoneIds, getTimestamp, parseMSec, parseMSec as parseMs };
|