toolbox-x 1.2.1 → 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-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-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-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-DT7jbWx7.cjs} +3 -3
- package/dist/{parse-BhZ6-tKg.mjs → parse-erxBG2hd.mjs} +3 -3
- 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-BxguWSoa.cjs +0 -568
- package/dist/utils-DXovsTKs.mjs +0 -449
package/dist/index.d.cts
CHANGED
|
@@ -14,11 +14,12 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import { $
|
|
18
|
-
import {
|
|
19
|
-
import { n as convertStringCase, t as capitalizeString } from "./case
|
|
20
|
-
import { n as
|
|
21
|
-
import { a as
|
|
17
|
+
import { $n as PercentageOptions, D as NumericDotKey, E as NestedPrimitiveKey, F as SanitizeOptions, Fn as ConvertOptions, I as SanitizedData, In as ConvertedDecimal, Jn as LocaleCode, Ln as CurrencyCode, O as ObjectEntry, Pn as BnDigitResult, Q as FlattenPartial, Rn as DecimalOptions, V as BasicPrimitive, Vn as FrankFurterCurrency, Yn as LooseRomanNumeral, Zn as NumberType, a as ConvertObjectOptions, c as DeepKeys, ct as Numeric, di as Unit, er as RandomNumberOptions, g as FlattenDotValue, k as Objects, lt as OwnKeys, nr as RangedNumbers, nt as Maybe, o as ConvertedObject, oi as Tuple, p as ExpandAll, rr as RomanCapital, s as CountryDetails, tr as RangeOptions, u as DotNotationKey, ut as PartialOrRequired, v as FlattenLeafValue, w as MergeAll, y as GenericObject, z as Any } from "./object-X5fSMx-I.cjs";
|
|
18
|
+
import { T as DiffResult, f as AnagramOptions, g as CharDiffResult, j as MaskOptions } from "./string-CO7HP50i.cjs";
|
|
19
|
+
import { n as convertStringCase, t as capitalizeString } from "./case-DkYSKSeV.cjs";
|
|
20
|
+
import { c as OrderOption, l as SortByOption, n as FindOptions, s as OptionsConfig, t as FieldValue, u as SortNature } from "./array-DJAq9Qj8.cjs";
|
|
21
|
+
import { C as shuffleArray, S as isInvalidOrEmptyArray, _ as findPrimeNumbers, a as deepParsePrimitives, b as flattenArray, c as getInstanceGetterNames, d as getStaticMethodNames, f as isDeepEqual, g as throttleAction, h as stripJsonEdgeGarbage, i as debounceAction, l as getInstanceMethodNames, m as stableStringify, n as countInstanceMethods, o as definePrototypeMethod, p as parseJSON, r as countStaticMethods, s as getClassDetails, t as convertArrayToString, u as getStaticGetterNames, v as isPrime, x as getLastArrayElement, y as filterArrayOfObjects } from "./index-C5FoCCbF.cjs";
|
|
22
|
+
import { n as trimString, r as truncateString, t as generateRandomID } from "./basics-D4yU0NQ_.cjs";
|
|
22
23
|
|
|
23
24
|
//#region src/string/anagram.d.ts
|
|
24
25
|
/**
|
|
@@ -77,6 +78,8 @@ declare const maskString: (input: string, options?: MaskOptions) => string;
|
|
|
77
78
|
* * Reverses a given string.
|
|
78
79
|
* @param input - The string to reverse.
|
|
79
80
|
* @returns The reversed string.
|
|
81
|
+
*
|
|
82
|
+
* @remarks It {@link trimString trims} the whitespace of the input string before reversing it.
|
|
80
83
|
*/
|
|
81
84
|
declare const reverseString: (input: string) => string;
|
|
82
85
|
/**
|
|
@@ -100,7 +103,7 @@ declare function extractURLs(str: string): string[];
|
|
|
100
103
|
/**
|
|
101
104
|
* * Returns a grammatically correct unit string, optionally prefixed with the number.
|
|
102
105
|
*
|
|
103
|
-
* @remarks For complex and versatile pluralization, please refer to {@link https://toolbox-x.nazmul-nhb.dev/docs/
|
|
106
|
+
* @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.
|
|
104
107
|
*
|
|
105
108
|
* @param count The numeric value to determine singular or plural.
|
|
106
109
|
* @param unit The unit name (e.g., "day", "hour").
|
|
@@ -433,10 +436,12 @@ declare function getNthFibonacci(index: Numeric): number;
|
|
|
433
436
|
//#region src/number/convert.d.ts
|
|
434
437
|
/**
|
|
435
438
|
* * Converts a numeric value into its corresponding English word representation.
|
|
436
|
-
* @warning ***Supports numeric values up to `10e19` or `10^20` (one hundred quintillion).***
|
|
437
|
-
* @warning ***Decimal values are ignored; only the integer part is converted.***
|
|
438
439
|
* @param number - The number to convert into words.
|
|
439
440
|
* @returns The number converted in words.
|
|
441
|
+
*
|
|
442
|
+
* @warning
|
|
443
|
+
* - Supports numeric values up to `10e19` (`10^20`) (one hundred quintillion).
|
|
444
|
+
* - Decimal values are ignored; only the integer part is converted.
|
|
440
445
|
*/
|
|
441
446
|
declare function numberToWords(num: Numeric): string;
|
|
442
447
|
/**
|
|
@@ -533,23 +538,6 @@ declare function banglaToDigit<Force extends boolean = true>(bnDigit: string, fo
|
|
|
533
538
|
*/
|
|
534
539
|
declare function digitToBangla(digit: number | string, preserveNonDigit?: boolean): string;
|
|
535
540
|
//#endregion
|
|
536
|
-
//#region src/number/prime.d.ts
|
|
537
|
-
/**
|
|
538
|
-
* * Checks if a number is prime.
|
|
539
|
-
*
|
|
540
|
-
* @param number The number to check.
|
|
541
|
-
* @returns Boolean: `true` if the number is prime, otherwise `false`.
|
|
542
|
-
*/
|
|
543
|
-
declare const isPrime: (number: number) => boolean;
|
|
544
|
-
/**
|
|
545
|
-
* * Find prime numbers in a given range.
|
|
546
|
-
*
|
|
547
|
-
* @param start The starting number of the range. Default is `1`.
|
|
548
|
-
* @param end The ending number of the range. Default is `1000`.
|
|
549
|
-
* @returns An array of prime numbers within the range (inclusive).
|
|
550
|
-
*/
|
|
551
|
-
declare const findPrimeNumbers: (start?: number, end?: number) => number[];
|
|
552
|
-
//#endregion
|
|
553
541
|
//#region src/number/utilities.d.ts
|
|
554
542
|
/**
|
|
555
543
|
* * Rounds a number to the nearest specified interval.
|
|
@@ -622,47 +610,6 @@ declare function normalizeNumber(num: unknown): Maybe<number>;
|
|
|
622
610
|
*/
|
|
623
611
|
declare function getNumbersInRange<T extends boolean = false>(type?: NumberType, options?: RangeOptions<T>): RangedNumbers<T>;
|
|
624
612
|
//#endregion
|
|
625
|
-
//#region src/array/basics.d.ts
|
|
626
|
-
/**
|
|
627
|
-
* * Flattens a nested array recursively or wraps any non-array data type in an array.
|
|
628
|
-
*
|
|
629
|
-
* @param input - The input value, which can be a nested array or a non-array value.
|
|
630
|
-
* @returns A fully flattened array of type `Flatten<T>`. If the input is not an array, it wraps it in a single-element array.
|
|
631
|
-
*/
|
|
632
|
-
declare const flattenArray: <T>(input: T | T[]) => Flattened<T>[];
|
|
633
|
-
/**
|
|
634
|
-
* @deprecated _Please, use `findAll` instance method from `Finder` class for **more advanced filtering and searching.**_
|
|
635
|
-
*
|
|
636
|
-
* * Filters an array of objects based on multiple conditions for specified keys.
|
|
637
|
-
* @param array - The array of objects to filter.
|
|
638
|
-
* @param conditions - An object where keys represent the property names and values represent filter conditions.
|
|
639
|
-
* The conditions can be a function `(value: T[K]) => boolean`.
|
|
640
|
-
* @returns The filtered array of objects.
|
|
641
|
-
* @throws `Error` If the input is not a valid array.
|
|
642
|
-
*/
|
|
643
|
-
declare const filterArrayOfObjects: <T extends GenericObject>(array: T[], conditions: { [K in keyof T]?: (value: Maybe<T[K]>) => boolean }) => T[];
|
|
644
|
-
/**
|
|
645
|
-
* * Checks if a value is an empty array or an array with only empty values.
|
|
646
|
-
*
|
|
647
|
-
* @param value - The value to check.
|
|
648
|
-
* @returns `true` if the value is not an array, an empty array, or an array containing only `null`, `undefined`, empty objects, or empty arrays.
|
|
649
|
-
*/
|
|
650
|
-
declare const isInvalidOrEmptyArray: <T>(value: T) => boolean;
|
|
651
|
-
/**
|
|
652
|
-
* * Shuffle the elements of an array.
|
|
653
|
-
*
|
|
654
|
-
* @param array Array to shuffle.
|
|
655
|
-
* @returns Shuffled array.
|
|
656
|
-
*/
|
|
657
|
-
declare const shuffleArray: <T>(array: T[]) => T[];
|
|
658
|
-
/**
|
|
659
|
-
* * Get the last element of an array.
|
|
660
|
-
*
|
|
661
|
-
* @param array Array to get the last element from.
|
|
662
|
-
* @returns The last element or `undefined` if the array is empty.
|
|
663
|
-
*/
|
|
664
|
-
declare const getLastArrayElement: <T>(array: T[]) => Maybe<T>;
|
|
665
|
-
//#endregion
|
|
666
613
|
//#region src/array/calc.d.ts
|
|
667
614
|
/**
|
|
668
615
|
* * Calculates the sum of differences between two numeric fields for each item in the array.
|
|
@@ -1031,6 +978,17 @@ declare function extractObjectKeys<T extends GenericObject>(obj: T, tuple: true)
|
|
|
1031
978
|
* @returns An array of all the nested keys (string literals) from the specified object.
|
|
1032
979
|
*/
|
|
1033
980
|
declare function extractObjectKeysDeep<T extends GenericObject>(obj: T): Array<DeepKeys<T>>;
|
|
981
|
+
/**
|
|
982
|
+
* * Extracts all the top-level entries of an object as an array of key-value pairs.
|
|
983
|
+
*
|
|
984
|
+
* @remarks
|
|
985
|
+
* - Returns an empty array (`[]`) for an empty object or a non-object value.
|
|
986
|
+
* - Internally uses {@link Object.entries}.
|
|
987
|
+
*
|
|
988
|
+
* @param obj The object from which to extract the entries.
|
|
989
|
+
* @returns An array of key-value pairs.
|
|
990
|
+
*/
|
|
991
|
+
declare function extractObjectEntries<T extends GenericObject>(obj: T): Array<ObjectEntry<T>>;
|
|
1034
992
|
//#endregion
|
|
1035
993
|
//#region src/object/objectify.d.ts
|
|
1036
994
|
/**
|
|
@@ -1248,219 +1206,6 @@ declare function pickObjectFieldsByCondition<T extends GenericObject>(source: T,
|
|
|
1248
1206
|
*/
|
|
1249
1207
|
declare function remapFields<Source extends GenericObject, Target extends Record<string, keyof Source>>(source: Source, fieldMap: Target): { [K in keyof Target]: Source[Target[K]] };
|
|
1250
1208
|
//#endregion
|
|
1251
|
-
//#region src/utils/index.d.ts
|
|
1252
|
-
/**
|
|
1253
|
-
* * Deeply compare two values (arrays, objects, or primitive values).
|
|
1254
|
-
*
|
|
1255
|
-
* @param a First value to compare.
|
|
1256
|
-
* @param b Second value to compare.
|
|
1257
|
-
* @returns Whether the values are deeply equal.
|
|
1258
|
-
*/
|
|
1259
|
-
declare const isDeepEqual: (a: unknown, b: unknown) => boolean;
|
|
1260
|
-
/**
|
|
1261
|
-
* * Converts an array of objects to a string using a specific property (supports nested path to primitive values) and separator.
|
|
1262
|
-
*
|
|
1263
|
-
* @example
|
|
1264
|
-
* const users = [
|
|
1265
|
-
* { id: 1, name: { first: 'Alice' }, city: 'Bangu', },
|
|
1266
|
-
* { id: 4, name: { first: 'Bob' }, city: 'Banguland', },
|
|
1267
|
-
* ];
|
|
1268
|
-
* convertArrayToString(users, { target: 'name.first', separator: ' | ' });
|
|
1269
|
-
* // "Alice | Bob"
|
|
1270
|
-
*
|
|
1271
|
-
* @param array Array of objects to convert.
|
|
1272
|
-
* @param options Options including the target property and separator.
|
|
1273
|
-
* @returns String formed by joining the property values with the given separator.
|
|
1274
|
-
*/
|
|
1275
|
-
declare function convertArrayToString<T extends GenericObject>(array: Maybe<T[]>, options: ArrayOfObjectsToStringOptions<T>): string;
|
|
1276
|
-
/**
|
|
1277
|
-
* * Converts an array of primitive values to a string using a custom separator.
|
|
1278
|
-
*
|
|
1279
|
-
* @example
|
|
1280
|
-
* convertArrayToString(['red', 'green', 'blue'], { separator: ' - ' });
|
|
1281
|
-
* // "red - green - blue"
|
|
1282
|
-
*
|
|
1283
|
-
* @example
|
|
1284
|
-
* convertArrayToString([1, 2, 3]);
|
|
1285
|
-
* // "1, 2, 3"
|
|
1286
|
-
*
|
|
1287
|
-
* @param array Array of primitive values to convert.
|
|
1288
|
-
* @param options Optional separator configuration.
|
|
1289
|
-
* @returns String formed by joining array elements with the given separator.
|
|
1290
|
-
*/
|
|
1291
|
-
declare function convertArrayToString<T extends Primitive>(array: Maybe<T[]>, options?: ArrayOfPrimitivesToStringOptions): string;
|
|
1292
|
-
/**
|
|
1293
|
-
* * A generic debounce function that delays the execution of a callback.
|
|
1294
|
-
*
|
|
1295
|
-
* @param callback - The function to debounce.
|
|
1296
|
-
* @param delay - The delay in milliseconds. Default is `300ms`.
|
|
1297
|
-
* @returns A debounced version of the callback function.
|
|
1298
|
-
*
|
|
1299
|
-
* @example
|
|
1300
|
-
* const debouncedSearch = debounceAction((query: string) => {
|
|
1301
|
-
* console.log(`Searching for: ${query}`);
|
|
1302
|
-
* }, 300);
|
|
1303
|
-
*
|
|
1304
|
-
* debouncedSearch('laptop'); // Executes after 300ms of inactivity.
|
|
1305
|
-
*/
|
|
1306
|
-
declare function debounceAction<T extends VoidFn>(callback: T, delay?: number): DelayedFn<T>;
|
|
1307
|
-
/**
|
|
1308
|
-
* * A generic throttle function that ensures a callback is executed at most once per specified interval.
|
|
1309
|
-
*
|
|
1310
|
-
* @param callback - The function to throttle.
|
|
1311
|
-
* @param delay - The delay in milliseconds. Default is `150ms`.
|
|
1312
|
-
* @returns A throttled version of the callback function.
|
|
1313
|
-
*
|
|
1314
|
-
* @example
|
|
1315
|
-
* const throttledResize = throttleAction(() => {
|
|
1316
|
-
* console.log('Resized');
|
|
1317
|
-
* }, 300);
|
|
1318
|
-
*
|
|
1319
|
-
* window.addEventListener('resize', throttledResize);
|
|
1320
|
-
*/
|
|
1321
|
-
declare function throttleAction<T extends VoidFn>(callback: T, delay?: number): DelayedFn<T>;
|
|
1322
|
-
/**
|
|
1323
|
-
* * Retrieves the names of all instance methods defined directly on a class prototype.
|
|
1324
|
-
*
|
|
1325
|
-
* @param cls - The class constructor (not an instance).
|
|
1326
|
-
* @returns A sorted array of instance method names.
|
|
1327
|
-
*/
|
|
1328
|
-
declare function getInstanceMethodNames(cls: Constructor): string[];
|
|
1329
|
-
/**
|
|
1330
|
-
* * Retrieves the names of all static methods defined directly on a class constructor.
|
|
1331
|
-
*
|
|
1332
|
-
* @param cls - The class constructor (not an instance).
|
|
1333
|
-
* @returns A sorted array of static method names.
|
|
1334
|
-
*/
|
|
1335
|
-
declare function getStaticMethodNames(cls: Constructor): string[];
|
|
1336
|
-
/**
|
|
1337
|
-
* * Counts the number of instance methods defined directly on a class prototype.
|
|
1338
|
-
*
|
|
1339
|
-
* @param cls - The class constructor (not an instance).
|
|
1340
|
-
* @returns The number of instance methods defined on the class prototype.
|
|
1341
|
-
*/
|
|
1342
|
-
declare function countInstanceMethods(cls: Constructor): number;
|
|
1343
|
-
/**
|
|
1344
|
-
* * Counts the number of static methods defined directly on a class constructor.
|
|
1345
|
-
*
|
|
1346
|
-
* @param cls - The class constructor (not an instance).
|
|
1347
|
-
* @returns The number of static methods defined on the class constructor.
|
|
1348
|
-
*/
|
|
1349
|
-
declare function countStaticMethods(cls: Constructor): number;
|
|
1350
|
-
/**
|
|
1351
|
-
* * Retrieves the names of all instance getters defined directly on a class prototype.
|
|
1352
|
-
*
|
|
1353
|
-
* @param cls - The class constructor (not an instance).
|
|
1354
|
-
* @returns A sorted array of instance getter names.
|
|
1355
|
-
*/
|
|
1356
|
-
declare function getInstanceGetterNames(cls: Constructor): string[];
|
|
1357
|
-
/**
|
|
1358
|
-
* * Retrieves the names of all static getters defined directly on a class constructor.
|
|
1359
|
-
*
|
|
1360
|
-
* @param cls - The class constructor (not an instance).
|
|
1361
|
-
* @returns A sorted array of static getter names.
|
|
1362
|
-
*/
|
|
1363
|
-
declare function getStaticGetterNames(cls: Constructor): string[];
|
|
1364
|
-
/**
|
|
1365
|
-
* * Gathers detailed information about the instance and static methods of a class.
|
|
1366
|
-
*
|
|
1367
|
-
* @param cls - The class constructor (not an instance).
|
|
1368
|
-
* @returns An object containing names and counts of instance and static methods.
|
|
1369
|
-
*/
|
|
1370
|
-
declare function getClassDetails(cls: Constructor): ClassDetails;
|
|
1371
|
-
/**
|
|
1372
|
-
* * Create a deterministic JSON string representation of any value.
|
|
1373
|
-
* - The output format matches standard JSON but with guaranteed sorted keys.
|
|
1374
|
-
*
|
|
1375
|
-
* @remarks
|
|
1376
|
-
* - This function guarantees **stable, repeatable output** by:
|
|
1377
|
-
* - Sorting all object keys alphabetically.
|
|
1378
|
-
* - Recursively stabilizing nested objects and arrays.
|
|
1379
|
-
* - Converting all `undefined` values into `null` so the output remains valid JSON.
|
|
1380
|
-
* - 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.
|
|
1381
|
-
* - Falling back to native JSON serialization for primitives.
|
|
1382
|
-
*
|
|
1383
|
-
* - **Useful for:**
|
|
1384
|
-
* - Hash generation (e.g., signatures, cache keys)
|
|
1385
|
-
* - Deep equality checks
|
|
1386
|
-
* - Producing predictable output across environments
|
|
1387
|
-
*
|
|
1388
|
-
* @param obj - The value to stringify into a deterministic JSON string.
|
|
1389
|
-
* @returns A stable, deterministic string representation of the input.
|
|
1390
|
-
*/
|
|
1391
|
-
declare function stableStringify(obj: unknown): string;
|
|
1392
|
-
/**
|
|
1393
|
-
* * Remove trailing or leading garbage characters **after/before JSON object or array**.
|
|
1394
|
-
* @param str String to sanitize/strip.
|
|
1395
|
-
* @returns Sanitized/stripped JSON string.
|
|
1396
|
-
*/
|
|
1397
|
-
declare function stripJsonEdgeGarbage(str: string): string;
|
|
1398
|
-
/**
|
|
1399
|
-
* * Parses any valid JSON string, optionally converting stringified primitives inside (nested) arrays or objects.
|
|
1400
|
-
*
|
|
1401
|
-
* @typeParam T - Expected return type (default is unknown).
|
|
1402
|
-
* @param value - The JSON string to parse.
|
|
1403
|
-
* @param parsePrimitives - Whether to convert stringified primitives (default: `true`).
|
|
1404
|
-
* @returns The parsed JSON value typed as `T`, or the original parsed value with optional primitive conversion.
|
|
1405
|
-
* - Returns `{}` if parsing fails, such as when the input is malformed or invalid JSON or passing single quoted string.
|
|
1406
|
-
*
|
|
1407
|
-
* - *Unlike {@link https://toolbox-x.nazmul-nhb.dev/docs/utilities/object/parseJsonToObject parseJsonToObject}, which ensures the root value is an object,
|
|
1408
|
-
* this function returns any valid JSON structure such as arrays, strings, numbers, or objects.*
|
|
1409
|
-
*
|
|
1410
|
-
* This is useful when you're not sure of the root structure of the JSON, or when you expect something other than an object.
|
|
1411
|
-
*
|
|
1412
|
-
* @see {@link https://toolbox-x.nazmul-nhb.dev/docs/utilities/object/parseJsonToObject parseJsonToObject} for strict object-only parsing.
|
|
1413
|
-
*/
|
|
1414
|
-
declare const parseJSON: <T = unknown>(value: string, parsePrimitives?: boolean) => T;
|
|
1415
|
-
/**
|
|
1416
|
-
* * Recursively parses primitive values inside objects and arrays.
|
|
1417
|
-
*
|
|
1418
|
-
* @typeParam T - Expected return type after parsing (default is unknown).
|
|
1419
|
-
* @param input - Any input value to parse recursively.
|
|
1420
|
-
* @returns Input with primitives (strings like "true", "123") converted, typed as `T`.
|
|
1421
|
-
*/
|
|
1422
|
-
declare function deepParsePrimitives<T = unknown>(input: unknown): T;
|
|
1423
|
-
/**
|
|
1424
|
-
* * Defines a method on any prototype — including built-in prototypes — in a safe, idempotent manner.
|
|
1425
|
-
* - The method is non-enumerable by default and will not overwrite an existing method unless explicitly allowed.
|
|
1426
|
-
*
|
|
1427
|
-
* @param proto The target prototype object (e.g., String.prototype).
|
|
1428
|
-
* @param name The method name to define on the prototype.
|
|
1429
|
-
* @param impl The function implementation for the method.
|
|
1430
|
-
* @param options Optional property-descriptor settings and overwrite rules.
|
|
1431
|
-
*
|
|
1432
|
-
* @example
|
|
1433
|
-
* // Safely augment prototype methods by extending the global interface:
|
|
1434
|
-
* declare global {
|
|
1435
|
-
* interface String {
|
|
1436
|
-
* toBang(): string;
|
|
1437
|
-
* }
|
|
1438
|
-
* }
|
|
1439
|
-
*
|
|
1440
|
-
* // Define a custom method on String.prototype
|
|
1441
|
-
* definePrototypeMethod(String.prototype, 'toBang', function (this: String) {
|
|
1442
|
-
* return this.toString().concat('!');
|
|
1443
|
-
* // or
|
|
1444
|
-
* // return this.concat('!');
|
|
1445
|
-
* });
|
|
1446
|
-
*
|
|
1447
|
-
* "Hi".toBang(); // "Hi!"
|
|
1448
|
-
*
|
|
1449
|
-
* // Attempting to redefine without overwrite option is ignored
|
|
1450
|
-
* definePrototypeMethod(String.prototype, 'toBang', () => 'x'); // ignored
|
|
1451
|
-
*
|
|
1452
|
-
* // Overwrite intentionally using the overwrite option
|
|
1453
|
-
* definePrototypeMethod(
|
|
1454
|
-
* String.prototype,
|
|
1455
|
-
* 'toBang',
|
|
1456
|
-
* function (this: String) { return this.concat('!!!'); },
|
|
1457
|
-
* { overwrite: true }
|
|
1458
|
-
* );
|
|
1459
|
-
*
|
|
1460
|
-
* "Hi".toBang(); // "Hi!!!"
|
|
1461
|
-
*/
|
|
1462
|
-
declare function definePrototypeMethod<Proto extends object, Name extends keyof Proto>(proto: Proto, name: Name, impl: (...args: unknown[]) => unknown, options?: ProtoMethodOptions): void;
|
|
1463
|
-
//#endregion
|
|
1464
1209
|
//#region src/utils/xtras.d.ts
|
|
1465
1210
|
/**
|
|
1466
1211
|
* @function `getCountryByPhone` Get country details by matching the country code in the given phone number.
|
|
@@ -1490,4 +1235,4 @@ declare function definePrototypeMethod<Proto extends object, Name extends keyof
|
|
|
1490
1235
|
*/
|
|
1491
1236
|
declare function getCountryByPhone(phone: number | string): CountryDetails[];
|
|
1492
1237
|
//#endregion
|
|
1493
|
-
export { Currency, Finder, Unit, Unit as UnitConverter, convertToRomanNumerals as arabicToRoman, convertToRomanNumerals, convertToRomanNumerals as integerToRoman, convertToRomanNumerals as numberToRoman, convertToRomanNumerals as numericToRoman, convertToRomanNumerals as toRoman, convertToRomanNumerals as toRomanNumeral, averageByField, averageByField as avgByField, banglaToDigit, getAverage as calculateAverage, getAverage, getAverage as getAverageOfNumbers, factorial as calculateFactorial, factorial, factorial as getFactorial, calculateHCF as calculateGCD, calculateHCF, calculateLCM as calculateLCD, calculateLCM, calculatePercentage, capitalizeString, getOrdinal as cardinalToOrdinal, getOrdinal as convertNumberToOrdinal, getOrdinal as convertToOrdinal, getOrdinal, getOrdinal as getOrdinalNumber, getOrdinal as numberToOrdinal, numberToWordsOrdinal as cardinalWordsToOrdinal, numberToWordsOrdinal as convertNumberToWordsOrdinal, numberToWordsOrdinal, clampNumber, cloneObject, naturalSort as compareNaturally, naturalSort as compareSorter, naturalSort, naturalSort as naturalSortForString, computeTextDiff, convertArrayToString, convertArrayToString as joinArrayElements, formatCurrency as convertNumberToCurrency, formatCurrency, numberToWords as convertNumberToWords, numberToWords, convertObjectValues, romanToInteger as convertRomanToArabic, romanToInteger as convertRomanToInteger, romanToInteger as convertRomanToNumeric, romanToInteger as romanToArabic, romanToInteger, romanToInteger as romanToNumeric, convertStringCase, convertToDecimal, convertToDecimal as convertToFixed, wordsToNumber as convertWordToNumber, wordsToNumber as convertWordsToNumber, wordsToNumber as wordToNumber, wordsToNumber, countInstanceMethods, countInstanceMethods as getInstanceMethodsCount, countObjectFields, countStaticMethods, countStaticMethods as getStaticMethodsCount, countWords, countWords as countWordsInString, countWords as wordCount, createOptionsArray, debounceAction, deepParsePrimitives, deepParsePrimitives as parsePrimitivesDeep, definePrototypeMethod, deleteFields, deleteFields as deleteObjectFields, deleteFields as omitFields, deleteFields as omitObjectFields, deleteFields as removeFields, deleteFields as removeObjectFields, digitToBangla, getDuplicates as extractDuplicates, getDuplicates as extractDuplicatesFromArray, getDuplicates, getDuplicates as getDuplicatesFromArray, extractEmails, extractObjectKeys as extractKeys, extractObjectKeys, extractObjectKeysDeep as extractKeysDeep, extractObjectKeysDeep, findMissingElements as extractMissingElements, findMissingElements, findMissingElements as getMissingElements, extractNewFields, extractNumbersFromString as extractNumbers, extractNumbersFromString, extractNumbersFromString as parseNumbersFromText, extractURLs, extractUpdatedAndNewFields, extractUpdatedFields, getFactors as factorsOf, getFactors as getDivisors, getFactors, fibonacciGenerator, fibonacciGenerator as generateFibonacci, filterArrayOfObjects, findPrimeNumbers, findPrimeNumbers as getPrimeNumbers, flattenArray, flattenObjectDotNotation, flattenObjectKeyValue, formatUnitWithPlural as formatNumberWithPluralUnit, formatUnitWithPlural, formatUnitWithPlural as formatWithPlural, generateAnagrams, generateRandomID, getCharacterDifferences, getClassDetails, getCountryByPhone, getFibonacciSeries as getFibonacci, getFibonacciSeries as getFibonacciNumbers, getFibonacciSeries, getFibonacciSeriesMemo, getFibonacciSeriesMemo as getMemoizedFibonacci, getFibonacciSeriesMemo as getMemoizedFibonacciSeries, getInstanceGetterNames, getInstanceMethodNames, getLastArrayElement, getLevenshteinDistance, getLevenshteinDistance as levenshteinDistance, getNthFibonacci, getNumbersInRange, getRandomFloat as getRandomDecimal, getRandomFloat, getRandomNumber as getRandomInt, getRandomNumber, getStaticGetterNames, getStaticMethodNames, sumNumbers as getSumOfNumbers, sumNumbers, sumNumbers as sumOfNumbers, groupAndAverageByField, groupAndAverageByField as groupAndAvgByField, groupAndSumByField, splitArrayByProperty as groupArrayByProperty, splitArrayByProperty, isDeepEqual, isInvalidOrEmptyArray,
|
|
1238
|
+
export { Currency, Finder, Unit, Unit as UnitConverter, convertToRomanNumerals as arabicToRoman, convertToRomanNumerals, convertToRomanNumerals as integerToRoman, convertToRomanNumerals as numberToRoman, convertToRomanNumerals as numericToRoman, convertToRomanNumerals as toRoman, convertToRomanNumerals as toRomanNumeral, averageByField, averageByField as avgByField, banglaToDigit, getAverage as calculateAverage, getAverage, getAverage as getAverageOfNumbers, factorial as calculateFactorial, factorial, factorial as getFactorial, calculateHCF as calculateGCD, calculateHCF, calculateLCM as calculateLCD, calculateLCM, calculatePercentage, capitalizeString, getOrdinal as cardinalToOrdinal, getOrdinal as convertNumberToOrdinal, getOrdinal as convertToOrdinal, getOrdinal, getOrdinal as getOrdinalNumber, getOrdinal as numberToOrdinal, numberToWordsOrdinal as cardinalWordsToOrdinal, numberToWordsOrdinal as convertNumberToWordsOrdinal, numberToWordsOrdinal, clampNumber, cloneObject, naturalSort as compareNaturally, naturalSort as compareSorter, naturalSort, naturalSort as naturalSortForString, computeTextDiff, convertArrayToString, convertArrayToString as joinArrayElements, formatCurrency as convertNumberToCurrency, formatCurrency, numberToWords as convertNumberToWords, numberToWords, convertObjectValues, romanToInteger as convertRomanToArabic, romanToInteger as convertRomanToInteger, romanToInteger as convertRomanToNumeric, romanToInteger as romanToArabic, romanToInteger, romanToInteger as romanToNumeric, convertStringCase, convertToDecimal, convertToDecimal as convertToFixed, wordsToNumber as convertWordToNumber, wordsToNumber as convertWordsToNumber, wordsToNumber as wordToNumber, wordsToNumber, countInstanceMethods, countInstanceMethods as getInstanceMethodsCount, countObjectFields, countStaticMethods, countStaticMethods as getStaticMethodsCount, countWords, countWords as countWordsInString, countWords as wordCount, createOptionsArray, debounceAction, deepParsePrimitives, deepParsePrimitives as parsePrimitivesDeep, definePrototypeMethod, deleteFields, deleteFields as deleteObjectFields, deleteFields as omitFields, deleteFields as omitObjectFields, deleteFields as removeFields, deleteFields as removeObjectFields, digitToBangla, getDuplicates as extractDuplicates, getDuplicates as extractDuplicatesFromArray, getDuplicates, getDuplicates as getDuplicatesFromArray, extractEmails, extractObjectEntries as extractEntries, extractObjectEntries, extractObjectEntries as objectEntries, extractObjectKeys as extractKeys, extractObjectKeys, extractObjectKeysDeep as extractKeysDeep, extractObjectKeysDeep, findMissingElements as extractMissingElements, findMissingElements, findMissingElements as getMissingElements, extractNewFields, extractNumbersFromString as extractNumbers, extractNumbersFromString, extractNumbersFromString as parseNumbersFromText, extractURLs, extractUpdatedAndNewFields, extractUpdatedFields, getFactors as factorsOf, getFactors as getDivisors, getFactors, fibonacciGenerator, fibonacciGenerator as generateFibonacci, filterArrayOfObjects, findPrimeNumbers, findPrimeNumbers as getPrimeNumbers, flattenArray, flattenObjectDotNotation, flattenObjectKeyValue, formatUnitWithPlural as formatNumberWithPluralUnit, formatUnitWithPlural, formatUnitWithPlural as formatWithPlural, generateAnagrams, generateRandomID, getCharacterDifferences, getClassDetails, getCountryByPhone, getFibonacciSeries as getFibonacci, getFibonacciSeries as getFibonacciNumbers, getFibonacciSeries, getFibonacciSeriesMemo, getFibonacciSeriesMemo as getMemoizedFibonacci, getFibonacciSeriesMemo as getMemoizedFibonacciSeries, getInstanceGetterNames, getInstanceMethodNames, getLastArrayElement, getLevenshteinDistance, getLevenshteinDistance as levenshteinDistance, getNthFibonacci, getNumbersInRange, getRandomFloat as getRandomDecimal, getRandomFloat, getRandomNumber as getRandomInt, getRandomNumber, getStaticGetterNames, getStaticMethodNames, sumNumbers as getSumOfNumbers, sumNumbers, sumNumbers as sumOfNumbers, groupAndAverageByField, groupAndAverageByField as groupAndAvgByField, groupAndSumByField, splitArrayByProperty as groupArrayByProperty, splitArrayByProperty, isDeepEqual, isInvalidOrEmptyArray, isPrime, isPrime as isPrimeNumber, maskString, mergeAndFlattenObjects, mergeObjects, moveArrayElement, normalizeNumber, normalizeString, parseJSON, parseJSON as parseJsonDeep, parseJsonToObject, parseObjectValues, parseObjectValues as parseStringifiedObjectValues, pickFields, pickFields as pickObjectFields, pickObjectFieldsByCondition as pickFieldsByCondition, pickObjectFieldsByCondition, remapFields, remapFields as remapObjectFields, removeDuplicatesFromArray as removeDuplicates, removeDuplicatesFromArray, replaceAllInString, reverseNumber, reverseString, rotateArray, roundNumber, roundNumber as roundToDecimal, roundToNearest as roundNumberToNearestInterval, roundToNearest, roundToNearest as roundToNearestInterval, sanitizeData, shuffleArray, slugifyString, sortAnArray, splitArray, stableStringify, stripJsonEdgeGarbage, sumByField, sumDigits, sumFieldDifference, sumFieldDifference as totalDeltaByField, throttleAction, trimString, truncateString };
|