toolbox-x 1.2.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{Color-Dsut0Bex.d.cts → Color-B8MR8Vp0.d.cts} +1 -1
- package/dist/{Color-DCfoQk_-.d.mts → Color-D2MfZx7L.d.mts} +1 -1
- package/dist/{Stylog-DXZtHAbp.d.mts → Stylog-CSbLtqrZ.d.mts} +5 -5
- package/dist/{Stylog-TyLCTRtT.d.cts → Stylog-DF0CWtZb.d.cts} +5 -5
- package/dist/{area-CvSC96va.d.mts → area-C4tDXnGC.d.mts} +3 -3
- package/dist/{area-CcRQ6TfR.d.cts → area-CMJZ0gVm.d.cts} +3 -3
- package/dist/{array-B6jWzJ4F.d.mts → array-26Vs2HCs.d.mts} +1 -1
- package/dist/{array-CqDu610k.d.cts → array-DJAq9Qj8.d.cts} +1 -1
- package/dist/{basics-K8BDSYD6.cjs → basics-CJmdhXoo.cjs} +567 -14
- package/dist/{basics-1_M7UvCn.mjs → basics-CebgkY-n.mjs} +449 -16
- package/dist/{basics-KobRNhV-.d.cts → basics-Cis9Ej6c.d.mts} +5 -5
- package/dist/{basics-V5M2oltn.d.mts → basics-D4yU0NQ_.d.cts} +5 -5
- package/dist/{case-uKFzt5TY.cjs → case-Bd7QLHYw.cjs} +3 -3
- package/dist/{case-KdrBKjjK.d.mts → case-ChRzRBnY.d.mts} +12 -12
- package/dist/{case-BQwn5N-k.mjs → case-DBC4Rj0h.mjs} +3 -3
- package/dist/{case--Vjea9DS.d.cts → case-DkYSKSeV.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.d.cts +1 -1
- package/dist/constants.d.mts +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 +10 -10
- package/dist/date.d.cts +4 -4
- package/dist/date.d.mts +4 -4
- package/dist/date.mjs +10 -10
- 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-Cp1OyCRI.d.cts} +2 -2
- package/dist/{form-mP-nl8EC.d.cts → form-DPdS2AhM.d.mts} +2 -2
- package/dist/guards-B2s2wlVN.mjs +425 -0
- package/dist/{guards-Cp6KAkVI.mjs → guards-BK1QuvFZ.mjs} +3 -3
- package/dist/{guards-DP5k4_Mm.cjs → guards-Bsh6Bfdq.cjs} +3 -3
- package/dist/{guards-0VjySrPM.cjs → guards-DMJcjPDt.cjs} +279 -3
- package/dist/guards.cjs +9 -9
- 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-DfhOK0Fi.d.mts} +1 -1
- package/dist/{hash-GYRx2ee_.d.mts → hash-IdZN0mIe.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-B-yBZr-J.d.mts} +1 -1
- package/dist/{http-status-C0DOpCDf.d.cts → http-status-Dq_hoSG6.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-C5FoCCbF.d.cts +292 -0
- package/dist/index-CIJWxnDS.d.mts +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-X5fSMx-I.d.cts} +13 -1
- package/dist/{object-ChFVh95z.d.mts → object-X5fSMx-I.d.mts} +13 -1
- package/dist/{objectify-CfXtS_E0.mjs → objectify-CQa8gQib.mjs} +3 -4
- package/dist/{objectify-CZJr9hwg.cjs → objectify-xQvZS3UI.cjs} +5 -6
- package/dist/paginator.d.cts +1 -1
- package/dist/paginator.d.mts +1 -1
- package/dist/{parse-BpUlILVi.cjs → parse-DT7jbWx7.cjs} +5 -5
- package/dist/{parse-rcJRAOJl.mjs → parse-erxBG2hd.mjs} +5 -5
- package/dist/{pluralizer-CdG-VJ6t.d.cts → pluralizer-B8vuljyy.d.cts} +1 -1
- package/dist/{pluralizer-D2Lh8CdU.d.mts → pluralizer-DOdDskzF.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-CkwTVFeL.d.mts → string-C51m7T6d.d.mts} +4 -2
- package/dist/{string-Dq2b8rcN.d.cts → string-CO7HP50i.d.cts} +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 +1 -1
- package/dist/types/date.d.mts +1 -1
- 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-BUI3Jt8n.d.cts} +3 -3
- package/dist/{uuid-Yc3Uu8qr.d.mts → uuid-mEiy14sf.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-CFyEFj2Y.cjs +0 -568
- package/dist/utils-CN3ocK98.mjs +0 -449
package/dist/hash.d.mts
CHANGED
|
@@ -14,10 +14,10 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import {
|
|
18
|
-
import { _ as VerifiedToken, d as SignetPayload, l as SignOptions, p as TokenString, s as DecodedToken, v as VerifyOptions } from "./hash-
|
|
19
|
-
import { a as isUUIDv4, c as isUUIDv7, i as isUUIDv3, l as isUUIDv8, n as isUUIDv1, o as isUUIDv5, r as isUUIDv2, s as isUUIDv6, t as decodeUUID, u as uuid, w as isUUID } from "./uuid-
|
|
20
|
-
import { t as generateRandomID } from "./basics-
|
|
17
|
+
import { nt as Maybe, y as GenericObject } from "./object-X5fSMx-I.mjs";
|
|
18
|
+
import { _ as VerifiedToken, d as SignetPayload, l as SignOptions, p as TokenString, s as DecodedToken, v as VerifyOptions } from "./hash-DfhOK0Fi.mjs";
|
|
19
|
+
import { a as isUUIDv4, c as isUUIDv7, i as isUUIDv3, l as isUUIDv8, n as isUUIDv1, o as isUUIDv5, r as isUUIDv2, s as isUUIDv6, t as decodeUUID, u as uuid, w as isUUID } from "./uuid-mEiy14sf.mjs";
|
|
20
|
+
import { t as generateRandomID } from "./basics-Cis9Ej6c.mjs";
|
|
21
21
|
|
|
22
22
|
//#region src/hash/Cipher.d.ts
|
|
23
23
|
/**
|
|
@@ -128,9 +128,9 @@ declare function sha1(msg: string): string;
|
|
|
128
128
|
* // Returns: '7037e204b825b83553ba336a6ec35b796d505599286ae864729ed6cb33ae9fe1'
|
|
129
129
|
* ```
|
|
130
130
|
*
|
|
131
|
-
* @see {@link https://toolbox-x.nazmul-nhb.dev/docs/
|
|
132
|
-
* @see {@link https://toolbox-x.nazmul-nhb.dev/docs/
|
|
133
|
-
* @see {@link https://toolbox-x.nazmul-nhb.dev/docs/
|
|
131
|
+
* @see {@link https://toolbox-x.nazmul-nhb.dev/docs/utils/hash/encoding#sha256bytes sha256Bytes} for hashing raw bytes
|
|
132
|
+
* @see {@link https://toolbox-x.nazmul-nhb.dev/docs/utils/hash/encoding#utf8tobytes utf8ToBytes} for converting string to bytes
|
|
133
|
+
* @see {@link https://toolbox-x.nazmul-nhb.dev/docs/utils/hash/encoding#bytestohex bytesToHex} for converting bytes to a hexadecimal string
|
|
134
134
|
*/
|
|
135
135
|
declare function sha256(msg: string): string;
|
|
136
136
|
//#endregion
|
|
@@ -1143,4 +1143,4 @@ declare function bytesToHex(bytes: Uint8Array): string;
|
|
|
1143
1143
|
*/
|
|
1144
1144
|
declare function hexToBytes(hex: string): Uint8Array;
|
|
1145
1145
|
//#endregion
|
|
1146
|
-
export { Cipher, Signet, TextCodec, base64ToBytes, bytesToBase64, bytesToHex, bytesToUtf8, concatBytes, decodeUUID, generateRandomID, generateRandomID as randomID, hexToBytes, hmacSha256, intTo4BytesBE, isUUID, isUUIDv1, isUUIDv2, isUUIDv3, isUUIDv4, isUUIDv5, isUUIDv6, isUUIDv7, isUUIDv8, md5, randomHex, sha1, sha256, sha256Bytes, uint8To32ArrayBE, utf8ToBytes, uuid };
|
|
1146
|
+
export { Cipher, Signet, TextCodec, base64ToBytes, bytesToBase64, bytesToHex, bytesToUtf8, concatBytes, decodeUUID, generateRandomID, generateRandomID as getRandomID, generateRandomID as randomID, hexToBytes, hmacSha256, intTo4BytesBE, isUUID, isUUIDv1, isUUIDv2, isUUIDv3, isUUIDv4, isUUIDv5, isUUIDv6, isUUIDv7, isUUIDv8, md5, randomHex, sha1, sha256, sha256Bytes, uint8To32ArrayBE, utf8ToBytes, uuid };
|
package/dist/hash.mjs
CHANGED
|
@@ -15,10 +15,9 @@
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
import { a as isNonEmptyString } from "./primitives-Djsevc69.mjs";
|
|
18
|
-
import { c as isHexString, m as isUUID, n as isBinaryString, t as isBase64, w as isNotEmptyObject } from "./specials-
|
|
19
|
-
import { c as _toSeconds, s as _secToDate, t as parseMSec } from "./parse-
|
|
20
|
-
import { A as uint8To32ArrayBE, C as bytesToUtf8, D as intTo4BytesBE, E as hmacSha256, O as randomHex, S as bytesToHex, T as hexToBytes, _ as _constantTimeEquals, a as isUUIDv1, b as base64ToBytes, c as isUUIDv4, d as isUUIDv7, f as isUUIDv8, g as sha256, h as sha1, i as decodeUUID, j as utf8ToBytes, k as sha256Bytes, l as isUUIDv5, m as md5, o as isUUIDv2, p as uuid, s as isUUIDv3, t as generateRandomID, u as isUUIDv6, v as _padStartWith0, w as concatBytes, x as bytesToBase64, y as _splitByCharLength } from "./basics-
|
|
21
|
-
import { h as stripJsonEdgeGarbage, m as stableStringify } from "./utils-CN3ocK98.mjs";
|
|
18
|
+
import { c as isHexString, m as isUUID, n as isBinaryString, t as isBase64, w as isNotEmptyObject } from "./specials-Hq5Ncd6y.mjs";
|
|
19
|
+
import { c as _toSeconds, s as _secToDate, t as parseMSec } from "./parse-erxBG2hd.mjs";
|
|
20
|
+
import { A as uint8To32ArrayBE, C as bytesToUtf8, D as intTo4BytesBE, E as hmacSha256, G as stableStringify, K as stripJsonEdgeGarbage, O as randomHex, S as bytesToHex, T as hexToBytes, _ as _constantTimeEquals, a as isUUIDv1, b as base64ToBytes, c as isUUIDv4, d as isUUIDv7, f as isUUIDv8, g as sha256, h as sha1, i as decodeUUID, j as utf8ToBytes, k as sha256Bytes, l as isUUIDv5, m as md5, o as isUUIDv2, p as uuid, s as isUUIDv3, t as generateRandomID, u as isUUIDv6, v as _padStartWith0, w as concatBytes, x as bytesToBase64, y as _splitByCharLength } from "./basics-CebgkY-n.mjs";
|
|
22
21
|
|
|
23
22
|
//#region src/hash/Cipher.ts
|
|
24
23
|
/**
|
|
@@ -888,4 +887,4 @@ var TextCodec = class {
|
|
|
888
887
|
};
|
|
889
888
|
|
|
890
889
|
//#endregion
|
|
891
|
-
export { Cipher, Signet, TextCodec, base64ToBytes, bytesToBase64, bytesToHex, bytesToUtf8, concatBytes, decodeUUID, generateRandomID, generateRandomID as randomID, hexToBytes, hmacSha256, intTo4BytesBE, isUUID, isUUIDv1, isUUIDv2, isUUIDv3, isUUIDv4, isUUIDv5, isUUIDv6, isUUIDv7, isUUIDv8, md5, randomHex, sha1, sha256, sha256Bytes, uint8To32ArrayBE, utf8ToBytes, uuid };
|
|
890
|
+
export { Cipher, Signet, TextCodec, base64ToBytes, bytesToBase64, bytesToHex, bytesToUtf8, concatBytes, decodeUUID, generateRandomID, generateRandomID as getRandomID, generateRandomID as randomID, hexToBytes, hmacSha256, intTo4BytesBE, isUUID, isUUIDv1, isUUIDv2, isUUIDv3, isUUIDv4, isUUIDv5, isUUIDv6, isUUIDv7, isUUIDv8, md5, randomHex, sha1, sha256, sha256Bytes, uint8To32ArrayBE, utf8ToBytes, uuid };
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import {
|
|
17
|
+
import { Pr as LooseLiteral } from "./object-X5fSMx-I.mjs";
|
|
18
18
|
import { n as HTTP_STATUS_DATA } from "./constants-DNIXgBkz.mjs";
|
|
19
19
|
|
|
20
20
|
//#region src/types/http-status.d.ts
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import {
|
|
17
|
+
import { Pr as LooseLiteral } from "./object-X5fSMx-I.cjs";
|
|
18
18
|
import { n as HTTP_STATUS_DATA } from "./constants-DNIXgBkz.cjs";
|
|
19
19
|
|
|
20
20
|
//#region src/types/http-status.d.ts
|
package/dist/http-status.cjs
CHANGED
|
@@ -24,10 +24,10 @@ const require_constants = require('./constants-ZnFGKd7G.cjs');
|
|
|
24
24
|
* @remarks
|
|
25
25
|
* - Supports lookup by code or name (both `SOME_NAME` and `Some Name` formats).
|
|
26
26
|
* - Allows adding custom codes and overriding messages for existing ones.
|
|
27
|
-
* - Provides pre-grouped categories for quick filtering (see {@link https://toolbox-x.nazmul-nhb.dev/docs/classes/
|
|
27
|
+
* - Provides pre-grouped categories for quick filtering (see {@link https://toolbox-x.nazmul-nhb.dev/docs/classes/http-status#groups-static-property HttpStatus.Groups}).
|
|
28
28
|
* - Intended to be reusable — create multiple instances if you want separate registries.
|
|
29
29
|
*
|
|
30
|
-
* @see {@link https://toolbox-x.nazmul-nhb.dev/docs/
|
|
30
|
+
* @see {@link https://toolbox-x.nazmul-nhb.dev/docs/utils/misc/http-status httpStatus} for the default preloaded singleton instance.
|
|
31
31
|
*
|
|
32
32
|
* @example
|
|
33
33
|
* // Using the class directly
|
|
@@ -148,7 +148,7 @@ var HttpStatus = class HttpStatus {
|
|
|
148
148
|
}
|
|
149
149
|
};
|
|
150
150
|
/**
|
|
151
|
-
* * Default singleton instance of {@link https://toolbox-x.nazmul-nhb.dev/docs/classes/
|
|
151
|
+
* * Default singleton instance of {@link https://toolbox-x.nazmul-nhb.dev/docs/classes/http-status HttpStatus} class.
|
|
152
152
|
*
|
|
153
153
|
* @remarks
|
|
154
154
|
* - Preloaded with all MDN-based HTTP status codes.
|
|
@@ -157,7 +157,7 @@ var HttpStatus = class HttpStatus {
|
|
|
157
157
|
* mutation methods without manual instantiation.
|
|
158
158
|
*
|
|
159
159
|
* @example
|
|
160
|
-
* import { httpStatus } from '
|
|
160
|
+
* import { httpStatus } from 'toolbox-x/http-status';
|
|
161
161
|
*
|
|
162
162
|
* console.log(httpStatus.getByCode(404)?.readableName);
|
|
163
163
|
* // "Not Found"
|
package/dist/http-status.d.cts
CHANGED
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import {
|
|
18
|
-
import { a as HttpStatusCode, c as StatusCode, l as StatusEntry, o as HttpStatusName, s as StatusCategory, u as StatusName } from "./http-status-
|
|
17
|
+
import { nt as Maybe } from "./object-X5fSMx-I.cjs";
|
|
18
|
+
import { a as HttpStatusCode, c as StatusCode, l as StatusEntry, o as HttpStatusName, s as StatusCategory, u as StatusName } from "./http-status-Dq_hoSG6.cjs";
|
|
19
19
|
|
|
20
20
|
//#region src/http-status/HttpStatus.d.ts
|
|
21
21
|
/**
|
|
@@ -24,10 +24,10 @@ import { a as HttpStatusCode, c as StatusCode, l as StatusEntry, o as HttpStatus
|
|
|
24
24
|
* @remarks
|
|
25
25
|
* - Supports lookup by code or name (both `SOME_NAME` and `Some Name` formats).
|
|
26
26
|
* - Allows adding custom codes and overriding messages for existing ones.
|
|
27
|
-
* - Provides pre-grouped categories for quick filtering (see {@link https://toolbox-x.nazmul-nhb.dev/docs/classes/
|
|
27
|
+
* - Provides pre-grouped categories for quick filtering (see {@link https://toolbox-x.nazmul-nhb.dev/docs/classes/http-status#groups-static-property HttpStatus.Groups}).
|
|
28
28
|
* - Intended to be reusable — create multiple instances if you want separate registries.
|
|
29
29
|
*
|
|
30
|
-
* @see {@link https://toolbox-x.nazmul-nhb.dev/docs/
|
|
30
|
+
* @see {@link https://toolbox-x.nazmul-nhb.dev/docs/utils/misc/http-status httpStatus} for the default preloaded singleton instance.
|
|
31
31
|
*
|
|
32
32
|
* @example
|
|
33
33
|
* // Using the class directly
|
|
@@ -119,7 +119,7 @@ declare class HttpStatus {
|
|
|
119
119
|
list(category?: StatusCategory): StatusEntry[];
|
|
120
120
|
}
|
|
121
121
|
/**
|
|
122
|
-
* * Default singleton instance of {@link https://toolbox-x.nazmul-nhb.dev/docs/classes/
|
|
122
|
+
* * Default singleton instance of {@link https://toolbox-x.nazmul-nhb.dev/docs/classes/http-status HttpStatus} class.
|
|
123
123
|
*
|
|
124
124
|
* @remarks
|
|
125
125
|
* - Preloaded with all MDN-based HTTP status codes.
|
|
@@ -128,7 +128,7 @@ declare class HttpStatus {
|
|
|
128
128
|
* mutation methods without manual instantiation.
|
|
129
129
|
*
|
|
130
130
|
* @example
|
|
131
|
-
* import { httpStatus } from '
|
|
131
|
+
* import { httpStatus } from 'toolbox-x/http-status';
|
|
132
132
|
*
|
|
133
133
|
* console.log(httpStatus.getByCode(404)?.readableName);
|
|
134
134
|
* // "Not Found"
|
package/dist/http-status.d.mts
CHANGED
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import {
|
|
18
|
-
import { a as HttpStatusCode, c as StatusCode, l as StatusEntry, o as HttpStatusName, s as StatusCategory, u as StatusName } from "./http-status-
|
|
17
|
+
import { nt as Maybe } from "./object-X5fSMx-I.mjs";
|
|
18
|
+
import { a as HttpStatusCode, c as StatusCode, l as StatusEntry, o as HttpStatusName, s as StatusCategory, u as StatusName } from "./http-status-B-yBZr-J.mjs";
|
|
19
19
|
|
|
20
20
|
//#region src/http-status/HttpStatus.d.ts
|
|
21
21
|
/**
|
|
@@ -24,10 +24,10 @@ import { a as HttpStatusCode, c as StatusCode, l as StatusEntry, o as HttpStatus
|
|
|
24
24
|
* @remarks
|
|
25
25
|
* - Supports lookup by code or name (both `SOME_NAME` and `Some Name` formats).
|
|
26
26
|
* - Allows adding custom codes and overriding messages for existing ones.
|
|
27
|
-
* - Provides pre-grouped categories for quick filtering (see {@link https://toolbox-x.nazmul-nhb.dev/docs/classes/
|
|
27
|
+
* - Provides pre-grouped categories for quick filtering (see {@link https://toolbox-x.nazmul-nhb.dev/docs/classes/http-status#groups-static-property HttpStatus.Groups}).
|
|
28
28
|
* - Intended to be reusable — create multiple instances if you want separate registries.
|
|
29
29
|
*
|
|
30
|
-
* @see {@link https://toolbox-x.nazmul-nhb.dev/docs/
|
|
30
|
+
* @see {@link https://toolbox-x.nazmul-nhb.dev/docs/utils/misc/http-status httpStatus} for the default preloaded singleton instance.
|
|
31
31
|
*
|
|
32
32
|
* @example
|
|
33
33
|
* // Using the class directly
|
|
@@ -119,7 +119,7 @@ declare class HttpStatus {
|
|
|
119
119
|
list(category?: StatusCategory): StatusEntry[];
|
|
120
120
|
}
|
|
121
121
|
/**
|
|
122
|
-
* * Default singleton instance of {@link https://toolbox-x.nazmul-nhb.dev/docs/classes/
|
|
122
|
+
* * Default singleton instance of {@link https://toolbox-x.nazmul-nhb.dev/docs/classes/http-status HttpStatus} class.
|
|
123
123
|
*
|
|
124
124
|
* @remarks
|
|
125
125
|
* - Preloaded with all MDN-based HTTP status codes.
|
|
@@ -128,7 +128,7 @@ declare class HttpStatus {
|
|
|
128
128
|
* mutation methods without manual instantiation.
|
|
129
129
|
*
|
|
130
130
|
* @example
|
|
131
|
-
* import { httpStatus } from '
|
|
131
|
+
* import { httpStatus } from 'toolbox-x/http-status';
|
|
132
132
|
*
|
|
133
133
|
* console.log(httpStatus.getByCode(404)?.readableName);
|
|
134
134
|
* // "Not Found"
|
package/dist/http-status.mjs
CHANGED
|
@@ -23,10 +23,10 @@ import { n as HTTP_STATUS_DATA } from "./constants-BLAcLxOu.mjs";
|
|
|
23
23
|
* @remarks
|
|
24
24
|
* - Supports lookup by code or name (both `SOME_NAME` and `Some Name` formats).
|
|
25
25
|
* - Allows adding custom codes and overriding messages for existing ones.
|
|
26
|
-
* - Provides pre-grouped categories for quick filtering (see {@link https://toolbox-x.nazmul-nhb.dev/docs/classes/
|
|
26
|
+
* - Provides pre-grouped categories for quick filtering (see {@link https://toolbox-x.nazmul-nhb.dev/docs/classes/http-status#groups-static-property HttpStatus.Groups}).
|
|
27
27
|
* - Intended to be reusable — create multiple instances if you want separate registries.
|
|
28
28
|
*
|
|
29
|
-
* @see {@link https://toolbox-x.nazmul-nhb.dev/docs/
|
|
29
|
+
* @see {@link https://toolbox-x.nazmul-nhb.dev/docs/utils/misc/http-status httpStatus} for the default preloaded singleton instance.
|
|
30
30
|
*
|
|
31
31
|
* @example
|
|
32
32
|
* // Using the class directly
|
|
@@ -147,7 +147,7 @@ var HttpStatus = class HttpStatus {
|
|
|
147
147
|
}
|
|
148
148
|
};
|
|
149
149
|
/**
|
|
150
|
-
* * Default singleton instance of {@link https://toolbox-x.nazmul-nhb.dev/docs/classes/
|
|
150
|
+
* * Default singleton instance of {@link https://toolbox-x.nazmul-nhb.dev/docs/classes/http-status HttpStatus} class.
|
|
151
151
|
*
|
|
152
152
|
* @remarks
|
|
153
153
|
* - Preloaded with all MDN-based HTTP status codes.
|
|
@@ -156,7 +156,7 @@ var HttpStatus = class HttpStatus {
|
|
|
156
156
|
* mutation methods without manual instantiation.
|
|
157
157
|
*
|
|
158
158
|
* @example
|
|
159
|
-
* import { httpStatus } from '
|
|
159
|
+
* import { httpStatus } from 'toolbox-x/http-status';
|
|
160
160
|
*
|
|
161
161
|
* console.log(httpStatus.getByCode(404)?.readableName);
|
|
162
162
|
* // "Not Found"
|
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2026 - present Nazmul Hassan
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { G as ConditionFns, Jr as ProtoMethodOptions, K as Constructor, U as ClassDetails, dt as Primitive, mt as VoidFn, nt as Maybe, q as DelayedFn, vr as ArrayOfObjectsToStringOptions, y as GenericObject, yr as ArrayOfPrimitivesToStringOptions } from "./object-X5fSMx-I.cjs";
|
|
18
|
+
import { a as Flattened } from "./array-DJAq9Qj8.cjs";
|
|
19
|
+
|
|
20
|
+
//#region src/array/basics.d.ts
|
|
21
|
+
/**
|
|
22
|
+
* * Flattens a nested array recursively or wraps any non-array data type in an array.
|
|
23
|
+
*
|
|
24
|
+
* @param input - The input value, which can be a nested array or a non-array value.
|
|
25
|
+
* @returns A fully flattened array of type `Flatten<T>`. If the input is not an array, it wraps it in a single-element array.
|
|
26
|
+
*/
|
|
27
|
+
declare const flattenArray: <T>(input: T | T[]) => Flattened<T>[];
|
|
28
|
+
/**
|
|
29
|
+
* * Filters an array of objects based on multiple conditions for specified keys.
|
|
30
|
+
*
|
|
31
|
+
* @param array - The array of objects to filter.
|
|
32
|
+
* @param conditions - An object where keys represent the property names and values represent filter conditions.
|
|
33
|
+
* The conditions can be a function `(value: T[K]) => boolean`.
|
|
34
|
+
* @returns The filtered array of objects.
|
|
35
|
+
* @throws `Error` If the input is not a valid array.
|
|
36
|
+
*
|
|
37
|
+
* @remarks Use `findAll` instance method from `Finder` class for **more advanced filtering and searching.**
|
|
38
|
+
*/
|
|
39
|
+
declare const filterArrayOfObjects: <T extends GenericObject>(array: Maybe<T[]>, conditions: ConditionFns<T>) => T[];
|
|
40
|
+
/**
|
|
41
|
+
* * Checks if a value is an empty array or an array with only empty values.
|
|
42
|
+
*
|
|
43
|
+
* @param value - The value to check.
|
|
44
|
+
* @returns `true` if the value is not an array, an empty array, or an array containing only `null`, `undefined`, empty objects, or empty arrays.
|
|
45
|
+
*/
|
|
46
|
+
declare const isInvalidOrEmptyArray: <T>(value: T) => boolean;
|
|
47
|
+
/**
|
|
48
|
+
* * Shuffle the elements of an array.
|
|
49
|
+
*
|
|
50
|
+
* @param array Array to shuffle.
|
|
51
|
+
* @returns Shuffled array.
|
|
52
|
+
*/
|
|
53
|
+
declare const shuffleArray: <T>(array: T[]) => T[];
|
|
54
|
+
/**
|
|
55
|
+
* * Get the last element of an array.
|
|
56
|
+
*
|
|
57
|
+
* @param array Array to get the last element from.
|
|
58
|
+
* @returns The last element or `undefined` if the array is empty.
|
|
59
|
+
*/
|
|
60
|
+
declare const getLastArrayElement: <T>(array: T[]) => Maybe<T>;
|
|
61
|
+
//#endregion
|
|
62
|
+
//#region src/number/prime.d.ts
|
|
63
|
+
/**
|
|
64
|
+
* * Checks if a number is prime.
|
|
65
|
+
*
|
|
66
|
+
* @param number The number to check.
|
|
67
|
+
* @returns Boolean: `true` if the number is prime, otherwise `false`.
|
|
68
|
+
*/
|
|
69
|
+
declare const isPrime: (number: number) => boolean;
|
|
70
|
+
/**
|
|
71
|
+
* * Find prime numbers in a given range.
|
|
72
|
+
*
|
|
73
|
+
* @param start The starting number of the range. Default is `1`.
|
|
74
|
+
* @param end The ending number of the range. Default is `1000`.
|
|
75
|
+
* @returns An array of prime numbers within the range (inclusive).
|
|
76
|
+
*/
|
|
77
|
+
declare const findPrimeNumbers: (start?: number, end?: number) => number[];
|
|
78
|
+
//#endregion
|
|
79
|
+
//#region src/utils/index.d.ts
|
|
80
|
+
/**
|
|
81
|
+
* * Deeply compare two values (arrays, objects, or primitive values).
|
|
82
|
+
*
|
|
83
|
+
* @param a First value to compare.
|
|
84
|
+
* @param b Second value to compare.
|
|
85
|
+
* @returns Whether the values are deeply equal.
|
|
86
|
+
*/
|
|
87
|
+
declare const isDeepEqual: (a: unknown, b: unknown) => boolean;
|
|
88
|
+
/**
|
|
89
|
+
* * Converts an array of objects to a string using a specific property (supports nested path to primitive values) and separator.
|
|
90
|
+
*
|
|
91
|
+
* @example
|
|
92
|
+
* const users = [
|
|
93
|
+
* { id: 1, name: { first: 'Alice' }, city: 'Bangu', },
|
|
94
|
+
* { id: 4, name: { first: 'Bob' }, city: 'Banguland', },
|
|
95
|
+
* ];
|
|
96
|
+
* convertArrayToString(users, { target: 'name.first', separator: ' | ' });
|
|
97
|
+
* // "Alice | Bob"
|
|
98
|
+
*
|
|
99
|
+
* @param array Array of objects to convert.
|
|
100
|
+
* @param options Options including the target property and separator.
|
|
101
|
+
* @returns String formed by joining the property values with the given separator.
|
|
102
|
+
*/
|
|
103
|
+
declare function convertArrayToString<T extends GenericObject>(array: Maybe<T[]>, options: ArrayOfObjectsToStringOptions<T>): string;
|
|
104
|
+
/**
|
|
105
|
+
* * Converts an array of primitive values to a string using a custom separator.
|
|
106
|
+
*
|
|
107
|
+
* @example
|
|
108
|
+
* convertArrayToString(['red', 'green', 'blue'], { separator: ' - ' });
|
|
109
|
+
* // "red - green - blue"
|
|
110
|
+
*
|
|
111
|
+
* @example
|
|
112
|
+
* convertArrayToString([1, 2, 3]);
|
|
113
|
+
* // "1, 2, 3"
|
|
114
|
+
*
|
|
115
|
+
* @param array Array of primitive values to convert.
|
|
116
|
+
* @param options Optional separator configuration.
|
|
117
|
+
* @returns String formed by joining array elements with the given separator.
|
|
118
|
+
*/
|
|
119
|
+
declare function convertArrayToString<T extends Primitive>(array: Maybe<T[]>, options?: ArrayOfPrimitivesToStringOptions): string;
|
|
120
|
+
/**
|
|
121
|
+
* * A generic debounce function that delays the execution of a callback.
|
|
122
|
+
*
|
|
123
|
+
* @param callback - The function to debounce.
|
|
124
|
+
* @param delay - The delay in milliseconds. Default is `300ms`.
|
|
125
|
+
* @returns A debounced version of the callback function.
|
|
126
|
+
*
|
|
127
|
+
* @example
|
|
128
|
+
* const debouncedSearch = debounceAction((query: string) => {
|
|
129
|
+
* console.log(`Searching for: ${query}`);
|
|
130
|
+
* }, 300);
|
|
131
|
+
*
|
|
132
|
+
* debouncedSearch('laptop'); // Executes after 300ms of inactivity.
|
|
133
|
+
*/
|
|
134
|
+
declare function debounceAction<T extends VoidFn>(callback: T, delay?: number): DelayedFn<T>;
|
|
135
|
+
/**
|
|
136
|
+
* * A generic throttle function that ensures a callback is executed at most once per specified interval.
|
|
137
|
+
*
|
|
138
|
+
* @param callback - The function to throttle.
|
|
139
|
+
* @param delay - The delay in milliseconds. Default is `150ms`.
|
|
140
|
+
* @returns A throttled version of the callback function.
|
|
141
|
+
*
|
|
142
|
+
* @example
|
|
143
|
+
* const throttledResize = throttleAction(() => {
|
|
144
|
+
* console.log('Resized');
|
|
145
|
+
* }, 300);
|
|
146
|
+
*
|
|
147
|
+
* window.addEventListener('resize', throttledResize);
|
|
148
|
+
*/
|
|
149
|
+
declare function throttleAction<T extends VoidFn>(callback: T, delay?: number): DelayedFn<T>;
|
|
150
|
+
/**
|
|
151
|
+
* * Retrieves the names of all instance methods defined directly on a class prototype.
|
|
152
|
+
*
|
|
153
|
+
* @param cls - The class constructor (not an instance).
|
|
154
|
+
* @returns A sorted array of instance method names.
|
|
155
|
+
*/
|
|
156
|
+
declare function getInstanceMethodNames(cls: Constructor): string[];
|
|
157
|
+
/**
|
|
158
|
+
* * Retrieves the names of all static methods defined directly on a class constructor.
|
|
159
|
+
*
|
|
160
|
+
* @param cls - The class constructor (not an instance).
|
|
161
|
+
* @returns A sorted array of static method names.
|
|
162
|
+
*/
|
|
163
|
+
declare function getStaticMethodNames(cls: Constructor): string[];
|
|
164
|
+
/**
|
|
165
|
+
* * Counts the number of instance methods defined directly on a class prototype.
|
|
166
|
+
*
|
|
167
|
+
* @param cls - The class constructor (not an instance).
|
|
168
|
+
* @returns The number of instance methods defined on the class prototype.
|
|
169
|
+
*/
|
|
170
|
+
declare function countInstanceMethods(cls: Constructor): number;
|
|
171
|
+
/**
|
|
172
|
+
* * Counts the number of static methods defined directly on a class constructor.
|
|
173
|
+
*
|
|
174
|
+
* @param cls - The class constructor (not an instance).
|
|
175
|
+
* @returns The number of static methods defined on the class constructor.
|
|
176
|
+
*/
|
|
177
|
+
declare function countStaticMethods(cls: Constructor): number;
|
|
178
|
+
/**
|
|
179
|
+
* * Retrieves the names of all instance getters defined directly on a class prototype.
|
|
180
|
+
*
|
|
181
|
+
* @param cls - The class constructor (not an instance).
|
|
182
|
+
* @returns A sorted array of instance getter names.
|
|
183
|
+
*/
|
|
184
|
+
declare function getInstanceGetterNames(cls: Constructor): string[];
|
|
185
|
+
/**
|
|
186
|
+
* * Retrieves the names of all static getters defined directly on a class constructor.
|
|
187
|
+
*
|
|
188
|
+
* @param cls - The class constructor (not an instance).
|
|
189
|
+
* @returns A sorted array of static getter names.
|
|
190
|
+
*/
|
|
191
|
+
declare function getStaticGetterNames(cls: Constructor): string[];
|
|
192
|
+
/**
|
|
193
|
+
* * Gathers detailed information about the instance and static methods of a class.
|
|
194
|
+
*
|
|
195
|
+
* @param cls - The class constructor (not an instance).
|
|
196
|
+
* @returns An object containing names and counts of instance and static methods.
|
|
197
|
+
*/
|
|
198
|
+
declare function getClassDetails(cls: Constructor): ClassDetails;
|
|
199
|
+
/**
|
|
200
|
+
* * Create a deterministic JSON string representation of any value.
|
|
201
|
+
* - The output format matches standard JSON but with guaranteed sorted keys.
|
|
202
|
+
*
|
|
203
|
+
* @remarks
|
|
204
|
+
* - This function guarantees **stable, repeatable output** by:
|
|
205
|
+
* - Sorting all object keys alphabetically.
|
|
206
|
+
* - Recursively stabilizing nested objects and arrays.
|
|
207
|
+
* - Converting all `undefined` values into `null` so the output remains valid JSON.
|
|
208
|
+
* - Converting date-like objects (`Date`, `Chronos`, `Moment.js`, `Day.js`, `Luxon`, `JS-Joda`, `Temporal`) **in the same way that {@link JSON.stringify} would serialize them**, ensuring predictable and JSON-compliant output.
|
|
209
|
+
* - Falling back to native JSON serialization for primitives.
|
|
210
|
+
*
|
|
211
|
+
* - **Useful for:**
|
|
212
|
+
* - Hash generation (e.g., signatures, cache keys)
|
|
213
|
+
* - Deep equality checks
|
|
214
|
+
* - Producing predictable output across environments
|
|
215
|
+
*
|
|
216
|
+
* @param obj - The value to stringify into a deterministic JSON string.
|
|
217
|
+
* @returns A stable, deterministic string representation of the input.
|
|
218
|
+
*/
|
|
219
|
+
declare function stableStringify(obj: unknown): string;
|
|
220
|
+
/**
|
|
221
|
+
* * Remove trailing or leading garbage characters **after/before JSON object or array**.
|
|
222
|
+
* @param str String to sanitize/strip.
|
|
223
|
+
* @returns Sanitized/stripped JSON string.
|
|
224
|
+
*/
|
|
225
|
+
declare function stripJsonEdgeGarbage(str: string): string;
|
|
226
|
+
/**
|
|
227
|
+
* * Parses any valid JSON string, optionally converting stringified primitives inside (nested) arrays or objects.
|
|
228
|
+
*
|
|
229
|
+
* @typeParam T - Expected return type (default is unknown).
|
|
230
|
+
* @param value - The JSON string to parse.
|
|
231
|
+
* @param parsePrimitives - Whether to convert stringified primitives (default: `true`).
|
|
232
|
+
* @returns The parsed JSON value typed as `T`, or the original parsed value with optional primitive conversion.
|
|
233
|
+
* - Returns `{}` if parsing fails, such as when the input is malformed or invalid JSON or passing single quoted string.
|
|
234
|
+
*
|
|
235
|
+
* - *Unlike {@link https://toolbox-x.nazmul-nhb.dev/docs/utils/object/parse-json-to-object parseJsonToObject}, which ensures the root value is an object,
|
|
236
|
+
* this function returns any valid JSON structure such as arrays, strings, numbers, or objects.*
|
|
237
|
+
*
|
|
238
|
+
* This is useful when you're not sure of the root structure of the JSON, or when you expect something other than an object.
|
|
239
|
+
*
|
|
240
|
+
* @see {@link https://toolbox-x.nazmul-nhb.dev/docs/utils/object/parse-json-to-object parseJsonToObject} for strict object-only parsing.
|
|
241
|
+
*/
|
|
242
|
+
declare const parseJSON: <T = unknown>(value: string, parsePrimitives?: boolean) => T;
|
|
243
|
+
/**
|
|
244
|
+
* * Recursively parses primitive values inside objects and arrays.
|
|
245
|
+
*
|
|
246
|
+
* @typeParam T - Expected return type after parsing (default is unknown).
|
|
247
|
+
* @param input - Any input value to parse recursively.
|
|
248
|
+
* @returns Input with primitives (strings like "true", "123") converted, typed as `T`.
|
|
249
|
+
*/
|
|
250
|
+
declare function deepParsePrimitives<T = unknown>(input: unknown): T;
|
|
251
|
+
/**
|
|
252
|
+
* * Defines a method on any prototype — including built-in prototypes — in a safe, idempotent manner.
|
|
253
|
+
* - The method is non-enumerable by default and will not overwrite an existing method unless explicitly allowed.
|
|
254
|
+
*
|
|
255
|
+
* @param proto The target prototype object (e.g., String.prototype).
|
|
256
|
+
* @param name The method name to define on the prototype.
|
|
257
|
+
* @param impl The function implementation for the method.
|
|
258
|
+
* @param options Optional property-descriptor settings and overwrite rules.
|
|
259
|
+
*
|
|
260
|
+
* @example
|
|
261
|
+
* // Safely augment prototype methods by extending the global interface:
|
|
262
|
+
* declare global {
|
|
263
|
+
* interface String {
|
|
264
|
+
* toBang(): string;
|
|
265
|
+
* }
|
|
266
|
+
* }
|
|
267
|
+
*
|
|
268
|
+
* // Define a custom method on String.prototype
|
|
269
|
+
* definePrototypeMethod(String.prototype, 'toBang', function (this: String) {
|
|
270
|
+
* return this.toString().concat('!');
|
|
271
|
+
* // or
|
|
272
|
+
* // return this.concat('!');
|
|
273
|
+
* });
|
|
274
|
+
*
|
|
275
|
+
* "Hi".toBang(); // "Hi!"
|
|
276
|
+
*
|
|
277
|
+
* // Attempting to redefine without overwrite option is ignored
|
|
278
|
+
* definePrototypeMethod(String.prototype, 'toBang', () => 'x'); // ignored
|
|
279
|
+
*
|
|
280
|
+
* // Overwrite intentionally using the overwrite option
|
|
281
|
+
* definePrototypeMethod(
|
|
282
|
+
* String.prototype,
|
|
283
|
+
* 'toBang',
|
|
284
|
+
* function (this: String) { return this.concat('!!!'); },
|
|
285
|
+
* { overwrite: true }
|
|
286
|
+
* );
|
|
287
|
+
*
|
|
288
|
+
* "Hi".toBang(); // "Hi!!!"
|
|
289
|
+
*/
|
|
290
|
+
declare function definePrototypeMethod<Proto extends object, Name extends keyof Proto, Args extends unknown[], Return>(proto: Proto, name: Name, impl: (...args: Args) => Return, options?: ProtoMethodOptions): void;
|
|
291
|
+
//#endregion
|
|
292
|
+
export { shuffleArray as C, isInvalidOrEmptyArray as S, findPrimeNumbers as _, deepParsePrimitives as a, flattenArray as b, getInstanceGetterNames as c, getStaticMethodNames as d, isDeepEqual as f, throttleAction as g, stripJsonEdgeGarbage as h, debounceAction as i, getInstanceMethodNames as l, stableStringify as m, countInstanceMethods as n, definePrototypeMethod as o, parseJSON as p, countStaticMethods as r, getClassDetails as s, convertArrayToString as t, getStaticGetterNames as u, isPrime as v, getLastArrayElement as x, filterArrayOfObjects as y };
|