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,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Extract key-value pairs that appear in exactly one input object.
|
|
3
|
+
*
|
|
4
|
+
* A key-value pair is considered "shared" if the same key with the same value (===)
|
|
5
|
+
* exists in two or more objects. Only pairs unique to a single object are returned.
|
|
6
|
+
* When all values for a key are plain objects, the function recurses to find
|
|
7
|
+
* the diff subset. If the recursive result is empty, the key is excluded.
|
|
8
|
+
* When multiple unique pairs share the same key (different values),
|
|
9
|
+
* the last value wins.
|
|
10
|
+
*
|
|
11
|
+
* @template T - Type of the input objects.
|
|
12
|
+
* @param {T} object - The first object.
|
|
13
|
+
* @param {...Record<string, unknown>[]} objects - Additional objects to compare.
|
|
14
|
+
* @returns {Partial<T>} Object containing only key-value pairs unique to one input.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```typescript
|
|
18
|
+
* getObjectsDiff({ a: 1, b: 2 }, { b: 2, c: 3 });
|
|
19
|
+
* // { a: 1, c: 3 }
|
|
20
|
+
*
|
|
21
|
+
* getObjectsDiff({ a: { b: 1, c: 2 }, d: 3 }, { a: { b: 1, d: 4 }, d: 3 });
|
|
22
|
+
* // { a: { c: 2, d: 4 } }
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
export declare const getObjectsDiff: <T extends Record<string, unknown>>(object: T, ...objects: Record<string, unknown>[]) => Partial<T>;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { isPlainObject } from "../Object/isPlainObject";
|
|
2
|
+
/**
|
|
3
|
+
* Extract key-value pairs that appear in exactly one input object.
|
|
4
|
+
*
|
|
5
|
+
* A key-value pair is considered "shared" if the same key with the same value (===)
|
|
6
|
+
* exists in two or more objects. Only pairs unique to a single object are returned.
|
|
7
|
+
* When all values for a key are plain objects, the function recurses to find
|
|
8
|
+
* the diff subset. If the recursive result is empty, the key is excluded.
|
|
9
|
+
* When multiple unique pairs share the same key (different values),
|
|
10
|
+
* the last value wins.
|
|
11
|
+
*
|
|
12
|
+
* @template T - Type of the input objects.
|
|
13
|
+
* @param {T} object - The first object.
|
|
14
|
+
* @param {...Record<string, unknown>[]} objects - Additional objects to compare.
|
|
15
|
+
* @returns {Partial<T>} Object containing only key-value pairs unique to one input.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```typescript
|
|
19
|
+
* getObjectsDiff({ a: 1, b: 2 }, { b: 2, c: 3 });
|
|
20
|
+
* // { a: 1, c: 3 }
|
|
21
|
+
*
|
|
22
|
+
* getObjectsDiff({ a: { b: 1, c: 2 }, d: 3 }, { a: { b: 1, d: 4 }, d: 3 });
|
|
23
|
+
* // { a: { c: 2, d: 4 } }
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export const getObjectsDiff = (object, ...objects) => {
|
|
27
|
+
const allObjects = [object, ...objects];
|
|
28
|
+
if (allObjects.length === 1) {
|
|
29
|
+
return { ...object };
|
|
30
|
+
}
|
|
31
|
+
const allKeys = new Set();
|
|
32
|
+
for (const object_ of allObjects) {
|
|
33
|
+
for (const key of Object.keys(object_)) {
|
|
34
|
+
allKeys.add(key);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
const result = {};
|
|
38
|
+
for (const key of allKeys) {
|
|
39
|
+
const values = [];
|
|
40
|
+
const presentIn = [];
|
|
41
|
+
for (const [index, currentObject] of allObjects.entries()) {
|
|
42
|
+
if (Object.hasOwn(currentObject, key)) {
|
|
43
|
+
values.push(currentObject[key]);
|
|
44
|
+
presentIn.push(index);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
if (values.length === 1) {
|
|
48
|
+
result[key] = values[0];
|
|
49
|
+
continue;
|
|
50
|
+
}
|
|
51
|
+
const allPlain = values.every((value) => isPlainObject(value));
|
|
52
|
+
if (allPlain) {
|
|
53
|
+
const nested = getObjectsDiff(values[0], ...values.slice(1));
|
|
54
|
+
if (Object.keys(nested).length > 0) {
|
|
55
|
+
result[key] = nested;
|
|
56
|
+
}
|
|
57
|
+
continue;
|
|
58
|
+
}
|
|
59
|
+
let lastUniqueValue;
|
|
60
|
+
let hasUnique = false;
|
|
61
|
+
for (const value of values) {
|
|
62
|
+
let count = 0;
|
|
63
|
+
for (const other of values) {
|
|
64
|
+
if (value === other) {
|
|
65
|
+
count++;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
if (count === 1) {
|
|
69
|
+
lastUniqueValue = value;
|
|
70
|
+
hasUnique = true;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
if (hasUnique) {
|
|
74
|
+
result[key] = lastUniqueValue;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
return result;
|
|
78
|
+
};
|
|
79
|
+
//# sourceMappingURL=getObjectsDiff.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getObjectsDiff.js","sourceRoot":"","sources":["../../src/Object/getObjectsDiff.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAEvD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAC5B,MAAS,EACT,GAAG,OAAkC,EACzB,EAAE;IACd,MAAM,UAAU,GAAG,CAAC,MAAiC,EAAE,GAAG,OAAO,CAAC,CAAC;IAEnE,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC5B,OAAO,EAAE,GAAG,MAAM,EAAE,CAAC;IACvB,CAAC;IAED,MAAM,OAAO,GAAG,IAAI,GAAG,EAAU,CAAC;IAClC,KAAK,MAAM,OAAO,IAAI,UAAU,EAAE,CAAC;QACjC,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;YACvC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QACnB,CAAC;IACH,CAAC;IAED,MAAM,MAAM,GAAG,EAAgB,CAAC;IAEhC,KAAK,MAAM,GAAG,IAAI,OAAO,EAAE,CAAC;QAC1B,MAAM,MAAM,GAAc,EAAE,CAAC;QAC7B,MAAM,SAAS,GAAa,EAAE,CAAC;QAE/B,KAAK,MAAM,CAAC,KAAK,EAAE,aAAa,CAAC,IAAI,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC;YAC1D,IAAI,MAAM,CAAC,MAAM,CAAC,aAAa,EAAE,GAAG,CAAC,EAAE,CAAC;gBACtC,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC;gBAChC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YACxB,CAAC;QACH,CAAC;QAED,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACvB,MAAkC,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;YACrD,SAAS;QACX,CAAC;QAED,MAAM,QAAQ,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,CAAC;QAE/D,IAAI,QAAQ,EAAE,CAAC;YACb,MAAM,MAAM,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC,CAAM,EAAE,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;YAElE,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBAClC,MAAkC,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC;YACpD,CAAC;YACD,SAAS;QACX,CAAC;QAED,IAAI,eAAwB,CAAC;QAC7B,IAAI,SAAS,GAAG,KAAK,CAAC;QAEtB,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;YAC3B,IAAI,KAAK,GAAG,CAAC,CAAC;YACd,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;gBAC3B,IAAI,KAAK,KAAK,KAAK,EAAE,CAAC;oBACpB,KAAK,EAAE,CAAC;gBACV,CAAC;YACH,CAAC;YACD,IAAI,KAAK,KAAK,CAAC,EAAE,CAAC;gBAChB,eAAe,GAAG,KAAK,CAAC;gBACxB,SAAS,GAAG,IAAI,CAAC;YACnB,CAAC;QACH,CAAC;QAED,IAAI,SAAS,EAAE,CAAC;YACb,MAAkC,CAAC,GAAG,CAAC,GAAG,eAAe,CAAC;QAC7D,CAAC;IACH,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC"}
|
package/module/Object/index.d.ts
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
|
+
export * from "./deepClone";
|
|
2
|
+
export * from "./getObjectsCommon";
|
|
3
|
+
export * from "./getObjectsDiff";
|
|
1
4
|
export * from "./has";
|
|
2
5
|
export * from "./isEmpty";
|
|
6
|
+
export * from "./isPlainObject";
|
|
3
7
|
export * from "./keyBy";
|
|
8
|
+
export * from "./mapKeys";
|
|
9
|
+
export * from "./mapValues";
|
|
4
10
|
export * from "./merge";
|
|
5
11
|
export * from "./mergeDeep";
|
|
6
12
|
export * from "./omit";
|
package/module/Object/index.js
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
|
+
export * from "./deepClone";
|
|
2
|
+
export * from "./getObjectsCommon";
|
|
3
|
+
export * from "./getObjectsDiff";
|
|
1
4
|
export * from "./has";
|
|
2
5
|
export * from "./isEmpty";
|
|
6
|
+
export * from "./isPlainObject";
|
|
3
7
|
export * from "./keyBy";
|
|
8
|
+
export * from "./mapKeys";
|
|
9
|
+
export * from "./mapValues";
|
|
4
10
|
export * from "./merge";
|
|
5
11
|
export * from "./mergeDeep";
|
|
6
12
|
export * from "./omit";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/Object/index.ts"],"names":[],"mappings":"AAAA,cAAc,OAAO,CAAC;AACtB,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/Object/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,OAAO,CAAC;AACtB,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC;AAChC,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checks if a value is a plain object (created by Object constructor
|
|
3
|
+
* or with a null prototype).
|
|
4
|
+
*
|
|
5
|
+
* @param value - The value to check.
|
|
6
|
+
* @returns True if the value is a plain object, false otherwise.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* isPlainObject({}); // true
|
|
11
|
+
* isPlainObject({ a: 1 }); // true
|
|
12
|
+
* isPlainObject(new Map()); // false
|
|
13
|
+
* isPlainObject(null); // false
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
export declare const isPlainObject: (value: unknown) => value is Record<string, unknown>;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checks if a value is a plain object (created by Object constructor
|
|
3
|
+
* or with a null prototype).
|
|
4
|
+
*
|
|
5
|
+
* @param value - The value to check.
|
|
6
|
+
* @returns True if the value is a plain object, false otherwise.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* isPlainObject({}); // true
|
|
11
|
+
* isPlainObject({ a: 1 }); // true
|
|
12
|
+
* isPlainObject(new Map()); // false
|
|
13
|
+
* isPlainObject(null); // false
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
export const isPlainObject = (value) => {
|
|
17
|
+
if (value === null || typeof value !== "object") {
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
const prototype = Object.getPrototypeOf(value);
|
|
21
|
+
if (prototype === null) {
|
|
22
|
+
return true;
|
|
23
|
+
}
|
|
24
|
+
if (prototype === Object.prototype) {
|
|
25
|
+
return true;
|
|
26
|
+
}
|
|
27
|
+
// Handle objects created via Object.create(plainObject)
|
|
28
|
+
// Check constructor on the prototype to avoid own-property shadowing
|
|
29
|
+
const protoConstructor = prototype.constructor;
|
|
30
|
+
return typeof protoConstructor === "function" && protoConstructor === Object;
|
|
31
|
+
};
|
|
32
|
+
//# sourceMappingURL=isPlainObject.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isPlainObject.js","sourceRoot":"","sources":["../../src/Object/isPlainObject.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAC3B,KAAc,EACoB,EAAE;IACpC,IAAI,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAChD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,MAAM,SAAS,GAAG,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;IAC/C,IAAI,SAAS,KAAK,IAAI,EAAE,CAAC;QACvB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI,SAAS,KAAK,MAAM,CAAC,SAAS,EAAE,CAAC;QACnC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,wDAAwD;IACxD,qEAAqE;IACrE,MAAM,gBAAgB,GAAG,SAAS,CAAC,WAAW,CAAC;IAC/C,OAAO,OAAO,gBAAgB,KAAK,UAAU,IAAI,gBAAgB,KAAK,MAAM,CAAC;AAC/E,CAAC,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates an object with the same values as the given object, but
|
|
3
|
+
* with keys transformed by the provided function.
|
|
4
|
+
*
|
|
5
|
+
* @param object - The source object.
|
|
6
|
+
* @param function_ - The function invoked per key. Receives (value, key).
|
|
7
|
+
* @returns A new object with transformed keys.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```typescript
|
|
11
|
+
* mapKeys({ a: 1, b: 2 }, (_value, key) => key.toUpperCase());
|
|
12
|
+
* // { A: 1, B: 2 }
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
export declare const mapKeys: <T extends Record<string, unknown>>(object: T, function_: (value: T[keyof T], key: string) => string) => Record<string, T[keyof T]>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates an object with the same values as the given object, but
|
|
3
|
+
* with keys transformed by the provided function.
|
|
4
|
+
*
|
|
5
|
+
* @param object - The source object.
|
|
6
|
+
* @param function_ - The function invoked per key. Receives (value, key).
|
|
7
|
+
* @returns A new object with transformed keys.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```typescript
|
|
11
|
+
* mapKeys({ a: 1, b: 2 }, (_value, key) => key.toUpperCase());
|
|
12
|
+
* // { A: 1, B: 2 }
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
export const mapKeys = (object, function_) => {
|
|
16
|
+
const result = {};
|
|
17
|
+
const keys = Object.keys(object);
|
|
18
|
+
const length = keys.length;
|
|
19
|
+
let index = 0;
|
|
20
|
+
while (index < length) {
|
|
21
|
+
const key = keys[index];
|
|
22
|
+
const value = object[key];
|
|
23
|
+
result[function_(value, key)] = value;
|
|
24
|
+
index += 1;
|
|
25
|
+
}
|
|
26
|
+
return result;
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=mapKeys.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mapKeys.js","sourceRoot":"","sources":["../../src/Object/mapKeys.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,CACrB,MAAS,EACT,SAAqD,EACzB,EAAE;IAC9B,MAAM,MAAM,GAA+B,EAAE,CAAC;IAC9C,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACjC,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;IAC3B,IAAI,KAAK,GAAG,CAAC,CAAC;IAEd,OAAO,KAAK,GAAG,MAAM,EAAE,CAAC;QACtB,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC;QACxB,MAAM,KAAK,GAAG,MAAM,CAAC,GAAG,CAAe,CAAC;QACxC,MAAM,CAAC,SAAS,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC;QACtC,KAAK,IAAI,CAAC,CAAC;IACb,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates an object with the same keys as the given object, but
|
|
3
|
+
* with values transformed by the provided function.
|
|
4
|
+
*
|
|
5
|
+
* @param object - The source object.
|
|
6
|
+
* @param function_ - The function invoked per value. Receives (value, key).
|
|
7
|
+
* @returns A new object with transformed values.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```typescript
|
|
11
|
+
* mapValues({ a: 1, b: 2 }, (value) => value * 2);
|
|
12
|
+
* // { a: 2, b: 4 }
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
export declare const mapValues: <T extends Record<string, unknown>, R>(object: T, function_: (value: T[keyof T], key: string) => R) => Record<keyof T, R>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates an object with the same keys as the given object, but
|
|
3
|
+
* with values transformed by the provided function.
|
|
4
|
+
*
|
|
5
|
+
* @param object - The source object.
|
|
6
|
+
* @param function_ - The function invoked per value. Receives (value, key).
|
|
7
|
+
* @returns A new object with transformed values.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```typescript
|
|
11
|
+
* mapValues({ a: 1, b: 2 }, (value) => value * 2);
|
|
12
|
+
* // { a: 2, b: 4 }
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
export const mapValues = (object, function_) => {
|
|
16
|
+
const result = {};
|
|
17
|
+
const keys = Object.keys(object);
|
|
18
|
+
const length = keys.length;
|
|
19
|
+
let index = 0;
|
|
20
|
+
while (index < length) {
|
|
21
|
+
const key = keys[index];
|
|
22
|
+
result[key] = function_(object[key], key);
|
|
23
|
+
index += 1;
|
|
24
|
+
}
|
|
25
|
+
return result;
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=mapValues.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mapValues.js","sourceRoot":"","sources":["../../src/Object/mapValues.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,CACvB,MAAS,EACT,SAAgD,EAC5B,EAAE;IACtB,MAAM,MAAM,GAAG,EAAuB,CAAC;IACvC,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACjC,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;IAC3B,IAAI,KAAK,GAAG,CAAC,CAAC;IAEd,OAAO,KAAK,GAAG,MAAM,EAAE,CAAC;QACtB,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC;QACxB,MAAM,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC,MAAM,CAAC,GAAG,CAAe,EAAE,GAAG,CAAC,CAAC;QACxD,KAAK,IAAI,CAAC,CAAC;IACb,CAAC;IAED,OAAO,MAA4B,CAAC;AACtC,CAAC,CAAC"}
|
|
@@ -1,12 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
* Checks if a value is a plain object
|
|
3
|
-
*/
|
|
4
|
-
const isPlainObject = (value) => {
|
|
5
|
-
return (value !== null &&
|
|
6
|
-
typeof value === "object" &&
|
|
7
|
-
value.constructor === Object &&
|
|
8
|
-
Object.prototype.toString.call(value) === "[object Object]");
|
|
9
|
-
};
|
|
1
|
+
import { isPlainObject } from "../Object/isPlainObject";
|
|
10
2
|
/**
|
|
11
3
|
* Deeply merges multiple objects into a single object
|
|
12
4
|
* @param target - The target object to merge into
|
|
@@ -21,6 +13,9 @@ export const mergeDeep = (target, ...sources) => {
|
|
|
21
13
|
if (isPlainObject(target) && isPlainObject(source)) {
|
|
22
14
|
const result = { ...target };
|
|
23
15
|
for (const key in source) {
|
|
16
|
+
if (key === "__proto__" || key === "constructor" || key === "prototype") {
|
|
17
|
+
continue;
|
|
18
|
+
}
|
|
24
19
|
if (Object.hasOwn(source, key)) {
|
|
25
20
|
const sourceValue = source[key];
|
|
26
21
|
const targetValue = result[key];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mergeDeep.js","sourceRoot":"","sources":["../../src/Object/mergeDeep.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"mergeDeep.js","sourceRoot":"","sources":["../../src/Object/mergeDeep.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAEvD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,CAIvB,MAAS,EACT,GAAG,OAAU,EACuB,EAAE;IACtC,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACzB,OAAO,MAA4C,CAAC;IACtD,CAAC;IAED,MAAM,MAAM,GAAG,OAAO,CAAC,KAAK,EAAE,CAAC;IAE/B,IAAI,aAAa,CAAC,MAAM,CAAC,IAAI,aAAa,CAAC,MAAM,CAAC,EAAE,CAAC;QACnD,MAAM,MAAM,GAAG,EAAE,GAAG,MAAM,EAAE,CAAC;QAE7B,KAAK,MAAM,GAAG,IAAI,MAAM,EAAE,CAAC;YACzB,IAAI,GAAG,KAAK,WAAW,IAAI,GAAG,KAAK,aAAa,IAAI,GAAG,KAAK,WAAW,EAAE,CAAC;gBACxE,SAAS;YACX,CAAC;YAED,IAAI,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,CAAC;gBAC/B,MAAM,WAAW,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;gBAChC,MAAM,WAAW,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;gBAE/B,MAAkC,CAAC,GAAG,CAAC;oBACtC,aAAa,CAAC,WAAW,CAAC,IAAI,aAAa,CAAC,WAAW,CAAC;wBACtD,CAAC,CAAC,SAAS,CAAC,WAAW,EAAE,WAAW,CAAC;wBACrC,CAAC,CAAC,WAAW,CAAC;YACpB,CAAC;QACH,CAAC;QAED,OAAO,SAAS,CAAC,MAAM,EAAE,GAAG,OAAO,CAAuC,CAAC;IAC7E,CAAC;IAED,OAAO,SAAS,CAAC,MAAW,EAAE,GAAG,OAAO,CACR,CAAC;AACnC,CAAC,CAAC"}
|
package/module/Object/omit.d.ts
CHANGED
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
* @param keys - The keys to omit
|
|
5
5
|
* @returns A new object without the specified keys
|
|
6
6
|
*/
|
|
7
|
-
export declare const omit: <T extends object, K extends keyof T>(object: T, ...keys:
|
|
7
|
+
export declare const omit: <T extends object, K extends keyof T>(object: T, ...keys: (keyof T)[]) => Omit<T, K>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"omit.js","sourceRoot":"","sources":["../../src/Object/omit.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG,CAClB,MAAS,EACT,GAAG,
|
|
1
|
+
{"version":3,"file":"omit.js","sourceRoot":"","sources":["../../src/Object/omit.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG,CAClB,MAAS,EACT,GAAG,IAAiB,EACR,EAAE;IACd,MAAM,MAAM,GAAG,EAAE,GAAG,MAAM,EAAE,CAAC;IAE7B,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;QACvB,gEAAgE;QAChE,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC;IACrB,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC"}
|
|
@@ -20,10 +20,15 @@ export const pickDeep = (object, ...keys) => {
|
|
|
20
20
|
for (const key of keys) {
|
|
21
21
|
const parts = key.split(".");
|
|
22
22
|
// biome-ignore lint/suspicious/noExplicitAny: ignore
|
|
23
|
-
let current =
|
|
23
|
+
let current = object;
|
|
24
24
|
// biome-ignore lint/suspicious/noExplicitAny: ignore
|
|
25
25
|
let target = result;
|
|
26
26
|
for (const [index, part] of parts.entries()) {
|
|
27
|
+
if (part === "__proto__" ||
|
|
28
|
+
part === "constructor" ||
|
|
29
|
+
part === "prototype") {
|
|
30
|
+
continue;
|
|
31
|
+
}
|
|
27
32
|
if (current && typeof current === "object" && part in current) {
|
|
28
33
|
if (index === parts.length - 1) {
|
|
29
34
|
target[part] = current[part];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pickDeep.js","sourceRoot":"","sources":["../../src/Object/pickDeep.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,CAItB,MAAS,EACT,GAAG,IAAO,EACM,EAAE;IAClB,qDAAqD;IACrD,MAAM,MAAM,GAAQ,EAAE,CAAC;IAEvB,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;QACvB,MAAM,KAAK,GAAI,GAAc,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACzC,qDAAqD;QACrD,IAAI,OAAO,GAAQ,
|
|
1
|
+
{"version":3,"file":"pickDeep.js","sourceRoot":"","sources":["../../src/Object/pickDeep.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,CAItB,MAAS,EACT,GAAG,IAAO,EACM,EAAE;IAClB,qDAAqD;IACrD,MAAM,MAAM,GAAQ,EAAE,CAAC;IAEvB,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;QACvB,MAAM,KAAK,GAAI,GAAc,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACzC,qDAAqD;QACrD,IAAI,OAAO,GAAQ,MAAM,CAAC;QAC1B,qDAAqD;QACrD,IAAI,MAAM,GAAQ,MAAM,CAAC;QAEzB,KAAK,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,KAAK,CAAC,OAAO,EAAE,EAAE,CAAC;YAC5C,IACE,IAAI,KAAK,WAAW;gBACpB,IAAI,KAAK,aAAa;gBACtB,IAAI,KAAK,WAAW,EACpB,CAAC;gBACD,SAAS;YACX,CAAC;YAED,IAAI,OAAO,IAAI,OAAO,OAAO,KAAK,QAAQ,IAAI,IAAI,IAAI,OAAO,EAAE,CAAC;gBAC9D,IAAI,KAAK,KAAK,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;oBAC/B,MAAM,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;gBAC/B,CAAC;qBAAM,CAAC;oBACN,MAAM,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;oBAClC,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;oBACxB,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;gBACxB,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates a predicate that returns true only when all given
|
|
3
|
+
* predicates return true, using short-circuit evaluation
|
|
4
|
+
* @param {((...arguments_: T) => boolean)[]} predicates - The predicates to combine
|
|
5
|
+
* @returns {(...arguments_: T) => boolean} A combined predicate
|
|
6
|
+
* @example
|
|
7
|
+
* const isPositiveEven = every(
|
|
8
|
+
* (n: number) => n > 0,
|
|
9
|
+
* (n: number) => n % 2 === 0,
|
|
10
|
+
* );
|
|
11
|
+
* isPositiveEven(4); // true
|
|
12
|
+
* isPositiveEven(-2); // false
|
|
13
|
+
*/
|
|
14
|
+
export declare const every: <T extends unknown[]>(...predicates: ((...arguments_: T) => boolean)[]) => ((...arguments_: T) => boolean);
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates a predicate that returns true only when all given
|
|
3
|
+
* predicates return true, using short-circuit evaluation
|
|
4
|
+
* @param {((...arguments_: T) => boolean)[]} predicates - The predicates to combine
|
|
5
|
+
* @returns {(...arguments_: T) => boolean} A combined predicate
|
|
6
|
+
* @example
|
|
7
|
+
* const isPositiveEven = every(
|
|
8
|
+
* (n: number) => n > 0,
|
|
9
|
+
* (n: number) => n % 2 === 0,
|
|
10
|
+
* );
|
|
11
|
+
* isPositiveEven(4); // true
|
|
12
|
+
* isPositiveEven(-2); // false
|
|
13
|
+
*/
|
|
14
|
+
export const every = (...predicates) => (...arguments_) => {
|
|
15
|
+
for (const predicate of predicates) {
|
|
16
|
+
if (!predicate(...arguments_)) {
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return true;
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=every.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"every.js","sourceRoot":"","sources":["../../src/Predicate/every.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,KAAK,GAChB,CACE,GAAG,UAA6C,EACf,EAAE,CACrC,CAAC,GAAG,UAAa,EAAW,EAAE;IAC5B,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE,CAAC;QACnC,IAAI,CAAC,SAAS,CAAC,GAAG,UAAU,CAAC,EAAE,CAAC;YAC9B,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/Predicate/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,OAAO,CAAC;AACtB,cAAc,QAAQ,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checks whether a value is null or undefined
|
|
3
|
+
* @param {unknown} value - The value to check
|
|
4
|
+
* @returns {boolean} True if the value is null or undefined
|
|
5
|
+
* @example
|
|
6
|
+
* isNotNullish(null); // false
|
|
7
|
+
* isNotNullish(undefined); // false
|
|
8
|
+
* isNotNullish(0); // true
|
|
9
|
+
* isNotNullish(""); // true
|
|
10
|
+
*/
|
|
11
|
+
export declare const isNotNullish: <T>(value: T) => value is Exclude<T, null | undefined>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checks whether a value is null or undefined
|
|
3
|
+
* @param {unknown} value - The value to check
|
|
4
|
+
* @returns {boolean} True if the value is null or undefined
|
|
5
|
+
* @example
|
|
6
|
+
* isNotNullish(null); // false
|
|
7
|
+
* isNotNullish(undefined); // false
|
|
8
|
+
* isNotNullish(0); // true
|
|
9
|
+
* isNotNullish(""); // true
|
|
10
|
+
*/
|
|
11
|
+
export const isNotNullish = (value) => value !== null && value !== undefined;
|
|
12
|
+
//# sourceMappingURL=isNotNullish.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isNotNullish.js","sourceRoot":"","sources":["../../src/Predicate/isNotNullish.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAC1B,KAAQ,EAC+B,EAAE,CACzC,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checks whether a value is null or undefined
|
|
3
|
+
* @param {unknown} value - The value to check
|
|
4
|
+
* @returns {boolean} True if the value is null or undefined
|
|
5
|
+
* @example
|
|
6
|
+
* isNullish(null); // true
|
|
7
|
+
* isNullish(undefined); // true
|
|
8
|
+
* isNullish(0); // false
|
|
9
|
+
* isNullish(""); // false
|
|
10
|
+
*/
|
|
11
|
+
export declare const isNullish: (value: unknown) => value is null | undefined;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checks whether a value is null or undefined
|
|
3
|
+
* @param {unknown} value - The value to check
|
|
4
|
+
* @returns {boolean} True if the value is null or undefined
|
|
5
|
+
* @example
|
|
6
|
+
* isNullish(null); // true
|
|
7
|
+
* isNullish(undefined); // true
|
|
8
|
+
* isNullish(0); // false
|
|
9
|
+
* isNullish(""); // false
|
|
10
|
+
*/
|
|
11
|
+
export const isNullish = (value) => value === null || value === undefined;
|
|
12
|
+
//# sourceMappingURL=isNullish.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isNullish.js","sourceRoot":"","sources":["../../src/Predicate/isNullish.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,KAAc,EAA6B,EAAE,CACrE,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates a predicate that checks whether an object matches
|
|
3
|
+
* all properties of the given pattern using strict equality
|
|
4
|
+
* @param {Record<string, unknown>} pattern - The pattern to match against
|
|
5
|
+
* @returns {(obj: Record<string, unknown>) => boolean} A predicate that tests objects
|
|
6
|
+
* @example
|
|
7
|
+
* const isAdmin = matches({ role: "admin" });
|
|
8
|
+
* isAdmin({ name: "Alice", role: "admin" }); // true
|
|
9
|
+
* isAdmin({ name: "Bob", role: "user" }); // false
|
|
10
|
+
*/
|
|
11
|
+
export declare const matches: (pattern: Record<string, unknown>) => ((object: Record<string, unknown>) => boolean);
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates a predicate that checks whether an object matches
|
|
3
|
+
* all properties of the given pattern using strict equality
|
|
4
|
+
* @param {Record<string, unknown>} pattern - The pattern to match against
|
|
5
|
+
* @returns {(obj: Record<string, unknown>) => boolean} A predicate that tests objects
|
|
6
|
+
* @example
|
|
7
|
+
* const isAdmin = matches({ role: "admin" });
|
|
8
|
+
* isAdmin({ name: "Alice", role: "admin" }); // true
|
|
9
|
+
* isAdmin({ name: "Bob", role: "user" }); // false
|
|
10
|
+
*/
|
|
11
|
+
export const matches = (pattern) => (object) => {
|
|
12
|
+
const keys = Object.keys(pattern);
|
|
13
|
+
for (const key of keys) {
|
|
14
|
+
if (object[key] !== pattern[key]) {
|
|
15
|
+
return false;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
return true;
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=matches.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"matches.js","sourceRoot":"","sources":["../../src/Predicate/matches.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,OAAO,GAClB,CACE,OAAgC,EACgB,EAAE,CACpD,CAAC,MAA+B,EAAW,EAAE;IAC3C,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAClC,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;QACvB,IAAI,MAAM,CAAC,GAAG,CAAC,KAAK,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;YACjC,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates a predicate that negates the given predicate
|
|
3
|
+
* @param {(...arguments_: T) => boolean} function_ - The predicate to negate
|
|
4
|
+
* @returns {(...arguments_: T) => boolean} A new predicate that returns the opposite
|
|
5
|
+
* @example
|
|
6
|
+
* const isEven = (n: number) => n % 2 === 0;
|
|
7
|
+
* const isOdd = not(isEven);
|
|
8
|
+
* isOdd(3); // true
|
|
9
|
+
*/
|
|
10
|
+
export declare const not: <T extends unknown[]>(function_: (...arguments_: T) => boolean) => ((...arguments_: T) => boolean);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates a predicate that negates the given predicate
|
|
3
|
+
* @param {(...arguments_: T) => boolean} function_ - The predicate to negate
|
|
4
|
+
* @returns {(...arguments_: T) => boolean} A new predicate that returns the opposite
|
|
5
|
+
* @example
|
|
6
|
+
* const isEven = (n: number) => n % 2 === 0;
|
|
7
|
+
* const isOdd = not(isEven);
|
|
8
|
+
* isOdd(3); // true
|
|
9
|
+
*/
|
|
10
|
+
export const not = (function_) => (...arguments_) => !function_(...arguments_);
|
|
11
|
+
//# sourceMappingURL=not.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"not.js","sourceRoot":"","sources":["../../src/Predicate/not.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,GAAG,GACd,CACE,SAAwC,EACP,EAAE,CACrC,CAAC,GAAG,UAAa,EAAW,EAAE,CAC5B,CAAC,SAAS,CAAC,GAAG,UAAU,CAAC,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates a predicate that returns true when at least one of
|
|
3
|
+
* the given predicates returns true, using short-circuit evaluation
|
|
4
|
+
* @param {((...arguments_: T) => boolean)[]} predicates - The predicates to combine
|
|
5
|
+
* @returns {(...arguments_: T) => boolean} A combined predicate
|
|
6
|
+
* @example
|
|
7
|
+
* const isZeroOrNegative = some(
|
|
8
|
+
* (n: number) => n === 0,
|
|
9
|
+
* (n: number) => n < 0,
|
|
10
|
+
* );
|
|
11
|
+
* isZeroOrNegative(0); // true
|
|
12
|
+
* isZeroOrNegative(-1); // true
|
|
13
|
+
* isZeroOrNegative(1); // false
|
|
14
|
+
*/
|
|
15
|
+
export declare const some: <T extends unknown[]>(...predicates: ((...arguments_: T) => boolean)[]) => ((...arguments_: T) => boolean);
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates a predicate that returns true when at least one of
|
|
3
|
+
* the given predicates returns true, using short-circuit evaluation
|
|
4
|
+
* @param {((...arguments_: T) => boolean)[]} predicates - The predicates to combine
|
|
5
|
+
* @returns {(...arguments_: T) => boolean} A combined predicate
|
|
6
|
+
* @example
|
|
7
|
+
* const isZeroOrNegative = some(
|
|
8
|
+
* (n: number) => n === 0,
|
|
9
|
+
* (n: number) => n < 0,
|
|
10
|
+
* );
|
|
11
|
+
* isZeroOrNegative(0); // true
|
|
12
|
+
* isZeroOrNegative(-1); // true
|
|
13
|
+
* isZeroOrNegative(1); // false
|
|
14
|
+
*/
|
|
15
|
+
export const some = (...predicates) => (...arguments_) => {
|
|
16
|
+
for (const predicate of predicates) {
|
|
17
|
+
if (predicate(...arguments_)) {
|
|
18
|
+
return true;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return false;
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=some.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"some.js","sourceRoot":"","sources":["../../src/Predicate/some.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,IAAI,GACf,CACE,GAAG,UAA6C,EACf,EAAE,CACrC,CAAC,GAAG,UAAa,EAAW,EAAE;IAC5B,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE,CAAC;QACnC,IAAI,SAAS,CAAC,GAAG,UAAU,CAAC,EAAE,CAAC;YAC7B,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC,CAAC"}
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
*/
|
|
6
6
|
export const camelCase = (string_) => {
|
|
7
7
|
return string_
|
|
8
|
-
.replaceAll(/[
|
|
9
|
-
.replaceAll(/[
|
|
8
|
+
.replaceAll(/[^\dA-Za-z]+(.)/g, (_, char) => char.toUpperCase())
|
|
9
|
+
.replaceAll(/[^\dA-Za-z]+$/g, "")
|
|
10
10
|
.replace(/^[A-Z]/, (char) => char.toLowerCase());
|
|
11
11
|
};
|
|
12
12
|
//# sourceMappingURL=camelCase.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"camelCase.js","sourceRoot":"","sources":["../../src/String/camelCase.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,OAAe,EAAU,EAAE;IACnD,OAAO,OAAO;SACX,UAAU,CAAC,
|
|
1
|
+
{"version":3,"file":"camelCase.js","sourceRoot":"","sources":["../../src/String/camelCase.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,OAAe,EAAU,EAAE;IACnD,OAAO,OAAO;SACX,UAAU,CAAC,kBAAkB,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;SAC/D,UAAU,CAAC,gBAAgB,EAAE,EAAE,CAAC;SAChC,OAAO,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC;AACrD,CAAC,CAAC"}
|
|
@@ -14,6 +14,6 @@ const htmlEscapeMap = {
|
|
|
14
14
|
* @returns The escaped string
|
|
15
15
|
*/
|
|
16
16
|
export const escapeHtml = (string_) => {
|
|
17
|
-
return string_.replaceAll(/[
|
|
17
|
+
return string_.replaceAll(/["&'<>]/g, (match) => htmlEscapeMap[match]);
|
|
18
18
|
};
|
|
19
19
|
//# sourceMappingURL=escapeHtml.js.map
|