umt 2.12.3 → 2.14.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 +214 -136
- 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 +4 -5
- package/module/Crypto/decodeBase32.js.map +1 -1
- package/module/Crypto/decodeBase58.js +7 -6
- 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 +7 -3
- 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 +65 -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 +243 -243
- 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 +12 -5
- package/module/es5/Crypto/decodeBase58.js +14 -8
- package/module/es5/Crypto/encodeBase32.js +2 -1
- package/module/es5/Crypto/encodeBase58.js +8 -3
- 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 +110 -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 +5 -0
- package/module/es5/index.js +73 -18
- package/module/es5/tsconfig.tsbuildinfo +1 -1
- package/module/index.d.ts +5 -0
- package/module/index.js +5 -0
- package/module/index.js.map +1 -1
- package/package.json +58 -27
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parses a query string into a key-value record.
|
|
3
|
+
*
|
|
4
|
+
* Accepts either a full URL or a raw query string
|
|
5
|
+
* (with or without leading "?").
|
|
6
|
+
*
|
|
7
|
+
* @param query - The query string or URL to parse
|
|
8
|
+
* @returns A record of key-value pairs from the query string
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```typescript
|
|
12
|
+
* parseQueryString("?page=1&q=search");
|
|
13
|
+
* // { page: "1", q: "search" }
|
|
14
|
+
*
|
|
15
|
+
* parseQueryString("foo=bar&baz=qux");
|
|
16
|
+
* // { foo: "bar", baz: "qux" }
|
|
17
|
+
*
|
|
18
|
+
* parseQueryString("https://example.com?a=1&b=2");
|
|
19
|
+
* // { a: "1", b: "2" }
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export const parseQueryString = (query) => {
|
|
23
|
+
let searchString = query;
|
|
24
|
+
if (query.includes("://")) {
|
|
25
|
+
searchString = new URL(query).search;
|
|
26
|
+
}
|
|
27
|
+
const parameters = new URLSearchParams(searchString);
|
|
28
|
+
const result = {};
|
|
29
|
+
for (const [key, value] of parameters) {
|
|
30
|
+
result[key] = value;
|
|
31
|
+
}
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
//# sourceMappingURL=parseQueryString.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parseQueryString.js","sourceRoot":"","sources":["../../src/URL/parseQueryString.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,KAAa,EAA0B,EAAE;IACxE,IAAI,YAAY,GAAG,KAAK,CAAC;IACzB,IAAI,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;QAC1B,YAAY,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC;IACvC,CAAC;IAED,MAAM,UAAU,GAAG,IAAI,eAAe,CAAC,YAAY,CAAC,CAAC;IACrD,MAAM,MAAM,GAA2B,EAAE,CAAC;IAC1C,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,UAAU,EAAE,CAAC;QACtC,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;IACtB,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
const EMAIL_PATTERNS = {
|
|
2
|
-
basic: /^(?<local>[
|
|
3
|
-
rfc822: /^(?:\s|\((?:[^()\\]|\\[\s
|
|
4
|
-
rfc2822: /^(?=.{1,998}$)(?!.*\.\.)(?<local>[
|
|
5
|
-
rfc5321: /^(?=.{1,256}$)(?=
|
|
6
|
-
rfc5322: /^(?=.{1,998}$)(?:\s|\((?:[^()\\]|\\[\s
|
|
2
|
+
basic: /^(?<local>[\w!#$%&'*+./=?^`{|}~-]+)@(?<domain>[\dA-Za-z](?:[\dA-Za-z-]{0,61}[\dA-Za-z])?(?:\.[\dA-Za-z](?:[\dA-Za-z-]{0,61}[\dA-Za-z])?)*)$/,
|
|
3
|
+
rfc822: /^(?:\s|\((?:[^()\\]|\\[\S\s])*(?:\((?:[^()\\]|\\[\S\s])*\)(?:[^()\\]|\\[\S\s])*)*\))*(?<local>"(?:[^"\\]|\\[\S\s]){0,62}"|[\w!#$%&'*/=?^`{|}~-]{1,64}(?:\.[\w!#$%&'*/=?^`{|}~-]+)*)(?:\s|\((?:[^()\\]|\\[\S\s])*(?:\((?:[^()\\]|\\[\S\s])*\)(?:[^()\\]|\\[\S\s])*)*\))*@(?:\s|\((?:[^()\\]|\\[\S\s])*(?:\((?:[^()\\]|\\[\S\s])*\)(?:[^()\\]|\\[\S\s])*)*\))*(?<domain>[\dA-Za-z](?:[\dA-Za-z-]{0,61}[\dA-Za-z])?(?:\.[\dA-Za-z](?:[\dA-Za-z-]{0,61}[\dA-Za-z])?)*)(?:\s|\((?:[^()\\]|\\[\S\s])*(?:\((?:[^()\\]|\\[\S\s])*\)(?:[^()\\]|\\[\S\s])*)*\))*$/,
|
|
4
|
+
rfc2822: /^(?=.{1,998}$)(?!.*\.\.)(?<local>[\w!#$%&'*/=?^`{|}~-](?:[\w!#$%&'*+./=?^`{|}~-]{0,62}[\w!#$%&'*/=?^`{|}~-])?)@(?<domain>[\dA-Za-z](?:[\dA-Za-z-]{0,61}[\dA-Za-z])?(?:\.[\dA-Za-z](?:[\dA-Za-z-]{0,61}[\dA-Za-z])?)*\.[A-Za-z]{2,})$/,
|
|
5
|
+
rfc5321: /^(?=.{1,256}$)(?=[^@]{1,64}@)(?!.*\.\.)(?<local>(?:[\w!#$%&'*+/=?^`{|}~-]+(?:\.[\w!#$%&'*+/=?^`{|}~-]+)*|"(?:[^"\\]|\\[\S\s]){0,62}"))@(?<domain>[\dA-Za-z](?:[\dA-Za-z-]{0,61}[\dA-Za-z])?(?:\.[\dA-Za-z](?:[\dA-Za-z-]{0,61}[\dA-Za-z])?)+|\[(?:(?:\d{1,3}\.){3}\d{1,3}|IPv6:[\d:A-Fa-f]+)])$/,
|
|
6
|
+
rfc5322: /^(?=.{1,998}$)(?:\s|\((?:[^()\\]|\\[\S\s])*(?:\((?:[^()\\]|\\[\S\s])*\)(?:[^()\\]|\\[\S\s])*)*\))*(?<local>"(?:[^"\\]|\\[\S\s]){0,62}"(?:\."(?:[^"\\]|\\[\S\s]){0,62}")*|"(?:[^"\\]|\\[\S\s]){0,62}"(?:(?:\.[\w!#$%&'*+/=?^`{|}~-]{1,64})+)+|[\w!#$%&'*+/=?^`{|}~-]{1,64}(?:\.[\w!#$%&'*+/=?^`{|}~-]{1,64})*(?:\."(?:[^"\\]|\\[\S\s]){0,62}")+|[\w!#$%&'*+/=?^`{|}~-]{1,64}(?:(?:\s|\((?:[^()\\]|\\[\S\s])*(?:\((?:[^()\\]|\\[\S\s])*\)(?:[^()\\]|\\[\S\s])*)*\))*\.(?:\s|\((?:[^()\\]|\\[\S\s])*(?:\((?:[^()\\]|\\[\S\s])*\)(?:[^()\\]|\\[\S\s])*)*\))*[\w!#$%&'*+/=?^`{|}~-]{1,64})*)(?:\s|\((?:[^()\\]|\\[\S\s])*(?:\((?:[^()\\]|\\[\S\s])*\)(?:[^()\\]|\\[\S\s])*)*\))*@(?:\s|\((?:[^()\\]|\\[\S\s])*(?:\((?:[^()\\]|\\[\S\s])*\)(?:[^()\\]|\\[\S\s])*)*\))*(?<domain>[\dA-Za-z](?:[\dA-Za-z-]{0,61}[\dA-Za-z])?(?:(?:\s|\((?:[^()\\]|\\[\S\s])*(?:\((?:[^()\\]|\\[\S\s])*\)(?:[^()\\]|\\[\S\s])*)*\))*\.(?:\s|\((?:[^()\\]|\\[\S\s])*(?:\((?:[^()\\]|\\[\S\s])*\)(?:[^()\\]|\\[\S\s])*)*\))*[\dA-Za-z](?:[\dA-Za-z-]{0,61}[\dA-Za-z])?)+|\[(?:(?:\d{1,3}\.){3}\d{1,3}|IPv6:[\d:A-Fa-f]+)])(?:\s|\((?:[^()\\]|\\[\S\s])*(?:\((?:[^()\\]|\\[\S\s])*\)(?:[^()\\]|\\[\S\s])*)*\))*$/,
|
|
7
7
|
};
|
|
8
8
|
export const parseEmail = ({ email, options, }) => {
|
|
9
9
|
const { level } = options;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parseEmail.js","sourceRoot":"","sources":["../../src/Validate/parseEmail.ts"],"names":[],"mappings":"AAOA,MAAM,cAAc,GAAG;IACrB,KAAK,EACH,
|
|
1
|
+
{"version":3,"file":"parseEmail.js","sourceRoot":"","sources":["../../src/Validate/parseEmail.ts"],"names":[],"mappings":"AAOA,MAAM,cAAc,GAAG;IACrB,KAAK,EACH,6IAA6I;IAC/I,MAAM,EACJ,yhBAAyhB;IAC3hB,OAAO,EACL,sOAAsO;IACxO,OAAO,EACL,iSAAiS;IACnS,OAAO,EACL,snCAAsnC;CAChnC,CAAC;AAMX,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,EACzB,KAAK,EACL,OAAO,GAIR,EAGC,EAAE;IACF,MAAM,EAAE,KAAK,EAAE,GAAG,OAAO,CAAC;IAC1B,MAAM,OAAO,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;IACtC,MAAM,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAElC,OAAO;QACL,KAAK,EAAE,KAAK,KAAK,IAAI;QACrB,KAAK,EAAE,KAAK,EAAE,MAAM;YAClB,CAAC,CAAC;gBACE,qFAAqF;gBACrF,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC;gBAC5B,qFAAqF;gBACrF,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC;aAC/B;YACH,CAAC,CAAC,SAAS;KACd,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -21,5 +21,5 @@ var arraysJoin = exports.arraysJoin = function arraysJoin(array) {
|
|
|
21
21
|
for (var _len = arguments.length, arrays = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
22
22
|
arrays[_key - 1] = arguments[_key];
|
|
23
23
|
}
|
|
24
|
-
return _toConsumableArray(new Set(
|
|
24
|
+
return _toConsumableArray(new Set([].concat(_toConsumableArray(array), _toConsumableArray(arrays.flat()))));
|
|
25
25
|
};
|
|
@@ -13,8 +13,9 @@ exports.chunk = void 0;
|
|
|
13
13
|
*/
|
|
14
14
|
var chunk = exports.chunk = function chunk(array, n) {
|
|
15
15
|
var length = array.length;
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
var result = Array.from({
|
|
17
|
+
length: Math.ceil(length / n)
|
|
18
|
+
});
|
|
18
19
|
for (var index = 0, k = 0; index < length; index += n, k++) {
|
|
19
20
|
result[k] = array.slice(index, index + n);
|
|
20
21
|
}
|
|
@@ -27,19 +27,37 @@ var generateNumberArray = exports.generateNumberArray = function generateNumberA
|
|
|
27
27
|
if (actualLength <= 0) {
|
|
28
28
|
return [];
|
|
29
29
|
}
|
|
30
|
-
if (min > actualMax) {
|
|
31
|
-
throw new Error("min should be less than or equal to max");
|
|
32
|
-
}
|
|
33
30
|
if (actualLength === 1) {
|
|
34
31
|
return [min];
|
|
35
32
|
}
|
|
33
|
+
var isIntegerInputs = Number.isSafeInteger(min) && Number.isSafeInteger(actualMax);
|
|
36
34
|
if (random) {
|
|
35
|
+
if (isIntegerInputs) {
|
|
36
|
+
var range = actualMax - min + 1;
|
|
37
|
+
return Array.from({
|
|
38
|
+
length: actualLength
|
|
39
|
+
}, function () {
|
|
40
|
+
return Math.floor(Math.random() * range) + min;
|
|
41
|
+
});
|
|
42
|
+
}
|
|
37
43
|
return Array.from({
|
|
38
44
|
length: actualLength
|
|
39
45
|
}, function () {
|
|
40
46
|
return (0, _addition.addition)(Math.floor((0, _multiplication.multiplication)(Math.random(), (0, _addition.addition)((0, _subtract.subtract)(actualMax, min), 1))), min);
|
|
41
47
|
});
|
|
42
48
|
}
|
|
49
|
+
if (isIntegerInputs) {
|
|
50
|
+
var _range = actualMax - min;
|
|
51
|
+
var steps = actualLength - 1;
|
|
52
|
+
if (_range % steps === 0) {
|
|
53
|
+
var _step = _range / steps;
|
|
54
|
+
return Array.from({
|
|
55
|
+
length: actualLength
|
|
56
|
+
}, function (_, index) {
|
|
57
|
+
return min + index * _step;
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
}
|
|
43
61
|
var step = (0, _division.division)((0, _subtract.subtract)(actualMax, min), (0, _subtract.subtract)(actualLength, 1));
|
|
44
62
|
return Array.from({
|
|
45
63
|
length: actualLength
|
|
@@ -31,7 +31,11 @@ var getArraysDiff = exports.getArraysDiff = function getArraysDiff(array) {
|
|
|
31
31
|
try {
|
|
32
32
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
33
33
|
var value = _step.value;
|
|
34
|
+
if (duplicates.has(value)) {
|
|
35
|
+
continue;
|
|
36
|
+
}
|
|
34
37
|
if (allValues.has(value)) {
|
|
38
|
+
allValues["delete"](value);
|
|
35
39
|
duplicates.add(value);
|
|
36
40
|
} else {
|
|
37
41
|
allValues.add(value);
|
|
@@ -43,7 +47,5 @@ var getArraysDiff = exports.getArraysDiff = function getArraysDiff(array) {
|
|
|
43
47
|
_iterator.f();
|
|
44
48
|
}
|
|
45
49
|
}
|
|
46
|
-
return _toConsumableArray(allValues)
|
|
47
|
-
return !duplicates.has(value);
|
|
48
|
-
});
|
|
50
|
+
return _toConsumableArray(allValues);
|
|
49
51
|
};
|
|
@@ -5,6 +5,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.mergeSort = void 0;
|
|
7
7
|
var _compareFunctionDefault = require("./compareFunctionDefault");
|
|
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; }
|
|
8
14
|
/**
|
|
9
15
|
* Merge sort implementation
|
|
10
16
|
* @param {T[]} array Array to sort
|
|
@@ -12,34 +18,60 @@ var _compareFunctionDefault = require("./compareFunctionDefault");
|
|
|
12
18
|
* @returns {T[]} Sorted array
|
|
13
19
|
* @example mergeSort([1, 3, 2, 4, 5], (a, b) => a - b); // [1, 2, 3, 4, 5]
|
|
14
20
|
*/
|
|
15
|
-
var
|
|
21
|
+
var mergeSort = exports.mergeSort = function mergeSort(array) {
|
|
16
22
|
var compareFunction = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _compareFunctionDefault.compareFunctionDefault;
|
|
17
23
|
if (array.length <= 1) {
|
|
18
24
|
return array;
|
|
19
25
|
}
|
|
20
|
-
var
|
|
21
|
-
var
|
|
22
|
-
var
|
|
23
|
-
|
|
26
|
+
var length = array.length;
|
|
27
|
+
var result = _toConsumableArray(array);
|
|
28
|
+
var aux = _toConsumableArray(array);
|
|
29
|
+
mergeSortRecursive(result, aux, 0, length, compareFunction);
|
|
30
|
+
return result;
|
|
24
31
|
};
|
|
25
32
|
|
|
26
33
|
/**
|
|
27
|
-
*
|
|
28
|
-
* @param
|
|
29
|
-
* @param
|
|
30
|
-
* @param
|
|
31
|
-
* @
|
|
34
|
+
* Recursive merge sort implementation
|
|
35
|
+
* @param array Array to sort
|
|
36
|
+
* @param aux Auxiliary array
|
|
37
|
+
* @param start Start index
|
|
38
|
+
* @param end End index
|
|
39
|
+
* @param compareFunction Comparison function
|
|
32
40
|
*/
|
|
33
|
-
function
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
41
|
+
function mergeSortRecursive(array, aux, start, end, compareFunction) {
|
|
42
|
+
if (end - start <= 1) {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
var mid = start + end >>> 1;
|
|
46
|
+
mergeSortRecursive(array, aux, start, mid, compareFunction);
|
|
47
|
+
mergeSortRecursive(array, aux, mid, end, compareFunction);
|
|
48
|
+
merge(array, aux, start, mid, end, compareFunction);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Merges two sorted subarrays
|
|
53
|
+
* @param array Array containing the subarrays
|
|
54
|
+
* @param aux Auxiliary array
|
|
55
|
+
* @param start Start index
|
|
56
|
+
* @param mid Middle index
|
|
57
|
+
* @param end End index
|
|
58
|
+
* @param compareFunction Comparison function
|
|
59
|
+
*/
|
|
60
|
+
function merge(array, aux, start, mid, end, compareFunction) {
|
|
61
|
+
for (var index = start; index < end; index++) {
|
|
62
|
+
aux[index] = array[index];
|
|
63
|
+
}
|
|
64
|
+
var leftIndex = start;
|
|
65
|
+
var rightIndex = mid;
|
|
66
|
+
for (var k = start; k < end; k++) {
|
|
67
|
+
if (leftIndex >= mid) {
|
|
68
|
+
array[k] = aux[rightIndex++];
|
|
69
|
+
} else if (rightIndex >= end) {
|
|
70
|
+
array[k] = aux[leftIndex++];
|
|
71
|
+
} else if (compareFunction(aux[leftIndex], aux[rightIndex]) <= 0) {
|
|
72
|
+
array[k] = aux[leftIndex++];
|
|
40
73
|
} else {
|
|
41
|
-
array
|
|
74
|
+
array[k] = aux[rightIndex++];
|
|
42
75
|
}
|
|
43
76
|
}
|
|
44
|
-
return array.concat(left.slice(lIndex)).concat(right.slice(rIndex));
|
|
45
77
|
}
|
package/module/es5/Array/pop.js
CHANGED
|
@@ -4,17 +4,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.pop = void 0;
|
|
7
|
-
function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
|
|
8
|
-
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."); }
|
|
9
|
-
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; } }
|
|
10
|
-
function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
|
|
11
|
-
function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
|
|
12
|
-
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; }
|
|
13
7
|
/**
|
|
14
8
|
* Removes the last element from an array and returns it.
|
|
15
9
|
* @param {T[]} array - The array to remove the last element from.
|
|
16
10
|
* @returns {T | undefined} - The last element of the array, or undefined if the array is empty.
|
|
17
11
|
*/
|
|
18
12
|
var pop = exports.pop = function pop(array) {
|
|
19
|
-
|
|
13
|
+
// O(1) performance instead of O(N) from [...array].pop()
|
|
14
|
+
return array.at(-1);
|
|
20
15
|
};
|
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.randomSelect = void 0;
|
|
7
|
+
var _shuffle = require("./shuffle");
|
|
7
8
|
/**
|
|
8
9
|
* Randomly selects a specified number of elements from an array
|
|
9
10
|
* @param array Source array
|
|
@@ -14,6 +15,13 @@ exports.randomSelect = void 0;
|
|
|
14
15
|
*/
|
|
15
16
|
var randomSelect = exports.randomSelect = function randomSelect(array, count) {
|
|
16
17
|
var allowDuplicates = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
18
|
+
if (!allowDuplicates && count > array.length * 0.8) {
|
|
19
|
+
var shuffled = (0, _shuffle.shuffle)(array);
|
|
20
|
+
if (count < shuffled.length) {
|
|
21
|
+
shuffled.length = count;
|
|
22
|
+
}
|
|
23
|
+
return shuffled;
|
|
24
|
+
}
|
|
17
25
|
var result = [];
|
|
18
26
|
var usedIndices = new Set();
|
|
19
27
|
while (result.length < count && (allowDuplicates || result.length < array.length)) {
|
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.validateRange = void 0;
|
|
7
|
+
var _clamp = require("../../Math/clamp");
|
|
7
8
|
/**
|
|
8
9
|
* Validates and adjusts the start and end indices for an operation on an array.
|
|
9
10
|
* Ensures indices are within the bounds of the array.
|
|
@@ -25,8 +26,8 @@ var validateRange = exports.validateRange = function validateRange(array, startI
|
|
|
25
26
|
shouldSort: false
|
|
26
27
|
};
|
|
27
28
|
}
|
|
28
|
-
var validatedStartIndex =
|
|
29
|
-
var validatedEndIndex = Math.max(validatedStartIndex,
|
|
29
|
+
var validatedStartIndex = (0, _clamp.clamp)(startIndex, 0, length - 1);
|
|
30
|
+
var validatedEndIndex = Math.max(validatedStartIndex, (0, _clamp.clamp)(endIndex, 0, length - 1));
|
|
30
31
|
return {
|
|
31
32
|
startIndex: validatedStartIndex,
|
|
32
33
|
endIndex: validatedEndIndex,
|
|
@@ -21,32 +21,33 @@ var MIN_RUN = 32;
|
|
|
21
21
|
* @param mid Middle index separating the two portions
|
|
22
22
|
* @param end Ending index of the second portion
|
|
23
23
|
* @param compareFunction Function to compare elements
|
|
24
|
+
* @param temporary Temporary array for merging
|
|
24
25
|
*/
|
|
25
|
-
var merge = function merge(array, start, mid, end, compareFunction) {
|
|
26
|
-
var
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
var
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
26
|
+
var merge = function merge(array, start, mid, end, compareFunction, temporary) {
|
|
27
|
+
var length1 = mid - start + 1;
|
|
28
|
+
if (compareFunction(array[mid], array[mid + 1]) <= 0) {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
for (var _index = 0; _index < length1; _index++) {
|
|
32
|
+
temporary[_index] = array[start + _index];
|
|
33
|
+
}
|
|
34
|
+
var index = 0;
|
|
35
|
+
var index_ = mid + 1;
|
|
36
|
+
var k = start;
|
|
37
|
+
while (index < length1 && index_ <= end) {
|
|
38
|
+
if (compareFunction(temporary[index], array[index_]) <= 0) {
|
|
39
|
+
array[k] = temporary[index];
|
|
40
|
+
index++;
|
|
35
41
|
} else {
|
|
36
|
-
array[
|
|
37
|
-
|
|
42
|
+
array[k] = array[index_];
|
|
43
|
+
index_++;
|
|
38
44
|
}
|
|
39
|
-
|
|
40
|
-
}
|
|
41
|
-
while (leftIndex < left.length) {
|
|
42
|
-
array[arrayIndex] = left[leftIndex];
|
|
43
|
-
leftIndex++;
|
|
44
|
-
arrayIndex++;
|
|
45
|
+
k++;
|
|
45
46
|
}
|
|
46
|
-
while (
|
|
47
|
-
array[
|
|
48
|
-
|
|
49
|
-
|
|
47
|
+
while (index < length1) {
|
|
48
|
+
array[k] = temporary[index];
|
|
49
|
+
k++;
|
|
50
|
+
index++;
|
|
50
51
|
}
|
|
51
52
|
};
|
|
52
53
|
|
|
@@ -92,12 +93,13 @@ var timSort = exports.timSort = function timSort(array) {
|
|
|
92
93
|
var runEnd = Math.min(runStart + minRun - 1, end);
|
|
93
94
|
(0, _insertionSortRange.insertionSortRange)(result, compareFunction, runStart, runEnd);
|
|
94
95
|
}
|
|
96
|
+
var temporary = [];
|
|
95
97
|
for (var size = minRun; size < n; size *= 2) {
|
|
96
98
|
for (var left = start; left <= end; left += 2 * size) {
|
|
97
99
|
var mid = left + size - 1;
|
|
98
100
|
var right = Math.min(left + 2 * size - 1, end);
|
|
99
101
|
if (mid < right) {
|
|
100
|
-
merge(result, left, mid, right, compareFunction);
|
|
102
|
+
merge(result, left, mid, right, compareFunction, temporary);
|
|
101
103
|
}
|
|
102
104
|
}
|
|
103
105
|
}
|