toolbox-x 2.2.5 → 2.4.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/CHANGELOG.md +18 -0
- package/dist/{guards-Dc9MB9on.mjs → basics-B7Sqf33u.mjs} +233 -233
- package/dist/{guards-BSwFQX1M.cjs → basics-Cif013VV.cjs} +233 -233
- package/dist/{colors.cjs → colors/index.cjs} +6 -6
- package/dist/{colors.d.mts → colors/index.d.cts} +2 -2
- package/dist/{colors.d.cts → colors/index.d.mts} +2 -2
- package/dist/{colors.mjs → colors/index.mjs} +6 -6
- package/dist/constants.cjs +13 -13
- package/dist/constants.mjs +3 -3
- package/dist/{converter.cjs → converter/index.cjs} +1 -1
- package/dist/{converter.d.cts → converter/index.d.cts} +2 -2
- package/dist/{converter.d.mts → converter/index.d.mts} +2 -2
- package/dist/{converter.mjs → converter/index.mjs} +1 -1
- package/dist/{date.cjs → date/index.cjs} +7 -7
- package/dist/{date.d.cts → date/index.d.cts} +1 -1
- package/dist/{date.d.mts → date/index.d.mts} +1 -1
- package/dist/{date.mjs → date/index.mjs} +7 -7
- package/dist/{dom.cjs → dom/index.cjs} +8 -8
- package/dist/{dom.d.cts → dom/index.d.cts} +3 -3
- package/dist/{dom.d.mts → dom/index.d.mts} +3 -3
- package/dist/{dom.mjs → dom/index.mjs} +5 -5
- package/dist/{guards.cjs → guards/index.cjs} +38 -38
- package/dist/{guards.d.mts → guards/index.d.cts} +4 -4
- package/dist/{guards.d.cts → guards/index.d.mts} +4 -4
- package/dist/{guards.mjs → guards/index.mjs} +6 -6
- package/dist/{guards-CqbVT4L5.cjs → guards-BD2Fkugj.cjs} +2 -2
- package/dist/{guards-DKGBsd6x.mjs → guards-DBunDnng.mjs} +2 -2
- package/dist/{hash.cjs → hash/index.cjs} +69 -66
- package/dist/{hash.d.cts → hash/index.d.cts} +77 -5
- package/dist/{hash.d.mts → hash/index.d.mts} +77 -5
- package/dist/{hash.mjs → hash/index.mjs} +5 -5
- package/dist/{http-status.cjs → http-status/index.cjs} +1 -1
- package/dist/{http-status.d.mts → http-status/index.d.cts} +2 -2
- package/dist/{http-status.d.cts → http-status/index.d.mts} +2 -2
- package/dist/{http-status.mjs → http-status/index.mjs} +1 -1
- package/dist/index.cjs +157 -87
- package/dist/index.d.cts +46 -1
- package/dist/index.d.mts +46 -1
- package/dist/index.mjs +74 -8
- package/dist/{parse-TuFyLeVH.mjs → parse-CILDG7TG.mjs} +3 -3
- package/dist/{parse-jh637S25.cjs → parse-CffWYCuy.cjs} +3 -3
- package/dist/{query-sWSi-d7u.cjs → query-Blm7AiEZ.cjs} +9 -9
- package/dist/{query-BomnyWh3.mjs → query-PGFEup3p.mjs} +2 -2
- package/dist/{stylog.cjs → stylog/index.cjs} +5 -5
- package/dist/{stylog.d.cts → stylog/index.d.cts} +2 -2
- package/dist/{stylog.d.mts → stylog/index.d.mts} +2 -2
- package/dist/{stylog.mjs → stylog/index.mjs} +5 -5
- package/dist/types/pluralizer.d.cts +25 -1
- package/dist/types/pluralizer.d.mts +25 -1
- package/dist/{utilities-BSv8VbnM.mjs → utilities-CmPwOkdy.mjs} +1 -1
- package/dist/{utilities-BVpk3LKy.cjs → utilities-_COSGq1U.cjs} +1 -1
- package/dist/{basics-20lm69yy.mjs → utils-BO5CcsjK.mjs} +631 -548
- package/dist/{basics-byj0VH1c.cjs → utils-DR9g0Sef.cjs} +580 -479
- package/dist/{verbalizer.cjs → verbalizer/index.cjs} +1 -1
- package/dist/{verbalizer.mjs → verbalizer/index.mjs} +1 -1
- package/package.json +19 -23
- package/dist/pluralizer-DXMuPUAK.d.mts +0 -42
- package/dist/pluralizer-DYsDqq9c.d.cts +0 -42
- package/dist/pluralizer.cjs +0 -678
- package/dist/pluralizer.d.cts +0 -152
- package/dist/pluralizer.d.mts +0 -152
- package/dist/pluralizer.mjs +0 -676
- /package/dist/{verbalizer.d.cts → verbalizer/index.d.cts} +0 -0
- /package/dist/{verbalizer.d.mts → verbalizer/index.d.mts} +0 -0
package/dist/index.d.mts
CHANGED
|
@@ -292,6 +292,51 @@ declare function reverseNumber(num: Numeric): number;
|
|
|
292
292
|
* @returns The average of the provided numbers. Returns `NaN` if no numbers are valid.
|
|
293
293
|
*/
|
|
294
294
|
declare function getAverage(...numbers: Numeric[]): number;
|
|
295
|
+
/**
|
|
296
|
+
* * Returns the number of decimal places represented by a number.
|
|
297
|
+
*
|
|
298
|
+
* @param value - The number or numeric string for which to calculate the number of decimal places.
|
|
299
|
+
* @returns The number of decimal places.
|
|
300
|
+
*
|
|
301
|
+
* @throws - {@link TypeError} - If the input value cannot be converted to a number, e.g. `undefined`, `null`, `NaN`, `'11x'` etc..
|
|
302
|
+
*
|
|
303
|
+
* @remarks
|
|
304
|
+
* - If a numeric string in scientific notation (e.g., '1e-6') is provided, it will calculate the decimal places accordingly.
|
|
305
|
+
* - If a numeric string has trailing zeros (e.g., ''1.00'' or `'9.900'`),
|
|
306
|
+
* it will convert them as: `'1.00'` -> `1`, `'9.900'` -> `9.9` and return `0` and `1` respectively.
|
|
307
|
+
* - If a number is an integer, it will return `0`.
|
|
308
|
+
* - Internally uses {@link normalizeNumber} to normalize the input value.
|
|
309
|
+
*
|
|
310
|
+
* @example
|
|
311
|
+
* getDecimalPlaces(123.456); // 3
|
|
312
|
+
* getDecimalPlaces('123.45600'); // 3
|
|
313
|
+
* getDecimalPlaces(123); // 0
|
|
314
|
+
* getDecimalPlaces('1e-6'); // 6
|
|
315
|
+
* getDecimalPlaces('1.00'); // 0
|
|
316
|
+
* getDecimalPlaces('9.900'); // 1
|
|
317
|
+
*/
|
|
318
|
+
declare function getDecimalPlaces(value: Numeric): number;
|
|
319
|
+
/**
|
|
320
|
+
* * Adds numbers safely, avoiding floating-point arithmetic issues.
|
|
321
|
+
*
|
|
322
|
+
* @param values - A list of numbers or numeric strings to add.
|
|
323
|
+
* @returns The sum of the provided numbers, with floating-point inaccuracies mitigated.
|
|
324
|
+
*
|
|
325
|
+
* @remarks
|
|
326
|
+
* - This function addresses common floating-point addition errors (e.g., `0.1 + 0.2 !== 0.3`)
|
|
327
|
+
* by temporarily scaling numbers to integers, performing the addition, and then scaling back.
|
|
328
|
+
* - Non-numeric values are safely ignored in the runtime.
|
|
329
|
+
* - Rounding is used to mitigate floating-point inaccuracies.
|
|
330
|
+
* - Intended for use cases where floating-point inaccuracies are a concern.
|
|
331
|
+
* - Internally uses {@link normalizeNumber}, {@link getDecimalPlaces}, {@link roundNumber}.
|
|
332
|
+
* - It does not handle numbers beyond {@link Number.MAX_SAFE_INTEGER} or {@link Number.MIN_SAFE_INTEGER}.
|
|
333
|
+
* May output incorrect results if the numbers are too large.
|
|
334
|
+
* @example
|
|
335
|
+
* safeAdd(0.1, 0.2); // → 0.3 (correctly handles floating-point error)
|
|
336
|
+
* safeAdd(1, '2', 3.456); // → 6.456
|
|
337
|
+
* safeAdd(0.1, 0.2, 0.3, 0.4); // → 1.0 (accurate sum)
|
|
338
|
+
*/
|
|
339
|
+
declare function safeAdd(...values: Numeric[]): number;
|
|
295
340
|
/**
|
|
296
341
|
* * Rounds a number to a specified number of decimal places.
|
|
297
342
|
*
|
|
@@ -1235,4 +1280,4 @@ declare function remapFields<Source extends GenericObject, Target extends Record
|
|
|
1235
1280
|
*/
|
|
1236
1281
|
declare function getCountryByPhone(phone: number | string): CountryDetails[];
|
|
1237
1282
|
//#endregion
|
|
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,
|
|
1283
|
+
export { Currency, Finder, Unit, Unit as UnitConverter, safeAdd as add, safeAdd, convertToRomanNumerals as arabicToRoman, convertToRomanNumerals, convertToRomanNumerals as integerToRoman, convertToRomanNumerals as numberToRoman, convertToRomanNumerals as numericToRoman, convertToRomanNumerals as toRoman, convertToRomanNumerals as toRomanNumeral, getAverage as average, getAverage as calculateAverage, getAverage, averageByField, averageByField as avgByField, banglaToDigit, 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, generateQueryParams as createQueryParams, generateQueryParams as formatQueryParams, generateQueryParams, debounceAction, getDecimalPlaces as decimalPlaces, getDecimalPlaces, 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, parseQueryString as getQueryStringAsObject, parseQueryString, parseQueryString as queryStringToObject, 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, parseQueryStringLiteral as literalQueryStringToObject, parseQueryStringLiteral, 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 };
|
package/dist/index.mjs
CHANGED
|
@@ -16,13 +16,13 @@
|
|
|
16
16
|
|
|
17
17
|
import { a as isNonEmptyString, c as isNumber, d as isString, i as isInteger, m as isUndefined } from "./primitives-Djsevc69.mjs";
|
|
18
18
|
import { n as convertStringCase, t as capitalizeString } from "./case-DBC4Rj0h.mjs";
|
|
19
|
-
import { T as isObject, b as isFunction, d as isNumericString, j as isValidArray } from "./specials-krf7zsqI.mjs";
|
|
20
19
|
import { c as ORDINAL_UNDER_TEEN, d as TENS, f as THOUSANDS, l as PREFIX_MULTIPLIERS, o as ONES, s as ORDINAL_TO_CARDINAL, t as BN_DIGITS, u as TEENS } from "./constants-ZyfpysiQ.mjs";
|
|
21
|
-
import { a as normalizeNumber, i as getRandomFloat, n as formatCurrency, o as roundToNearest, r as getOrdinal, t as clampNumber } from "./utilities-BSv8VbnM.mjs";
|
|
22
20
|
import { t as COUNTRIES } from "./countries-CMxHxKiK.mjs";
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
21
|
+
import { $ as trimString, Q as generateRandomID, _ as naturalSort, a as deepParsePrimitives, b as _resolveNestedKey, c as getInstanceGetterNames, d as getStaticMethodNames, et as truncateString, 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 sortAnArray, y as _getNumericProp } from "./utils-BO5CcsjK.mjs";
|
|
22
|
+
import { T as isObject, b as isFunction, d as isNumericString, j as isValidArray } from "./specials-krf7zsqI.mjs";
|
|
23
|
+
import { A as replaceAllInString, C as isOdd, D as formatUnitWithPlural, E as extractURLs, M as slugifyString, O as maskString, T as extractEmails, _ as findPrimeNumbers, a as shuffleArray, b as isEven, c as extractObjectEntries, i as isInvalidOrEmptyArray, j as reverseString, k as normalizeString, l as extractObjectKeys, n as flattenArray, o as cloneObject, r as getLastArrayElement, s as countObjectFields, t as filterArrayOfObjects, u as extractObjectKeysDeep, v as isPrime, y as areInvalidNumbers } from "./basics-B7Sqf33u.mjs";
|
|
24
|
+
import { a as normalizeNumber, i as getRandomFloat, n as formatCurrency, o as roundToNearest, r as getOrdinal, t as clampNumber } from "./utilities-CmPwOkdy.mjs";
|
|
25
|
+
import { c as extractUpdatedFields, d as mergeAndFlattenObjects, f as mergeObjects, h as sanitizeData, i as parseQueryStringLiteral, l as flattenObjectDotNotation, m as parseObjectValues, o as extractNewFields, p as parseJsonToObject, r as parseQueryString, s as extractUpdatedAndNewFields, t as generateQueryParams, u as flattenObjectKeyValue } from "./query-PGFEup3p.mjs";
|
|
26
26
|
|
|
27
27
|
//#region src/string/anagram.ts
|
|
28
28
|
/** `WeakMap` to cache user provided dictionary array */
|
|
@@ -576,8 +576,8 @@ function getAverage(...numbers) {
|
|
|
576
576
|
let sum = 0;
|
|
577
577
|
let count = 0;
|
|
578
578
|
for (const n of numbers) {
|
|
579
|
-
const num =
|
|
580
|
-
if (
|
|
579
|
+
const num = normalizeNumber(n);
|
|
580
|
+
if (!isUndefined(num)) {
|
|
581
581
|
sum += num;
|
|
582
582
|
count++;
|
|
583
583
|
}
|
|
@@ -585,6 +585,72 @@ function getAverage(...numbers) {
|
|
|
585
585
|
return count === 0 ? NaN : Math.round(sum / count * 1e3) / 1e3;
|
|
586
586
|
}
|
|
587
587
|
/**
|
|
588
|
+
* * Returns the number of decimal places represented by a number.
|
|
589
|
+
*
|
|
590
|
+
* @param value - The number or numeric string for which to calculate the number of decimal places.
|
|
591
|
+
* @returns The number of decimal places.
|
|
592
|
+
*
|
|
593
|
+
* @throws - {@link TypeError} - If the input value cannot be converted to a number, e.g. `undefined`, `null`, `NaN`, `'11x'` etc..
|
|
594
|
+
*
|
|
595
|
+
* @remarks
|
|
596
|
+
* - If a numeric string in scientific notation (e.g., '1e-6') is provided, it will calculate the decimal places accordingly.
|
|
597
|
+
* - If a numeric string has trailing zeros (e.g., ''1.00'' or `'9.900'`),
|
|
598
|
+
* it will convert them as: `'1.00'` -> `1`, `'9.900'` -> `9.9` and return `0` and `1` respectively.
|
|
599
|
+
* - If a number is an integer, it will return `0`.
|
|
600
|
+
* - Internally uses {@link normalizeNumber} to normalize the input value.
|
|
601
|
+
*
|
|
602
|
+
* @example
|
|
603
|
+
* getDecimalPlaces(123.456); // 3
|
|
604
|
+
* getDecimalPlaces('123.45600'); // 3
|
|
605
|
+
* getDecimalPlaces(123); // 0
|
|
606
|
+
* getDecimalPlaces('1e-6'); // 6
|
|
607
|
+
* getDecimalPlaces('1.00'); // 0
|
|
608
|
+
* getDecimalPlaces('9.900'); // 1
|
|
609
|
+
*/
|
|
610
|
+
function getDecimalPlaces(value) {
|
|
611
|
+
const number = normalizeNumber(value);
|
|
612
|
+
if (isUndefined(number)) throw new TypeError(`Invalid numeric representation: ${value}`);
|
|
613
|
+
const str = String(number);
|
|
614
|
+
if (str.includes("e-")) {
|
|
615
|
+
const [, exponent] = str.split("e-");
|
|
616
|
+
return Number(exponent);
|
|
617
|
+
}
|
|
618
|
+
const [, decimal = ""] = str.split(".");
|
|
619
|
+
return decimal.length;
|
|
620
|
+
}
|
|
621
|
+
/**
|
|
622
|
+
* * Adds numbers safely, avoiding floating-point arithmetic issues.
|
|
623
|
+
*
|
|
624
|
+
* @param values - A list of numbers or numeric strings to add.
|
|
625
|
+
* @returns The sum of the provided numbers, with floating-point inaccuracies mitigated.
|
|
626
|
+
*
|
|
627
|
+
* @remarks
|
|
628
|
+
* - This function addresses common floating-point addition errors (e.g., `0.1 + 0.2 !== 0.3`)
|
|
629
|
+
* by temporarily scaling numbers to integers, performing the addition, and then scaling back.
|
|
630
|
+
* - Non-numeric values are safely ignored in the runtime.
|
|
631
|
+
* - Rounding is used to mitigate floating-point inaccuracies.
|
|
632
|
+
* - Intended for use cases where floating-point inaccuracies are a concern.
|
|
633
|
+
* - Internally uses {@link normalizeNumber}, {@link getDecimalPlaces}, {@link roundNumber}.
|
|
634
|
+
* - It does not handle numbers beyond {@link Number.MAX_SAFE_INTEGER} or {@link Number.MIN_SAFE_INTEGER}.
|
|
635
|
+
* May output incorrect results if the numbers are too large.
|
|
636
|
+
* @example
|
|
637
|
+
* safeAdd(0.1, 0.2); // → 0.3 (correctly handles floating-point error)
|
|
638
|
+
* safeAdd(1, '2', 3.456); // → 6.456
|
|
639
|
+
* safeAdd(0.1, 0.2, 0.3, 0.4); // → 1.0 (accurate sum)
|
|
640
|
+
*/
|
|
641
|
+
function safeAdd(...values) {
|
|
642
|
+
let scale = 1;
|
|
643
|
+
const nums = [];
|
|
644
|
+
for (const value of values) {
|
|
645
|
+
const num = normalizeNumber(value);
|
|
646
|
+
if (!isUndefined(num)) {
|
|
647
|
+
nums.push(num);
|
|
648
|
+
scale = Math.max(scale, 10 ** getDecimalPlaces(num));
|
|
649
|
+
}
|
|
650
|
+
}
|
|
651
|
+
return nums.reduce((total, value) => total + roundNumber(value * scale, 0), 0) / scale;
|
|
652
|
+
}
|
|
653
|
+
/**
|
|
588
654
|
* * Rounds a number to a specified number of decimal places.
|
|
589
655
|
*
|
|
590
656
|
* @param number - The number to round.
|
|
@@ -2171,4 +2237,4 @@ function getCountryByPhone(phone) {
|
|
|
2171
2237
|
}
|
|
2172
2238
|
|
|
2173
2239
|
//#endregion
|
|
2174
|
-
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,
|
|
2240
|
+
export { Currency, Finder, Unit, Unit as UnitConverter, safeAdd as add, safeAdd, convertToRomanNumerals as arabicToRoman, convertToRomanNumerals, convertToRomanNumerals as integerToRoman, convertToRomanNumerals as numberToRoman, convertToRomanNumerals as numericToRoman, convertToRomanNumerals as toRoman, convertToRomanNumerals as toRomanNumeral, getAverage as average, getAverage as calculateAverage, getAverage, averageByField, averageByField as avgByField, banglaToDigit, 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, generateQueryParams as createQueryParams, generateQueryParams as formatQueryParams, generateQueryParams, debounceAction, getDecimalPlaces as decimalPlaces, getDecimalPlaces, 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, parseQueryString as getQueryStringAsObject, parseQueryString, parseQueryString as queryStringToObject, 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, parseQueryStringLiteral as literalQueryStringToObject, parseQueryStringLiteral, 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 };
|
|
@@ -15,10 +15,10 @@
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
import { a as isNonEmptyString, c as isNumber, d as isString } from "./primitives-Djsevc69.mjs";
|
|
18
|
-
import { d as isNumericString } from "./specials-krf7zsqI.mjs";
|
|
19
|
-
import { r as getOrdinal } from "./utilities-BSv8VbnM.mjs";
|
|
20
18
|
import { i as MS_MAP, n as DAYS, o as SORTED_TIME_FORMATS, r as MONTHS } from "./constants-GZL_CT1W.mjs";
|
|
21
|
-
import {
|
|
19
|
+
import { d as isNumericString } from "./specials-krf7zsqI.mjs";
|
|
20
|
+
import { r as getOrdinal } from "./utilities-CmPwOkdy.mjs";
|
|
21
|
+
import { i as isTimeWithUnit } from "./guards-DBunDnng.mjs";
|
|
22
22
|
|
|
23
23
|
//#region src/date/helpers.ts
|
|
24
24
|
/** Core formatting logic shared by `formatDate` and `Chronos`, `BanglaCalendar` classes */
|
|
@@ -15,10 +15,10 @@
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
const require_primitives = require('./primitives-CBGICrDR.cjs');
|
|
18
|
-
const require_specials = require('./specials-DU8u108m.cjs');
|
|
19
|
-
const require_utilities = require('./utilities-BVpk3LKy.cjs');
|
|
20
18
|
const require_constants = require('./constants-CgFaV72Z.cjs');
|
|
21
|
-
const
|
|
19
|
+
const require_specials = require('./specials-DU8u108m.cjs');
|
|
20
|
+
const require_utilities = require('./utilities-_COSGq1U.cjs');
|
|
21
|
+
const require_guards = require('./guards-BD2Fkugj.cjs');
|
|
22
22
|
|
|
23
23
|
//#region src/date/helpers.ts
|
|
24
24
|
/** Core formatting logic shared by `formatDate` and `Chronos`, `BanglaCalendar` classes */
|
|
@@ -15,9 +15,9 @@
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
const require_primitives = require('./primitives-CBGICrDR.cjs');
|
|
18
|
+
const require_utils = require('./utils-DR9g0Sef.cjs');
|
|
18
19
|
const require_specials = require('./specials-DU8u108m.cjs');
|
|
19
|
-
const require_guards = require('./guards-
|
|
20
|
-
const require_basics = require('./basics-byj0VH1c.cjs');
|
|
20
|
+
const require_guards = require('./guards-BD2Fkugj.cjs');
|
|
21
21
|
|
|
22
22
|
//#region src/form/guards.ts
|
|
23
23
|
/**
|
|
@@ -140,7 +140,7 @@ function sanitizeData(input, options, _return) {
|
|
|
140
140
|
*/
|
|
141
141
|
const _processArray = (arr, path) => {
|
|
142
142
|
return arr?.map((item) => {
|
|
143
|
-
if (require_primitives.isString(item) && trimStrings) return
|
|
143
|
+
if (require_primitives.isString(item) && trimStrings) return require_utils.trimString(item);
|
|
144
144
|
if (Array.isArray(item)) return _processArray(item, path);
|
|
145
145
|
if (require_specials.isObject(item)) return _processObject(item, path);
|
|
146
146
|
return item;
|
|
@@ -162,7 +162,7 @@ function sanitizeData(input, options, _return) {
|
|
|
162
162
|
if (ignoreKeySet.has(fullKeyPath)) return acc;
|
|
163
163
|
if (ignoreNullish && !_isRequiredKey(fullKeyPath) && value == null) return acc;
|
|
164
164
|
if (ignoreFalsy && !value && !_isRequiredKey(fullKeyPath)) return acc;
|
|
165
|
-
if (require_primitives.isString(value) && trimStrings) acc[key] =
|
|
165
|
+
if (require_primitives.isString(value) && trimStrings) acc[key] = require_utils.trimString(value);
|
|
166
166
|
else if (_shouldNotProcess(value)) acc[key] = value;
|
|
167
167
|
else if (value && require_specials.isObject(value)) if (_shouldNotProcess(value)) acc[key] = value;
|
|
168
168
|
else {
|
|
@@ -175,9 +175,9 @@ function sanitizeData(input, options, _return) {
|
|
|
175
175
|
} else acc[key] = value;
|
|
176
176
|
return acc;
|
|
177
177
|
}, {});
|
|
178
|
-
if (require_primitives.isString(input)) return
|
|
178
|
+
if (require_primitives.isString(input)) return require_utils.trimString(input);
|
|
179
179
|
if (Array.isArray(input)) {
|
|
180
|
-
if (require_specials.isArrayOfType(input, require_primitives.isString)) return
|
|
180
|
+
if (require_specials.isArrayOfType(input, require_primitives.isString)) return require_utils.trimString(input);
|
|
181
181
|
return input?.map((item) => sanitizeData(item, options, _return))?.filter((val) => {
|
|
182
182
|
if (ignoreNullish && val == null) return false;
|
|
183
183
|
if (ignoreFalsy && !val) return false;
|
|
@@ -338,7 +338,7 @@ const flattenObjectDotNotation = (object) => {
|
|
|
338
338
|
*/
|
|
339
339
|
const extractUpdatedFields = (baseObject, updatedObject) => {
|
|
340
340
|
const updatedFields = {};
|
|
341
|
-
for (const key in updatedObject) if (key in baseObject && !
|
|
341
|
+
for (const key in updatedObject) if (key in baseObject && !require_utils.isDeepEqual(updatedObject[key], baseObject[key])) if (updatedObject[key] && require_specials.isNotEmptyObject(updatedObject[key])) {
|
|
342
342
|
updatedFields[key] = extractUpdatedFields(baseObject[key], updatedObject[key]);
|
|
343
343
|
if (updatedFields[key] && require_specials.isEmptyObject(updatedFields[key])) delete updatedFields[key];
|
|
344
344
|
} else updatedFields[key] = updatedObject[key];
|
|
@@ -371,7 +371,7 @@ const extractUpdatedAndNewFields = (baseObject, updatedObject) => {
|
|
|
371
371
|
const updatedFields = {};
|
|
372
372
|
const newFields = {};
|
|
373
373
|
for (const key in updatedObject) if (!(key in baseObject)) newFields[key] = updatedObject[key];
|
|
374
|
-
else if (!
|
|
374
|
+
else if (!require_utils.isDeepEqual(updatedObject[key], baseObject[key])) if (updatedObject[key] && require_specials.isNotEmptyObject(updatedObject[key])) {
|
|
375
375
|
updatedFields[key] = extractUpdatedAndNewFields(baseObject[key], updatedObject[key]);
|
|
376
376
|
if (updatedFields[key] && require_specials.isEmptyObject(updatedFields[key])) delete updatedFields[key];
|
|
377
377
|
} else updatedFields[key] = updatedObject[key];
|
|
@@ -465,7 +465,7 @@ function parseQueryString(query, parsePrimitives = true) {
|
|
|
465
465
|
for (const [key, value] of params.entries()) if (key in entries) {
|
|
466
466
|
const current = entries[key];
|
|
467
467
|
const array = Array.isArray(current) ? [...current, value] : [current, value];
|
|
468
|
-
entries[key] = parsePrimitives ?
|
|
468
|
+
entries[key] = parsePrimitives ? require_utils.deepParsePrimitives(array) : array;
|
|
469
469
|
} else entries[key] = value;
|
|
470
470
|
return parsePrimitives ? parseObjectValues(entries) : entries;
|
|
471
471
|
}
|
|
@@ -15,9 +15,9 @@
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
import { d as isString } from "./primitives-Djsevc69.mjs";
|
|
18
|
+
import { $ as trimString, a as deepParsePrimitives, f as isDeepEqual } from "./utils-BO5CcsjK.mjs";
|
|
18
19
|
import { E as isObjectWithKeys, T as isObject, g as isArrayOfType, j as isValidArray, v as isEmptyObject, w as isNotEmptyObject } from "./specials-krf7zsqI.mjs";
|
|
19
|
-
import { t as isDateLike } from "./guards-
|
|
20
|
-
import { I as deepParsePrimitives, U as isDeepEqual, n as trimString } from "./basics-20lm69yy.mjs";
|
|
20
|
+
import { t as isDateLike } from "./guards-DBunDnng.mjs";
|
|
21
21
|
|
|
22
22
|
//#region src/form/guards.ts
|
|
23
23
|
/**
|
|
@@ -15,11 +15,11 @@
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
18
|
-
const require_primitives = require('
|
|
19
|
-
const require_css_colors = require('
|
|
20
|
-
const
|
|
21
|
-
const
|
|
22
|
-
const
|
|
18
|
+
const require_primitives = require('../primitives-CBGICrDR.cjs');
|
|
19
|
+
const require_css_colors = require('../css-colors-DC7oZ46Y.cjs');
|
|
20
|
+
const require_specials = require('../specials-DU8u108m.cjs');
|
|
21
|
+
const require_guards = require('../guards-CrfVwk0-.cjs');
|
|
22
|
+
const require_convert = require('../convert-BjKz_hhr.cjs');
|
|
23
23
|
|
|
24
24
|
//#region src/stylog/console.log.ts
|
|
25
25
|
/**
|
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import { _ as Hex } from "
|
|
18
|
-
import { a as AnsiSequence, n as Stylog, o as BGColor, t as LogStyler, u as TextStyle } from "
|
|
17
|
+
import { _ as Hex } from "../Color-SUPeP6fO.cjs";
|
|
18
|
+
import { a as AnsiSequence, n as Stylog, o as BGColor, t as LogStyler, u as TextStyle } from "../Stylog-DdPP_CJf.cjs";
|
|
19
19
|
|
|
20
20
|
//#region src/stylog/utils.d.ts
|
|
21
21
|
/**
|
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import { _ as Hex } from "
|
|
18
|
-
import { a as AnsiSequence, n as Stylog, o as BGColor, t as LogStyler, u as TextStyle } from "
|
|
17
|
+
import { _ as Hex } from "../Color-D6qMZgDm.mjs";
|
|
18
|
+
import { a as AnsiSequence, n as Stylog, o as BGColor, t as LogStyler, u as TextStyle } from "../Stylog-B8sKWvn_.mjs";
|
|
19
19
|
|
|
20
20
|
//#region src/stylog/utils.d.ts
|
|
21
21
|
/**
|
|
@@ -14,11 +14,11 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import { c as isNumber, d as isString } from "
|
|
18
|
-
import { t as CSS_COLORS } from "
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
17
|
+
import { c as isNumber, d as isString } from "../primitives-Djsevc69.mjs";
|
|
18
|
+
import { t as CSS_COLORS } from "../css-colors-B-y4TmeC.mjs";
|
|
19
|
+
import { g as isArrayOfType, r as isBrowser } from "../specials-krf7zsqI.mjs";
|
|
20
|
+
import { f as _isValidHue, i as isHex6, m as _isValidRGBComponent, o as isRGB, p as _isValidPercentage, t as isCSSColor } from "../guards-CNG9gnvL.mjs";
|
|
21
|
+
import { a as convertHexToRgb, s as convertHslToRgb } from "../convert-DRZXcjcS.mjs";
|
|
22
22
|
|
|
23
23
|
//#region src/stylog/console.log.ts
|
|
24
24
|
/**
|
|
@@ -14,5 +14,29 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import {
|
|
17
|
+
import { ct as Numeric } from "../object-DyVg8BFt.cjs";
|
|
18
|
+
|
|
19
|
+
//#region src/types/pluralizer.d.ts
|
|
20
|
+
/** A pair of RegExp and replacement for pluralization rules */
|
|
21
|
+
type PluralizeRule = [RegExp, string];
|
|
22
|
+
/**
|
|
23
|
+
* A map of irregular singular to plural forms.
|
|
24
|
+
* Used for handling exceptions in pluralization.
|
|
25
|
+
*/
|
|
26
|
+
type IrregularMap = Record<string, string>;
|
|
27
|
+
/** * Options for pluralize method. */
|
|
28
|
+
interface PluralizeOptions {
|
|
29
|
+
/**
|
|
30
|
+
* The count to determine singular or plural form. Either number or numeric string.
|
|
31
|
+
* If not provided, bypass the check and pluralize the word anyways.
|
|
32
|
+
*/
|
|
33
|
+
count?: Numeric;
|
|
34
|
+
/**
|
|
35
|
+
* Whether to include the count in the output. Depends on the `count` value.
|
|
36
|
+
* If true, the output will be in the format "2 Categories".
|
|
37
|
+
* If false, it will just return the pluralized word.
|
|
38
|
+
*/
|
|
39
|
+
inclusive?: boolean;
|
|
40
|
+
}
|
|
41
|
+
//#endregion
|
|
18
42
|
export { IrregularMap, PluralizeOptions, PluralizeRule };
|
|
@@ -14,5 +14,29 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import {
|
|
17
|
+
import { ct as Numeric } from "../object-DyVg8BFt.mjs";
|
|
18
|
+
|
|
19
|
+
//#region src/types/pluralizer.d.ts
|
|
20
|
+
/** A pair of RegExp and replacement for pluralization rules */
|
|
21
|
+
type PluralizeRule = [RegExp, string];
|
|
22
|
+
/**
|
|
23
|
+
* A map of irregular singular to plural forms.
|
|
24
|
+
* Used for handling exceptions in pluralization.
|
|
25
|
+
*/
|
|
26
|
+
type IrregularMap = Record<string, string>;
|
|
27
|
+
/** * Options for pluralize method. */
|
|
28
|
+
interface PluralizeOptions {
|
|
29
|
+
/**
|
|
30
|
+
* The count to determine singular or plural form. Either number or numeric string.
|
|
31
|
+
* If not provided, bypass the check and pluralize the word anyways.
|
|
32
|
+
*/
|
|
33
|
+
count?: Numeric;
|
|
34
|
+
/**
|
|
35
|
+
* Whether to include the count in the output. Depends on the `count` value.
|
|
36
|
+
* If true, the output will be in the format "2 Categories".
|
|
37
|
+
* If false, it will just return the pluralized word.
|
|
38
|
+
*/
|
|
39
|
+
inclusive?: boolean;
|
|
40
|
+
}
|
|
41
|
+
//#endregion
|
|
18
42
|
export { IrregularMap, PluralizeOptions, PluralizeRule };
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
import { c as isNumber } from "./primitives-Djsevc69.mjs";
|
|
18
|
-
import { d as isNumericString } from "./specials-krf7zsqI.mjs";
|
|
19
18
|
import { r as CURRENCY_LOCALES } from "./constants-ZyfpysiQ.mjs";
|
|
19
|
+
import { d as isNumericString } from "./specials-krf7zsqI.mjs";
|
|
20
20
|
|
|
21
21
|
//#region src/number/utilities.ts
|
|
22
22
|
/**
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
const require_primitives = require('./primitives-CBGICrDR.cjs');
|
|
18
|
-
const require_specials = require('./specials-DU8u108m.cjs');
|
|
19
18
|
const require_constants = require('./constants-B3nc8psr.cjs');
|
|
19
|
+
const require_specials = require('./specials-DU8u108m.cjs');
|
|
20
20
|
|
|
21
21
|
//#region src/number/utilities.ts
|
|
22
22
|
/**
|