umt 2.12.2 → 2.13.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/README.md +60 -0
- package/module/Array/arraysJoin.js +1 -1
- package/module/Array/arraysJoin.js.map +1 -1
- package/module/Array/chunk.js +1 -2
- package/module/Array/chunk.js.map +1 -1
- package/module/Array/generateNumberArray.js +13 -3
- package/module/Array/generateNumberArray.js.map +1 -1
- package/module/Array/getArraysDiff.js +5 -1
- package/module/Array/getArraysDiff.js.map +1 -1
- package/module/Array/mergeSort.js +45 -18
- package/module/Array/mergeSort.js.map +1 -1
- package/module/Array/pop.js +2 -1
- package/module/Array/pop.js.map +1 -1
- package/module/Array/randomSelect.js +8 -0
- package/module/Array/randomSelect.js.map +1 -1
- package/module/Array/sortingHelpers/rangeValidator.js +3 -2
- package/module/Array/sortingHelpers/rangeValidator.js.map +1 -1
- package/module/Array/timSort.js +25 -23
- package/module/Array/timSort.js.map +1 -1
- package/module/Array/ultraNumberSort.js +206 -133
- package/module/Array/ultraNumberSort.js.map +1 -1
- package/module/Async/defer.d.ts +18 -0
- package/module/Async/defer.js +19 -0
- package/module/Async/defer.js.map +1 -0
- package/module/Async/index.d.ts +4 -0
- package/module/Async/index.js +5 -0
- package/module/Async/index.js.map +1 -0
- package/module/Async/parallel.d.ts +10 -0
- package/module/Async/parallel.js +44 -0
- package/module/Async/parallel.js.map +1 -0
- package/module/Async/sleep.d.ts +8 -0
- package/module/Async/sleep.js +11 -0
- package/module/Async/sleep.js.map +1 -0
- package/module/Async/timeout.d.ts +10 -0
- package/module/Async/timeout.js +22 -0
- package/module/Async/timeout.js.map +1 -0
- package/module/Color/cmykToRgba.js +6 -7
- package/module/Color/cmykToRgba.js.map +1 -1
- package/module/Color/hexaToRgba.js +1 -8
- package/module/Color/hexaToRgba.js.map +1 -1
- package/module/Color/hslaToRgba.d.ts +0 -1
- package/module/Color/hslaToRgba.js +7 -22
- package/module/Color/hslaToRgba.js.map +1 -1
- package/module/Color/rgbaToCmyk.js +0 -11
- package/module/Color/rgbaToCmyk.js.map +1 -1
- package/module/Color/rgbaToHexA.js +2 -15
- package/module/Color/rgbaToHexA.js.map +1 -1
- package/module/Color/rgbaToHsla.d.ts +0 -1
- package/module/Color/rgbaToHsla.js +0 -12
- package/module/Color/rgbaToHsla.js.map +1 -1
- package/module/Crypto/constants.d.ts +2 -0
- package/module/Crypto/constants.js +3 -0
- package/module/Crypto/constants.js.map +1 -0
- package/module/Crypto/decodeBase32.js +2 -4
- package/module/Crypto/decodeBase32.js.map +1 -1
- package/module/Crypto/decodeBase58.js +2 -4
- package/module/Crypto/decodeBase58.js.map +1 -1
- package/module/Crypto/encodeBase32.js +2 -1
- package/module/Crypto/encodeBase32.js.map +1 -1
- package/module/Crypto/encodeBase58.js +2 -1
- package/module/Crypto/encodeBase58.js.map +1 -1
- package/module/DataStructure/index.d.ts +2 -0
- package/module/DataStructure/index.js +2 -0
- package/module/DataStructure/index.js.map +1 -1
- package/module/DataStructure/lruCache.d.ts +139 -0
- package/module/DataStructure/lruCache.js +172 -0
- package/module/DataStructure/lruCache.js.map +1 -0
- package/module/DataStructure/ttlCache.d.ts +139 -0
- package/module/DataStructure/ttlCache.js +172 -0
- package/module/DataStructure/ttlCache.js.map +1 -0
- package/module/Error/flatMapResult.d.ts +23 -0
- package/module/Error/flatMapResult.js +28 -0
- package/module/Error/flatMapResult.js.map +1 -0
- package/module/Error/index.d.ts +3 -0
- package/module/Error/index.js +3 -0
- package/module/Error/index.js.map +1 -1
- package/module/Error/mapResult.d.ts +21 -0
- package/module/Error/mapResult.js +27 -0
- package/module/Error/mapResult.js.map +1 -0
- package/module/Error/matchResult.d.ts +25 -0
- package/module/Error/matchResult.js +27 -0
- package/module/Error/matchResult.js.map +1 -0
- package/module/Error/safeExecute.d.ts +16 -3
- package/module/Error/safeExecute.js +5 -2
- package/module/Error/safeExecute.js.map +1 -1
- package/module/Function/debounce.d.ts +38 -0
- package/module/Function/debounce.js +67 -0
- package/module/Function/debounce.js.map +1 -0
- package/module/Function/index.d.ts +4 -0
- package/module/Function/index.js +4 -0
- package/module/Function/index.js.map +1 -1
- package/module/Function/memoize.d.ts +36 -0
- package/module/Function/memoize.js +54 -0
- package/module/Function/memoize.js.map +1 -0
- package/module/Function/once.d.ts +18 -0
- package/module/Function/once.js +29 -0
- package/module/Function/once.js.map +1 -0
- package/module/Function/throttle.d.ts +25 -0
- package/module/Function/throttle.js +55 -0
- package/module/Function/throttle.js.map +1 -0
- package/module/IP/cidrToLong.d.ts +0 -1
- package/module/IP/cidrToLong.js +0 -4
- package/module/IP/cidrToLong.js.map +1 -1
- package/module/IP/cidrToSubnetMask.d.ts +0 -1
- package/module/IP/cidrToSubnetMask.js +0 -1
- package/module/IP/cidrToSubnetMask.js.map +1 -1
- package/module/IP/getNetworkAddress.d.ts +0 -1
- package/module/IP/getNetworkAddress.js +2 -32
- package/module/IP/getNetworkAddress.js.map +1 -1
- package/module/IP/ipToBinaryString.d.ts +0 -1
- package/module/IP/ipToBinaryString.js +2 -25
- package/module/IP/ipToBinaryString.js.map +1 -1
- package/module/IP/ipToLong.d.ts +0 -1
- package/module/IP/ipToLong.js +0 -1
- package/module/IP/ipToLong.js.map +1 -1
- package/module/IP/isInRange.d.ts +0 -1
- package/module/IP/isInRange.js +5 -28
- package/module/IP/isInRange.js.map +1 -1
- package/module/IP/isPrivateIp.d.ts +0 -1
- package/module/IP/isPrivateIp.js +1 -10
- package/module/IP/isPrivateIp.js.map +1 -1
- package/module/IP/longToIp.d.ts +0 -1
- package/module/IP/longToIp.js +0 -8
- package/module/IP/longToIp.js.map +1 -1
- package/module/IP/subnetMaskToCidr.d.ts +0 -1
- package/module/IP/subnetMaskToCidr.js +2 -23
- package/module/IP/subnetMaskToCidr.js.map +1 -1
- package/module/Iterator/index.d.ts +3 -0
- package/module/Iterator/index.js +4 -0
- package/module/Iterator/index.js.map +1 -0
- package/module/Iterator/lazyFilter.d.ts +10 -0
- package/module/Iterator/lazyFilter.js +19 -0
- package/module/Iterator/lazyFilter.js.map +1 -0
- package/module/Iterator/lazyMap.d.ts +10 -0
- package/module/Iterator/lazyMap.js +17 -0
- package/module/Iterator/lazyMap.js.map +1 -0
- package/module/Iterator/lazyTake.d.ts +10 -0
- package/module/Iterator/lazyTake.js +20 -0
- package/module/Iterator/lazyTake.js.map +1 -0
- package/module/Math/addition.js +20 -4
- package/module/Math/addition.js.map +1 -1
- package/module/Math/average.js +3 -3
- package/module/Math/average.js.map +1 -1
- package/module/Math/bitwise.js +1 -1
- package/module/Math/bitwise.js.map +1 -1
- package/module/Math/calculator/core.js +2 -1
- package/module/Math/calculator/core.js.map +1 -1
- package/module/Math/calculator/literalExpression.js +1 -1
- package/module/Math/clamp.d.ts +16 -0
- package/module/Math/clamp.js +19 -0
- package/module/Math/clamp.js.map +1 -0
- package/module/Math/correlationCoefficient.js +0 -3
- package/module/Math/correlationCoefficient.js.map +1 -1
- package/module/Math/inRange.d.ts +19 -0
- package/module/Math/inRange.js +24 -0
- package/module/Math/inRange.js.map +1 -0
- package/module/Math/index.d.ts +3 -0
- package/module/Math/index.js +3 -0
- package/module/Math/index.js.map +1 -1
- package/module/Math/median.js +2 -2
- package/module/Math/median.js.map +1 -1
- package/module/Math/nCr.js +2 -4
- package/module/Math/nCr.js.map +1 -1
- package/module/Math/percentile.js +2 -5
- package/module/Math/percentile.js.map +1 -1
- package/module/Math/primeFactorization.js +1 -1
- package/module/Math/primeFactorization.js.map +1 -1
- package/module/Math/sumPrecise.d.ts +14 -0
- package/module/Math/sumPrecise.js +27 -0
- package/module/Math/sumPrecise.js.map +1 -0
- package/module/Math/uuidv7.js +56 -22
- package/module/Math/uuidv7.js.map +1 -1
- package/module/Number/formatNumber.d.ts +42 -0
- package/module/Number/formatNumber.js +44 -0
- package/module/Number/formatNumber.js.map +1 -0
- package/module/Number/index.d.ts +3 -0
- package/module/Number/index.js +4 -0
- package/module/Number/index.js.map +1 -0
- package/module/Number/toOrdinal.d.ts +20 -0
- package/module/Number/toOrdinal.js +37 -0
- package/module/Number/toOrdinal.js.map +1 -0
- package/module/Number/toPercentage.d.ts +20 -0
- package/module/Number/toPercentage.js +27 -0
- package/module/Number/toPercentage.js.map +1 -0
- package/module/Object/deepClone.d.ts +15 -0
- package/module/Object/deepClone.js +62 -0
- package/module/Object/deepClone.js.map +1 -0
- package/module/Object/getObjectsCommon.d.ts +23 -0
- package/module/Object/getObjectsCommon.js +60 -0
- package/module/Object/getObjectsCommon.js.map +1 -0
- package/module/Object/getObjectsDiff.d.ts +25 -0
- package/module/Object/getObjectsDiff.js +79 -0
- package/module/Object/getObjectsDiff.js.map +1 -0
- package/module/Object/index.d.ts +6 -0
- package/module/Object/index.js +6 -0
- package/module/Object/index.js.map +1 -1
- package/module/Object/isPlainObject.d.ts +16 -0
- package/module/Object/isPlainObject.js +32 -0
- package/module/Object/isPlainObject.js.map +1 -0
- package/module/Object/mapKeys.d.ts +15 -0
- package/module/Object/mapKeys.js +28 -0
- package/module/Object/mapKeys.js.map +1 -0
- package/module/Object/mapValues.d.ts +15 -0
- package/module/Object/mapValues.js +27 -0
- package/module/Object/mapValues.js.map +1 -0
- package/module/Object/mergeDeep.js +4 -9
- package/module/Object/mergeDeep.js.map +1 -1
- package/module/Object/omit.d.ts +1 -1
- package/module/Object/omit.js.map +1 -1
- package/module/Object/pickDeep.js +6 -1
- package/module/Object/pickDeep.js.map +1 -1
- package/module/Predicate/every.d.ts +14 -0
- package/module/Predicate/every.js +22 -0
- package/module/Predicate/every.js.map +1 -0
- package/module/Predicate/index.d.ts +6 -0
- package/module/Predicate/index.js +7 -0
- package/module/Predicate/index.js.map +1 -0
- package/module/Predicate/isNotNullish.d.ts +11 -0
- package/module/Predicate/isNotNullish.js +12 -0
- package/module/Predicate/isNotNullish.js.map +1 -0
- package/module/Predicate/isNullish.d.ts +11 -0
- package/module/Predicate/isNullish.js +12 -0
- package/module/Predicate/isNullish.js.map +1 -0
- package/module/Predicate/matches.d.ts +11 -0
- package/module/Predicate/matches.js +20 -0
- package/module/Predicate/matches.js.map +1 -0
- package/module/Predicate/not.d.ts +10 -0
- package/module/Predicate/not.js +11 -0
- package/module/Predicate/not.js.map +1 -0
- package/module/Predicate/some.d.ts +15 -0
- package/module/Predicate/some.js +23 -0
- package/module/Predicate/some.js.map +1 -0
- package/module/String/camelCase.js +2 -2
- package/module/String/camelCase.js.map +1 -1
- package/module/String/escapeHtml.js +1 -1
- package/module/String/formatString/getValue.js +1 -1
- package/module/String/formatString/getValue.js.map +1 -1
- package/module/String/fromBase64.d.ts +0 -1
- package/module/String/fromBase64.js +1 -9
- package/module/String/fromBase64.js.map +1 -1
- package/module/String/fuzzySearch.js +74 -6
- package/module/String/fuzzySearch.js.map +1 -1
- package/module/String/kebabCase.js +1 -1
- package/module/String/kebabCase.js.map +1 -1
- package/module/String/levenshteinDistance.js +1 -2
- package/module/String/levenshteinDistance.js.map +1 -1
- package/module/String/randomString.js +23 -2
- package/module/String/randomString.js.map +1 -1
- package/module/String/reverseString.js +1 -1
- package/module/String/reverseString.js.map +1 -1
- package/module/String/slugify.js +1 -1
- package/module/String/toHalfWidth.js +2 -2
- package/module/String/toHalfWidth.js.map +1 -1
- package/module/String/truncate.js +0 -3
- package/module/String/truncate.js.map +1 -1
- package/module/String/unescapeHtml.js +1 -1
- package/module/String/unescapeHtml.js.map +1 -1
- package/module/Time/convertTime.js +4 -3
- package/module/Time/convertTime.js.map +1 -1
- package/module/Tool/escapeRegExp.d.ts +8 -0
- package/module/Tool/escapeRegExp.js +11 -0
- package/module/Tool/escapeRegExp.js.map +1 -0
- package/module/Tool/index.d.ts +1 -0
- package/module/Tool/index.js +1 -0
- package/module/Tool/index.js.map +1 -1
- package/module/URL/buildUrl.d.ts +17 -0
- package/module/URL/buildUrl.js +24 -0
- package/module/URL/buildUrl.js.map +1 -0
- package/module/URL/index.d.ts +4 -0
- package/module/URL/index.js +5 -0
- package/module/URL/index.js.map +1 -0
- package/module/URL/isAbsoluteUrl.d.ts +20 -0
- package/module/URL/isAbsoluteUrl.js +23 -0
- package/module/URL/isAbsoluteUrl.js.map +1 -0
- package/module/URL/joinPath.d.ts +24 -0
- package/module/URL/joinPath.js +43 -0
- package/module/URL/joinPath.js.map +1 -0
- package/module/URL/parseQueryString.d.ts +22 -0
- package/module/URL/parseQueryString.js +34 -0
- package/module/URL/parseQueryString.js.map +1 -0
- package/module/Validate/parseEmail.js +5 -5
- package/module/Validate/parseEmail.js.map +1 -1
- package/module/es5/Array/arraysJoin.js +1 -1
- package/module/es5/Array/chunk.js +3 -2
- package/module/es5/Array/generateNumberArray.js +21 -3
- package/module/es5/Array/getArraysDiff.js +5 -3
- package/module/es5/Array/mergeSort.js +51 -19
- package/module/es5/Array/pop.js +2 -7
- package/module/es5/Array/randomSelect.js +8 -0
- package/module/es5/Array/sortingHelpers/rangeValidator.js +3 -2
- package/module/es5/Array/timSort.js +25 -23
- package/module/es5/Array/ultraNumberSort.js +221 -207
- package/module/es5/Async/defer.d.ts +18 -0
- package/module/es5/Async/defer.js +32 -0
- package/module/es5/Async/index.d.ts +4 -0
- package/module/es5/Async/index.js +49 -0
- package/module/es5/Async/parallel.d.ts +10 -0
- package/module/es5/Async/parallel.js +48 -0
- package/module/es5/Async/sleep.d.ts +8 -0
- package/module/es5/Async/sleep.js +18 -0
- package/module/es5/Async/timeout.d.ts +10 -0
- package/module/es5/Async/timeout.js +29 -0
- package/module/es5/Color/cmykToRgba.js +6 -7
- package/module/es5/Color/hexaToRgba.js +7 -5
- package/module/es5/Color/hslaToRgba.d.ts +0 -1
- package/module/es5/Color/hslaToRgba.js +7 -22
- package/module/es5/Color/rgbaToCmyk.js +0 -4
- package/module/es5/Color/rgbaToHexA.js +2 -6
- package/module/es5/Color/rgbaToHsla.d.ts +0 -1
- package/module/es5/Color/rgbaToHsla.js +0 -5
- package/module/es5/Crypto/constants.d.ts +2 -0
- package/module/es5/Crypto/constants.js +8 -0
- package/module/es5/Crypto/decodeBase32.js +2 -4
- package/module/es5/Crypto/decodeBase58.js +2 -4
- package/module/es5/Crypto/encodeBase32.js +2 -1
- package/module/es5/Crypto/encodeBase58.js +2 -1
- package/module/es5/DataStructure/index.d.ts +2 -0
- package/module/es5/DataStructure/index.js +22 -0
- package/module/es5/DataStructure/lruCache.d.ts +139 -0
- package/module/es5/DataStructure/lruCache.js +205 -0
- package/module/es5/DataStructure/ttlCache.d.ts +139 -0
- package/module/es5/DataStructure/ttlCache.js +211 -0
- package/module/es5/Error/flatMapResult.d.ts +23 -0
- package/module/es5/Error/flatMapResult.js +33 -0
- package/module/es5/Error/index.d.ts +3 -0
- package/module/es5/Error/index.js +33 -0
- package/module/es5/Error/mapResult.d.ts +21 -0
- package/module/es5/Error/mapResult.js +32 -0
- package/module/es5/Error/matchResult.d.ts +25 -0
- package/module/es5/Error/matchResult.js +32 -0
- package/module/es5/Error/safeExecute.d.ts +16 -3
- package/module/es5/Error/safeExecute.js +3 -3
- package/module/es5/Function/debounce.d.ts +38 -0
- package/module/es5/Function/debounce.js +88 -0
- package/module/es5/Function/index.d.ts +4 -0
- package/module/es5/Function/index.js +44 -0
- package/module/es5/Function/memoize.d.ts +36 -0
- package/module/es5/Function/memoize.js +73 -0
- package/module/es5/Function/once.d.ts +18 -0
- package/module/es5/Function/once.js +37 -0
- package/module/es5/Function/throttle.d.ts +25 -0
- package/module/es5/Function/throttle.js +69 -0
- package/module/es5/IP/cidrToLong.d.ts +0 -1
- package/module/es5/IP/cidrToLong.js +0 -4
- package/module/es5/IP/cidrToSubnetMask.d.ts +0 -1
- package/module/es5/IP/cidrToSubnetMask.js +0 -1
- package/module/es5/IP/getNetworkAddress.d.ts +0 -1
- package/module/es5/IP/getNetworkAddress.js +2 -31
- package/module/es5/IP/ipToBinaryString.d.ts +0 -1
- package/module/es5/IP/ipToBinaryString.js +1 -40
- package/module/es5/IP/ipToLong.d.ts +0 -1
- package/module/es5/IP/ipToLong.js +0 -1
- package/module/es5/IP/isInRange.d.ts +0 -1
- package/module/es5/IP/isInRange.js +5 -29
- package/module/es5/IP/isPrivateIp.d.ts +0 -1
- package/module/es5/IP/isPrivateIp.js +3 -12
- package/module/es5/IP/longToIp.d.ts +0 -1
- package/module/es5/IP/longToIp.js +0 -6
- package/module/es5/IP/subnetMaskToCidr.d.ts +0 -1
- package/module/es5/IP/subnetMaskToCidr.js +2 -26
- package/module/es5/Iterator/index.d.ts +3 -0
- package/module/es5/Iterator/index.js +38 -0
- package/module/es5/Iterator/lazyFilter.d.ts +10 -0
- package/module/es5/Iterator/lazyFilter.js +63 -0
- package/module/es5/Iterator/lazyMap.d.ts +10 -0
- package/module/es5/Iterator/lazyMap.js +59 -0
- package/module/es5/Iterator/lazyTake.d.ts +10 -0
- package/module/es5/Iterator/lazyTake.js +65 -0
- package/module/es5/Math/addition.js +24 -14
- package/module/es5/Math/average.js +3 -5
- package/module/es5/Math/bitwise.js +1 -1
- package/module/es5/Math/calculator/core.js +2 -1
- package/module/es5/Math/calculator/literalExpression.js +1 -1
- package/module/es5/Math/clamp.d.ts +16 -0
- package/module/es5/Math/clamp.js +24 -0
- package/module/es5/Math/correlationCoefficient.js +0 -3
- package/module/es5/Math/inRange.d.ts +19 -0
- package/module/es5/Math/inRange.js +29 -0
- package/module/es5/Math/index.d.ts +3 -0
- package/module/es5/Math/index.js +33 -0
- package/module/es5/Math/median.js +2 -2
- package/module/es5/Math/nCr.js +2 -4
- package/module/es5/Math/percentile.js +2 -11
- package/module/es5/Math/primeFactorization.js +1 -1
- package/module/es5/Math/sumPrecise.d.ts +14 -0
- package/module/es5/Math/sumPrecise.js +41 -0
- package/module/es5/Math/uuidv7.js +25 -40
- package/module/es5/Number/formatNumber.d.ts +42 -0
- package/module/es5/Number/formatNumber.js +58 -0
- package/module/es5/Number/index.d.ts +3 -0
- package/module/es5/Number/index.js +38 -0
- package/module/es5/Number/toOrdinal.d.ts +20 -0
- package/module/es5/Number/toOrdinal.js +42 -0
- package/module/es5/Number/toPercentage.d.ts +20 -0
- package/module/es5/Number/toPercentage.js +33 -0
- package/module/es5/Object/deepClone.d.ts +15 -0
- package/module/es5/Object/deepClone.js +107 -0
- package/module/es5/Object/getObjectsCommon.d.ts +23 -0
- package/module/es5/Object/getObjectsCommon.js +92 -0
- package/module/es5/Object/getObjectsDiff.d.ts +25 -0
- package/module/es5/Object/getObjectsDiff.js +146 -0
- package/module/es5/Object/index.d.ts +6 -0
- package/module/es5/Object/index.js +66 -0
- package/module/es5/Object/isPlainObject.d.ts +16 -0
- package/module/es5/Object/isPlainObject.js +39 -0
- package/module/es5/Object/mapKeys.d.ts +15 -0
- package/module/es5/Object/mapKeys.js +33 -0
- package/module/es5/Object/mapValues.d.ts +15 -0
- package/module/es5/Object/mapValues.js +32 -0
- package/module/es5/Object/mergeDeep.js +7 -10
- package/module/es5/Object/omit.d.ts +1 -1
- package/module/es5/Object/pickDeep.js +4 -6
- package/module/es5/Predicate/every.d.ts +14 -0
- package/module/es5/Predicate/every.js +33 -0
- package/module/es5/Predicate/index.d.ts +6 -0
- package/module/es5/Predicate/index.js +71 -0
- package/module/es5/Predicate/isNotNullish.d.ts +11 -0
- package/module/es5/Predicate/isNotNullish.js +19 -0
- package/module/es5/Predicate/isNullish.d.ts +11 -0
- package/module/es5/Predicate/isNullish.js +19 -0
- package/module/es5/Predicate/matches.d.ts +11 -0
- package/module/es5/Predicate/matches.js +28 -0
- package/module/es5/Predicate/not.d.ts +10 -0
- package/module/es5/Predicate/not.js +20 -0
- package/module/es5/Predicate/some.d.ts +15 -0
- package/module/es5/Predicate/some.js +34 -0
- package/module/es5/String/camelCase.js +2 -2
- package/module/es5/String/escapeHtml.js +1 -1
- package/module/es5/String/formatString/getValue.js +1 -1
- package/module/es5/String/fromBase64.d.ts +0 -1
- package/module/es5/String/fromBase64.js +9 -8
- package/module/es5/String/fuzzySearch.js +84 -9
- package/module/es5/String/kebabCase.js +1 -1
- package/module/es5/String/levenshteinDistance.js +3 -2
- package/module/es5/String/randomString.js +24 -2
- package/module/es5/String/reverseString.js +7 -1
- package/module/es5/String/slugify.js +1 -1
- package/module/es5/String/toHalfWidth.js +2 -2
- package/module/es5/String/truncate.js +0 -3
- package/module/es5/String/unescapeHtml.js +1 -1
- package/module/es5/Time/convertTime.js +4 -3
- package/module/es5/Tool/escapeRegExp.d.ts +8 -0
- package/module/es5/Tool/escapeRegExp.js +18 -0
- package/module/es5/Tool/index.d.ts +1 -0
- package/module/es5/Tool/index.js +11 -0
- package/module/es5/URL/buildUrl.d.ts +17 -0
- package/module/es5/URL/buildUrl.js +31 -0
- package/module/es5/URL/index.d.ts +4 -0
- package/module/es5/URL/index.js +49 -0
- package/module/es5/URL/isAbsoluteUrl.d.ts +20 -0
- package/module/es5/URL/isAbsoluteUrl.js +28 -0
- package/module/es5/URL/joinPath.d.ts +24 -0
- package/module/es5/URL/joinPath.js +48 -0
- package/module/es5/URL/parseQueryString.d.ts +22 -0
- package/module/es5/URL/parseQueryString.js +57 -0
- package/module/es5/Validate/parseEmail.js +5 -5
- package/module/es5/index.d.ts +25 -20
- package/module/es5/index.js +135 -80
- package/module/es5/tsconfig.tsbuildinfo +1 -1
- package/module/index.d.ts +25 -20
- package/module/index.js +25 -20
- package/module/index.js.map +1 -1
- package/package.json +43 -17
|
@@ -4,8 +4,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.average = void 0;
|
|
7
|
-
var _addition = require("./addition");
|
|
8
7
|
var _division = require("./division");
|
|
8
|
+
var _sum = require("../Array/sum");
|
|
9
9
|
/**
|
|
10
10
|
* Calculates the arithmetic mean of an array of numbers
|
|
11
11
|
* @param {number[]} numbers - Array of numbers to average
|
|
@@ -19,9 +19,7 @@ var average = exports.average = function average(numbers) {
|
|
|
19
19
|
if (numbers.length === 0) {
|
|
20
20
|
return 0;
|
|
21
21
|
}
|
|
22
|
-
var
|
|
23
|
-
|
|
24
|
-
}, 0);
|
|
25
|
-
var avg = (0, _division.division)(sum, numbers.length);
|
|
22
|
+
var total = (0, _sum.sum)(numbers);
|
|
23
|
+
var avg = (0, _division.division)(total, numbers.length);
|
|
26
24
|
return avg;
|
|
27
25
|
};
|
|
@@ -9,6 +9,7 @@ var _addition = require("../../Math/addition");
|
|
|
9
9
|
var _division = require("../../Math/division");
|
|
10
10
|
var _multiplication = require("../../Math/multiplication");
|
|
11
11
|
var _subtract = require("../../Math/subtract");
|
|
12
|
+
var _escapeRegExp = require("../../Tool/escapeRegExp");
|
|
12
13
|
var _isNumber = require("../../Validate/isNumber");
|
|
13
14
|
var calculatorCore = exports.calculatorCore = function calculatorCore(expression, currencyExchange) {
|
|
14
15
|
// Handle empty string
|
|
@@ -84,7 +85,7 @@ var getCurrencyRegex = function getCurrencyRegex(currencySymbol) {
|
|
|
84
85
|
if (cached) {
|
|
85
86
|
return cached;
|
|
86
87
|
}
|
|
87
|
-
var regex = new RegExp("
|
|
88
|
+
var regex = new RegExp("".concat((0, _escapeRegExp.escapeRegExp)(currencySymbol), "([0-9]+)"));
|
|
88
89
|
currencyRegexCache.set(currencySymbol, regex);
|
|
89
90
|
return regex;
|
|
90
91
|
};
|
|
@@ -36,7 +36,7 @@ var literalExpression = exports.literalExpression = function literalExpression(x
|
|
|
36
36
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
37
37
|
var part = _step.value;
|
|
38
38
|
if (/[A-Za-z]+/.test(part)) {
|
|
39
|
-
variablePart = part.split(/([
|
|
39
|
+
variablePart = part.split(/([+-]?\d*[A-Za-z]+)|([+-]?\d+)/).filter(function (n) {
|
|
40
40
|
return n && n !== undefined;
|
|
41
41
|
});
|
|
42
42
|
} else {
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Clamps a number between a minimum and maximum value.
|
|
3
|
+
*
|
|
4
|
+
* @param value - The number to clamp.
|
|
5
|
+
* @param min - The minimum bound.
|
|
6
|
+
* @param max - The maximum bound.
|
|
7
|
+
* @returns The clamped number.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```typescript
|
|
11
|
+
* clamp(5, 0, 10); // 5
|
|
12
|
+
* clamp(-3, 0, 10); // 0
|
|
13
|
+
* clamp(15, 0, 10); // 10
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
export declare const clamp: (value: number, min: number, max: number) => number;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.clamp = void 0;
|
|
7
|
+
/**
|
|
8
|
+
* Clamps a number between a minimum and maximum value.
|
|
9
|
+
*
|
|
10
|
+
* @param value - The number to clamp.
|
|
11
|
+
* @param min - The minimum bound.
|
|
12
|
+
* @param max - The maximum bound.
|
|
13
|
+
* @returns The clamped number.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```typescript
|
|
17
|
+
* clamp(5, 0, 10); // 5
|
|
18
|
+
* clamp(-3, 0, 10); // 0
|
|
19
|
+
* clamp(15, 0, 10); // 10
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
var clamp = exports.clamp = function clamp(value, min, max) {
|
|
23
|
+
return Math.min(Math.max(value, min), max);
|
|
24
|
+
};
|
|
@@ -23,9 +23,6 @@ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length)
|
|
|
23
23
|
* correlationCoefficient([1, 2, 3, 4, 5], [1, 1, 1, 1, 1]); // 0 (no correlation)
|
|
24
24
|
*/
|
|
25
25
|
var correlationCoefficient = exports.correlationCoefficient = function correlationCoefficient(x, y) {
|
|
26
|
-
if (x.length !== y.length) {
|
|
27
|
-
throw new Error("Arrays must have the same length");
|
|
28
|
-
}
|
|
29
26
|
if (x.length === 0) {
|
|
30
27
|
return Number.NaN;
|
|
31
28
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checks if a number is within a given range.
|
|
3
|
+
* If only two arguments are provided, the range is [0, start).
|
|
4
|
+
* If three arguments are provided, the range is [min(start, end), max(start, end)).
|
|
5
|
+
*
|
|
6
|
+
* @param value - The number to check.
|
|
7
|
+
* @param start - The start of the range, or the end if end is not provided.
|
|
8
|
+
* @param end - The end of the range (optional).
|
|
9
|
+
* @returns True if the value is within the range, false otherwise.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```typescript
|
|
13
|
+
* inRange(3, 5); // true (range: [0, 5))
|
|
14
|
+
* inRange(5, 5); // false (range: [0, 5))
|
|
15
|
+
* inRange(3, 2, 5); // true (range: [2, 5))
|
|
16
|
+
* inRange(3, 5, 2); // true (range: [2, 5))
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
export declare const inRange: (value: number, start: number, end?: number) => boolean;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.inRange = void 0;
|
|
7
|
+
/**
|
|
8
|
+
* Checks if a number is within a given range.
|
|
9
|
+
* If only two arguments are provided, the range is [0, start).
|
|
10
|
+
* If three arguments are provided, the range is [min(start, end), max(start, end)).
|
|
11
|
+
*
|
|
12
|
+
* @param value - The number to check.
|
|
13
|
+
* @param start - The start of the range, or the end if end is not provided.
|
|
14
|
+
* @param end - The end of the range (optional).
|
|
15
|
+
* @returns True if the value is within the range, false otherwise.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```typescript
|
|
19
|
+
* inRange(3, 5); // true (range: [0, 5))
|
|
20
|
+
* inRange(5, 5); // false (range: [0, 5))
|
|
21
|
+
* inRange(3, 2, 5); // true (range: [2, 5))
|
|
22
|
+
* inRange(3, 5, 2); // true (range: [2, 5))
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
var inRange = exports.inRange = function inRange(value, start, end) {
|
|
26
|
+
var lower = end === undefined ? Math.min(start, 0) : Math.min(start, end);
|
|
27
|
+
var upper = end === undefined ? Math.max(start, 0) : Math.max(start, end);
|
|
28
|
+
return value >= lower && value < upper;
|
|
29
|
+
};
|
|
@@ -2,6 +2,7 @@ export * from "./addition";
|
|
|
2
2
|
export * from "./average";
|
|
3
3
|
export * from "./bitwise";
|
|
4
4
|
export * from "./calculator";
|
|
5
|
+
export * from "./clamp";
|
|
5
6
|
export * from "./correlationCoefficient";
|
|
6
7
|
export * from "./degToRad";
|
|
7
8
|
export * from "./deviationValue";
|
|
@@ -11,6 +12,7 @@ export * from "./factorize";
|
|
|
11
12
|
export * from "./flexibleNumberConversion";
|
|
12
13
|
export * from "./gcd";
|
|
13
14
|
export * from "./getDecimalLength";
|
|
15
|
+
export * from "./inRange";
|
|
14
16
|
export * from "./lcm";
|
|
15
17
|
export * from "./linearCongruentialGenerator";
|
|
16
18
|
export * from "./mathConverter";
|
|
@@ -35,6 +37,7 @@ export * from "./roundOf";
|
|
|
35
37
|
export * from "./solveEquation";
|
|
36
38
|
export * from "./standardDeviation";
|
|
37
39
|
export * from "./subtract";
|
|
40
|
+
export * from "./sumPrecise";
|
|
38
41
|
export * from "./toBaseN";
|
|
39
42
|
export * from "./toCelsius";
|
|
40
43
|
export * from "./toKelvin";
|
package/module/es5/Math/index.js
CHANGED
|
@@ -47,6 +47,17 @@ Object.keys(_calculator).forEach(function (key) {
|
|
|
47
47
|
}
|
|
48
48
|
});
|
|
49
49
|
});
|
|
50
|
+
var _clamp = require("./clamp");
|
|
51
|
+
Object.keys(_clamp).forEach(function (key) {
|
|
52
|
+
if (key === "default" || key === "__esModule") return;
|
|
53
|
+
if (key in exports && exports[key] === _clamp[key]) return;
|
|
54
|
+
Object.defineProperty(exports, key, {
|
|
55
|
+
enumerable: true,
|
|
56
|
+
get: function get() {
|
|
57
|
+
return _clamp[key];
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
});
|
|
50
61
|
var _correlationCoefficient = require("./correlationCoefficient");
|
|
51
62
|
Object.keys(_correlationCoefficient).forEach(function (key) {
|
|
52
63
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -146,6 +157,17 @@ Object.keys(_getDecimalLength).forEach(function (key) {
|
|
|
146
157
|
}
|
|
147
158
|
});
|
|
148
159
|
});
|
|
160
|
+
var _inRange = require("./inRange");
|
|
161
|
+
Object.keys(_inRange).forEach(function (key) {
|
|
162
|
+
if (key === "default" || key === "__esModule") return;
|
|
163
|
+
if (key in exports && exports[key] === _inRange[key]) return;
|
|
164
|
+
Object.defineProperty(exports, key, {
|
|
165
|
+
enumerable: true,
|
|
166
|
+
get: function get() {
|
|
167
|
+
return _inRange[key];
|
|
168
|
+
}
|
|
169
|
+
});
|
|
170
|
+
});
|
|
149
171
|
var _lcm = require("./lcm");
|
|
150
172
|
Object.keys(_lcm).forEach(function (key) {
|
|
151
173
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -410,6 +432,17 @@ Object.keys(_subtract).forEach(function (key) {
|
|
|
410
432
|
}
|
|
411
433
|
});
|
|
412
434
|
});
|
|
435
|
+
var _sumPrecise = require("./sumPrecise");
|
|
436
|
+
Object.keys(_sumPrecise).forEach(function (key) {
|
|
437
|
+
if (key === "default" || key === "__esModule") return;
|
|
438
|
+
if (key in exports && exports[key] === _sumPrecise[key]) return;
|
|
439
|
+
Object.defineProperty(exports, key, {
|
|
440
|
+
enumerable: true,
|
|
441
|
+
get: function get() {
|
|
442
|
+
return _sumPrecise[key];
|
|
443
|
+
}
|
|
444
|
+
});
|
|
445
|
+
});
|
|
413
446
|
var _toBaseN = require("./toBaseN");
|
|
414
447
|
Object.keys(_toBaseN).forEach(function (key) {
|
|
415
448
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.median = void 0;
|
|
7
|
-
var
|
|
7
|
+
var _ultraNumberSort = require("../Array/ultraNumberSort");
|
|
8
8
|
/**
|
|
9
9
|
* Calculate the median of an array of numbers
|
|
10
10
|
* @param {number[]} array Array of numbers
|
|
@@ -12,7 +12,7 @@ var _quickSort = require("../Array/quickSort");
|
|
|
12
12
|
* @example median([1, 3, 3, 6, 7, 8, 9]); // 6
|
|
13
13
|
*/
|
|
14
14
|
var median = exports.median = function median(array) {
|
|
15
|
-
var sortedArray = (0,
|
|
15
|
+
var sortedArray = (0, _ultraNumberSort.ultraNumberSort)(array);
|
|
16
16
|
var mid = Math.floor(sortedArray.length / 2);
|
|
17
17
|
return sortedArray.length % 2 === 0 ? (sortedArray[mid - 1] + sortedArray[mid]) / 2 : sortedArray[mid];
|
|
18
18
|
};
|
package/module/es5/Math/nCr.js
CHANGED
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.nCr = void 0;
|
|
7
|
+
var _factorial = require("./factorial");
|
|
7
8
|
var _nPr = require("./nPr");
|
|
8
9
|
/**
|
|
9
10
|
* Calculates combinations (nCr) - number of ways to choose r items from n items
|
|
@@ -23,10 +24,7 @@ var nCr = exports.nCr = function nCr(n, r) {
|
|
|
23
24
|
return 1;
|
|
24
25
|
}
|
|
25
26
|
var numerator = (0, _nPr.nPr)(n, r);
|
|
26
|
-
var denominator =
|
|
27
|
-
for (var index = 2; index <= r; index++) {
|
|
28
|
-
denominator *= index;
|
|
29
|
-
}
|
|
27
|
+
var denominator = (0, _factorial.factorial)(r);
|
|
30
28
|
var result = numerator / denominator;
|
|
31
29
|
return result;
|
|
32
30
|
};
|
|
@@ -4,13 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.percentile = void 0;
|
|
7
|
-
var
|
|
8
|
-
function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
|
|
9
|
-
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
10
|
-
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
11
|
-
function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
|
|
12
|
-
function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
|
|
13
|
-
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
7
|
+
var _ultraNumberSort = require("../Array/ultraNumberSort");
|
|
14
8
|
/**
|
|
15
9
|
* Calculate the nth percentile of values in an array
|
|
16
10
|
* @param array - Array of numbers
|
|
@@ -25,10 +19,7 @@ var percentile = exports.percentile = function percentile(array, _percentile) {
|
|
|
25
19
|
if (array.length === 0) {
|
|
26
20
|
return Number.NaN;
|
|
27
21
|
}
|
|
28
|
-
|
|
29
|
-
throw new Error("Percentile must be between 0 and 100");
|
|
30
|
-
}
|
|
31
|
-
var sortedArray = (0, _quickSort.quickSort)(_toConsumableArray(array));
|
|
22
|
+
var sortedArray = (0, _ultraNumberSort.ultraNumberSort)(array);
|
|
32
23
|
var index = _percentile / 100 * (sortedArray.length - 1);
|
|
33
24
|
var lowerIndex = Math.floor(index);
|
|
34
25
|
var upperIndex = Math.ceil(index);
|
|
@@ -14,7 +14,7 @@ exports.primeFactorization = void 0;
|
|
|
14
14
|
* For example, 12 = 2^2 * 3^1 is represented as [{number: 2, count: 2}, {number: 3, count: 1}]
|
|
15
15
|
*/
|
|
16
16
|
var primeFactorization = exports.primeFactorization = function primeFactorization(x) {
|
|
17
|
-
var n
|
|
17
|
+
var n;
|
|
18
18
|
var copyX = x;
|
|
19
19
|
var out = [];
|
|
20
20
|
for (var index = 2; index * index <= copyX; index++) {
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Computes the sum of an array of numbers using the Neumaier
|
|
3
|
+
* summation algorithm for improved floating-point precision.
|
|
4
|
+
*
|
|
5
|
+
* @param numbers - The array of numbers to sum.
|
|
6
|
+
* @returns The precise sum of all numbers.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* sumPrecise([0.1, 0.2, 0.3]); // 0.6
|
|
11
|
+
* sumPrecise([1e20, 1, -1e20]); // 1
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
14
|
+
export declare const sumPrecise: (numbers: number[]) => number;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.sumPrecise = void 0;
|
|
7
|
+
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
|
|
8
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
9
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
10
|
+
/**
|
|
11
|
+
* Computes the sum of an array of numbers using the Neumaier
|
|
12
|
+
* summation algorithm for improved floating-point precision.
|
|
13
|
+
*
|
|
14
|
+
* @param numbers - The array of numbers to sum.
|
|
15
|
+
* @returns The precise sum of all numbers.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```typescript
|
|
19
|
+
* sumPrecise([0.1, 0.2, 0.3]); // 0.6
|
|
20
|
+
* sumPrecise([1e20, 1, -1e20]); // 1
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
var sumPrecise = exports.sumPrecise = function sumPrecise(numbers) {
|
|
24
|
+
var sum = 0;
|
|
25
|
+
var compensation = 0;
|
|
26
|
+
var _iterator = _createForOfIteratorHelper(numbers),
|
|
27
|
+
_step;
|
|
28
|
+
try {
|
|
29
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
30
|
+
var number_ = _step.value;
|
|
31
|
+
var t = sum + number_;
|
|
32
|
+
compensation += Math.abs(sum) >= Math.abs(number_) ? sum - t + number_ : number_ - t + sum;
|
|
33
|
+
sum = t;
|
|
34
|
+
}
|
|
35
|
+
} catch (err) {
|
|
36
|
+
_iterator.e(err);
|
|
37
|
+
} finally {
|
|
38
|
+
_iterator.f();
|
|
39
|
+
}
|
|
40
|
+
return sum + compensation;
|
|
41
|
+
};
|
|
@@ -4,13 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.uuidv7 = void 0;
|
|
7
|
-
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
8
|
-
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
9
|
-
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
10
|
-
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
11
|
-
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
|
|
12
|
-
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
13
|
-
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
14
7
|
/**
|
|
15
8
|
* Generates a UUID v7 (Universally Unique Identifier version 7)
|
|
16
9
|
* @returns {string} A UUID v7 string in the format xxxxxxxx-xxxx-7xxx-8xxx-xxxxxxxxxxxx
|
|
@@ -27,40 +20,32 @@ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length)
|
|
|
27
20
|
var uuidv7 = exports.uuidv7 = function uuidv7() {
|
|
28
21
|
var DIGITS = "0123456789abcdef";
|
|
29
22
|
var unixTsMs = Date.now();
|
|
23
|
+
|
|
24
|
+
// Create a single 16-byte buffer for the UUID
|
|
30
25
|
var bytes = new Uint8Array(16);
|
|
31
|
-
for (var index = 0; index < 6; index++) {
|
|
32
|
-
bytes[index] = unixTsMs >>> (5 - index) * 8 & 0xff;
|
|
33
|
-
}
|
|
34
26
|
|
|
35
|
-
//
|
|
36
|
-
|
|
37
|
-
|
|
27
|
+
// Fill the entire buffer with random data first.
|
|
28
|
+
// This avoids allocating a separate 10-byte buffer for randomness.
|
|
29
|
+
// We will overwrite the first 6 bytes with the timestamp.
|
|
30
|
+
globalThis.crypto.getRandomValues(bytes);
|
|
31
|
+
|
|
32
|
+
// Overwrite first 6 bytes with 48-bit timestamp (Big-Endian)
|
|
33
|
+
// Note: We use division for the high 16 bits because JS bitwise operators (>>>)
|
|
34
|
+
// truncate to 32 bits, which would corrupt the 48-bit timestamp.
|
|
35
|
+
bytes[0] = unixTsMs / 0x10000000000 & 0xff;
|
|
36
|
+
bytes[1] = unixTsMs / 0x100000000 & 0xff;
|
|
37
|
+
bytes[2] = unixTsMs >>> 24 & 0xff;
|
|
38
|
+
bytes[3] = unixTsMs >>> 16 & 0xff;
|
|
39
|
+
bytes[4] = unixTsMs >>> 8 & 0xff;
|
|
40
|
+
bytes[5] = unixTsMs & 0xff;
|
|
41
|
+
|
|
42
|
+
// Version 7 (0x70) + 4 bits from random data (already in bytes[6])
|
|
43
|
+
bytes[6] = 0x70 | bytes[6] & 0x0f;
|
|
44
|
+
|
|
45
|
+
// Variant 2 (0x80) + 6 bits from random data (already in bytes[8])
|
|
46
|
+
bytes[8] = 0x80 | bytes[8] & 0x3f;
|
|
38
47
|
|
|
39
|
-
//
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
bytes[7] = randomBytes[1];
|
|
43
|
-
// Variant 2 (0x80) + 6 bits from randomBytes[2]
|
|
44
|
-
bytes[8] = 0x80 | randomBytes[2] & 0x3f;
|
|
45
|
-
// Remaining random bytes
|
|
46
|
-
bytes.set(randomBytes.subarray(3), 9);
|
|
47
|
-
var uuid = "";
|
|
48
|
-
var _iterator = _createForOfIteratorHelper(bytes.entries()),
|
|
49
|
-
_step;
|
|
50
|
-
try {
|
|
51
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
52
|
-
var _step$value = _slicedToArray(_step.value, 2),
|
|
53
|
-
_index = _step$value[0],
|
|
54
|
-
_byte = _step$value[1];
|
|
55
|
-
uuid += DIGITS[_byte >>> 4] + DIGITS[_byte & 0xf];
|
|
56
|
-
if (_index === 3 || _index === 5 || _index === 7 || _index === 9) {
|
|
57
|
-
uuid += "-";
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
} catch (err) {
|
|
61
|
-
_iterator.e(err);
|
|
62
|
-
} finally {
|
|
63
|
-
_iterator.f();
|
|
64
|
-
}
|
|
65
|
-
return uuid;
|
|
48
|
+
// Convert to string (unrolled for performance)
|
|
49
|
+
// Format: 8-4-4-4-12 hex digits (xxxxxxxx-xxxx-7xxx-8xxx-xxxxxxxxxxxx)
|
|
50
|
+
return DIGITS[bytes[0] >>> 4] + DIGITS[bytes[0] & 0xf] + DIGITS[bytes[1] >>> 4] + DIGITS[bytes[1] & 0xf] + DIGITS[bytes[2] >>> 4] + DIGITS[bytes[2] & 0xf] + DIGITS[bytes[3] >>> 4] + DIGITS[bytes[3] & 0xf] + "-" + DIGITS[bytes[4] >>> 4] + DIGITS[bytes[4] & 0xf] + DIGITS[bytes[5] >>> 4] + DIGITS[bytes[5] & 0xf] + "-" + DIGITS[bytes[6] >>> 4] + DIGITS[bytes[6] & 0xf] + DIGITS[bytes[7] >>> 4] + DIGITS[bytes[7] & 0xf] + "-" + DIGITS[bytes[8] >>> 4] + DIGITS[bytes[8] & 0xf] + DIGITS[bytes[9] >>> 4] + DIGITS[bytes[9] & 0xf] + "-" + DIGITS[bytes[10] >>> 4] + DIGITS[bytes[10] & 0xf] + DIGITS[bytes[11] >>> 4] + DIGITS[bytes[11] & 0xf] + DIGITS[bytes[12] >>> 4] + DIGITS[bytes[12] & 0xf] + DIGITS[bytes[13] >>> 4] + DIGITS[bytes[13] & 0xf] + DIGITS[bytes[14] >>> 4] + DIGITS[bytes[14] & 0xf] + DIGITS[bytes[15] >>> 4] + DIGITS[bytes[15] & 0xf];
|
|
66
51
|
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Options for formatting a number.
|
|
3
|
+
*/
|
|
4
|
+
export interface FormatNumberOptions {
|
|
5
|
+
/** The locale to use for formatting (e.g., "en-US", "ja-JP") */
|
|
6
|
+
locale?: string;
|
|
7
|
+
/** Minimum number of fraction digits */
|
|
8
|
+
minimumFractionDigits?: number;
|
|
9
|
+
/** Maximum number of fraction digits */
|
|
10
|
+
maximumFractionDigits?: number;
|
|
11
|
+
/** The formatting style */
|
|
12
|
+
style?: "decimal" | "currency" | "percent";
|
|
13
|
+
/** The currency code (required when style is "currency") */
|
|
14
|
+
currency?: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Formats a number using Intl.NumberFormat.
|
|
18
|
+
*
|
|
19
|
+
* @param value - The number to format
|
|
20
|
+
* @param options - Formatting options
|
|
21
|
+
* @returns The formatted number string
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```typescript
|
|
25
|
+
* formatNumber(1234567.89);
|
|
26
|
+
* // "1,234,567.89" (in en-US locale)
|
|
27
|
+
*
|
|
28
|
+
* formatNumber(1234567.89, { locale: "de-DE" });
|
|
29
|
+
* // "1.234.567,89"
|
|
30
|
+
*
|
|
31
|
+
* formatNumber(0.75, { style: "percent" });
|
|
32
|
+
* // "75%"
|
|
33
|
+
*
|
|
34
|
+
* formatNumber(1234.5, {
|
|
35
|
+
* style: "currency",
|
|
36
|
+
* currency: "USD",
|
|
37
|
+
* locale: "en-US",
|
|
38
|
+
* });
|
|
39
|
+
* // "$1,234.50"
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
export declare const formatNumber: (value: number, options?: FormatNumberOptions) => string;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.formatNumber = void 0;
|
|
7
|
+
/**
|
|
8
|
+
* Options for formatting a number.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Formats a number using Intl.NumberFormat.
|
|
13
|
+
*
|
|
14
|
+
* @param value - The number to format
|
|
15
|
+
* @param options - Formatting options
|
|
16
|
+
* @returns The formatted number string
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```typescript
|
|
20
|
+
* formatNumber(1234567.89);
|
|
21
|
+
* // "1,234,567.89" (in en-US locale)
|
|
22
|
+
*
|
|
23
|
+
* formatNumber(1234567.89, { locale: "de-DE" });
|
|
24
|
+
* // "1.234.567,89"
|
|
25
|
+
*
|
|
26
|
+
* formatNumber(0.75, { style: "percent" });
|
|
27
|
+
* // "75%"
|
|
28
|
+
*
|
|
29
|
+
* formatNumber(1234.5, {
|
|
30
|
+
* style: "currency",
|
|
31
|
+
* currency: "USD",
|
|
32
|
+
* locale: "en-US",
|
|
33
|
+
* });
|
|
34
|
+
* // "$1,234.50"
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
var formatNumber = exports.formatNumber = function formatNumber(value) {
|
|
38
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
39
|
+
var locale = options.locale,
|
|
40
|
+
minimumFractionDigits = options.minimumFractionDigits,
|
|
41
|
+
maximumFractionDigits = options.maximumFractionDigits,
|
|
42
|
+
style = options.style,
|
|
43
|
+
currency = options.currency;
|
|
44
|
+
var formatOptions = {};
|
|
45
|
+
if (style !== undefined) {
|
|
46
|
+
formatOptions.style = style;
|
|
47
|
+
}
|
|
48
|
+
if (currency !== undefined) {
|
|
49
|
+
formatOptions.currency = currency;
|
|
50
|
+
}
|
|
51
|
+
if (minimumFractionDigits !== undefined) {
|
|
52
|
+
formatOptions.minimumFractionDigits = minimumFractionDigits;
|
|
53
|
+
}
|
|
54
|
+
if (maximumFractionDigits !== undefined) {
|
|
55
|
+
formatOptions.maximumFractionDigits = maximumFractionDigits;
|
|
56
|
+
}
|
|
57
|
+
return new Intl.NumberFormat(locale, formatOptions).format(value);
|
|
58
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _formatNumber = require("./formatNumber");
|
|
7
|
+
Object.keys(_formatNumber).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _formatNumber[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function get() {
|
|
13
|
+
return _formatNumber[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
var _toOrdinal = require("./toOrdinal");
|
|
18
|
+
Object.keys(_toOrdinal).forEach(function (key) {
|
|
19
|
+
if (key === "default" || key === "__esModule") return;
|
|
20
|
+
if (key in exports && exports[key] === _toOrdinal[key]) return;
|
|
21
|
+
Object.defineProperty(exports, key, {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function get() {
|
|
24
|
+
return _toOrdinal[key];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
var _toPercentage = require("./toPercentage");
|
|
29
|
+
Object.keys(_toPercentage).forEach(function (key) {
|
|
30
|
+
if (key === "default" || key === "__esModule") return;
|
|
31
|
+
if (key in exports && exports[key] === _toPercentage[key]) return;
|
|
32
|
+
Object.defineProperty(exports, key, {
|
|
33
|
+
enumerable: true,
|
|
34
|
+
get: function get() {
|
|
35
|
+
return _toPercentage[key];
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Converts a number to its English ordinal string representation.
|
|
3
|
+
*
|
|
4
|
+
* Handles the special cases for 11th, 12th, and 13th
|
|
5
|
+
* (which end in "th" despite their last digit).
|
|
6
|
+
*
|
|
7
|
+
* @param value - The number to convert to ordinal form
|
|
8
|
+
* @returns The ordinal string (e.g., "1st", "2nd", "3rd", "11th")
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```typescript
|
|
12
|
+
* toOrdinal(1); // "1st"
|
|
13
|
+
* toOrdinal(2); // "2nd"
|
|
14
|
+
* toOrdinal(3); // "3rd"
|
|
15
|
+
* toOrdinal(11); // "11th"
|
|
16
|
+
* toOrdinal(21); // "21st"
|
|
17
|
+
* toOrdinal(112); // "112th"
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export declare const toOrdinal: (value: number) => string;
|