umt 2.3.0 → 2.5.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 +277 -16
- package/module/Array/chunk.js +5 -3
- package/module/Array/chunk.js.map +1 -1
- package/module/Array/dualPivotQuickSort.d.ts +1 -2
- package/module/Array/dualPivotQuickSort.js +5 -26
- package/module/Array/dualPivotQuickSort.js.map +1 -1
- package/module/Array/groupBy.js +8 -7
- package/module/Array/groupBy.js.map +1 -1
- package/module/Array/index.d.ts +1 -0
- package/module/Array/index.js +1 -0
- package/module/Array/index.js.map +1 -1
- package/module/Array/quickSort.js +7 -25
- package/module/Array/quickSort.js.map +1 -1
- package/module/Array/sortingHelpers/applyInsertionSortIfNeeded.d.ts +13 -0
- package/module/Array/sortingHelpers/applyInsertionSortIfNeeded.js +20 -0
- package/module/Array/sortingHelpers/applyInsertionSortIfNeeded.js.map +1 -0
- package/module/Array/sortingHelpers/rangeValidator.d.ts +17 -0
- package/module/Array/sortingHelpers/rangeValidator.js +26 -0
- package/module/Array/sortingHelpers/rangeValidator.js.map +1 -0
- package/module/Array/timSort.js +2 -20
- package/module/Array/timSort.js.map +1 -1
- package/module/Array/ultraNumberSort.d.ts +7 -0
- package/module/Array/ultraNumberSort.js +373 -0
- package/module/Array/ultraNumberSort.js.map +1 -0
- package/module/Tool/pipe.d.ts +1 -1
- package/module/Tool/pipe.js.map +1 -1
- package/module/Validate/object/core.d.ts +2 -6
- package/module/Validate/object/core.js.map +1 -1
- package/module/Validate/type.d.ts +1 -0
- package/module/es5/Array/chunk.js +5 -3
- package/module/es5/Array/dualPivotQuickSort.d.ts +1 -2
- package/module/es5/Array/dualPivotQuickSort.js +8 -28
- package/module/es5/Array/groupBy.js +8 -7
- package/module/es5/Array/index.d.ts +1 -0
- package/module/es5/Array/index.js +11 -0
- package/module/es5/Array/quickSort.js +10 -25
- package/module/es5/Array/sortingHelpers/applyInsertionSortIfNeeded.d.ts +13 -0
- package/module/es5/Array/sortingHelpers/applyInsertionSortIfNeeded.js +25 -0
- package/module/es5/Array/sortingHelpers/rangeValidator.d.ts +17 -0
- package/module/es5/Array/sortingHelpers/rangeValidator.js +35 -0
- package/module/es5/Array/timSort.js +2 -20
- package/module/es5/Array/ultraNumberSort.d.ts +7 -0
- package/module/es5/Array/ultraNumberSort.js +475 -0
- package/module/es5/Tool/pipe.d.ts +1 -1
- package/module/es5/Validate/object/core.d.ts +2 -6
- package/module/es5/Validate/type.d.ts +1 -0
- package/module/es5/tsconfig.tsbuildinfo +1 -1
- package/package.json +24 -20
- package/module/es5/tests/integration/Array/drop-and-first.test.d.ts +0 -1
- package/module/es5/tests/integration/Array/drop-and-first.test.js +0 -34
- package/module/es5/tests/integration/Tool/parseJson-and-Validate.test.d.ts +0 -1
- package/module/es5/tests/integration/Tool/parseJson-and-Validate.test.js +0 -80
- package/module/es5/tests/unit/Advance/rangeAdvance.test.d.ts +0 -1
- package/module/es5/tests/unit/Advance/rangeAdvance.test.js +0 -26
- package/module/es5/tests/unit/Array/arraysJoin.test.d.ts +0 -1
- package/module/es5/tests/unit/Array/arraysJoin.test.js +0 -19
- package/module/es5/tests/unit/Array/binarySearch.test.d.ts +0 -1
- package/module/es5/tests/unit/Array/binarySearch.test.js +0 -32
- package/module/es5/tests/unit/Array/checkFlagAlignment.test.d.ts +0 -1
- package/module/es5/tests/unit/Array/checkFlagAlignment.test.js +0 -206
- package/module/es5/tests/unit/Array/chunk.test.d.ts +0 -1
- package/module/es5/tests/unit/Array/chunk.test.js +0 -51
- package/module/es5/tests/unit/Array/compact.test.d.ts +0 -1
- package/module/es5/tests/unit/Array/compact.test.js +0 -53
- package/module/es5/tests/unit/Array/compareFunctionDefault.test.d.ts +0 -1
- package/module/es5/tests/unit/Array/compareFunctionDefault.test.js +0 -29
- package/module/es5/tests/unit/Array/drop.test.d.ts +0 -1
- package/module/es5/tests/unit/Array/drop.test.js +0 -84
- package/module/es5/tests/unit/Array/dualPivotQuickSort.test.d.ts +0 -1
- package/module/es5/tests/unit/Array/dualPivotQuickSort.test.js +0 -87
- package/module/es5/tests/unit/Array/first.test.d.ts +0 -1
- package/module/es5/tests/unit/Array/first.test.js +0 -28
- package/module/es5/tests/unit/Array/generateNumberArray.test.d.ts +0 -1
- package/module/es5/tests/unit/Array/generateNumberArray.test.js +0 -34
- package/module/es5/tests/unit/Array/getArraysCommon.test.d.ts +0 -1
- package/module/es5/tests/unit/Array/getArraysCommon.test.js +0 -40
- package/module/es5/tests/unit/Array/getArraysDiff.test.d.ts +0 -1
- package/module/es5/tests/unit/Array/getArraysDiff.test.js +0 -99
- package/module/es5/tests/unit/Array/groupBy.test.d.ts +0 -1
- package/module/es5/tests/unit/Array/groupBy.test.js +0 -87
- package/module/es5/tests/unit/Array/insertionSort.test.d.ts +0 -1
- package/module/es5/tests/unit/Array/insertionSort.test.js +0 -37
- package/module/es5/tests/unit/Array/mergeSort.test.d.ts +0 -1
- package/module/es5/tests/unit/Array/mergeSort.test.js +0 -49
- package/module/es5/tests/unit/Array/pop.test.d.ts +0 -1
- package/module/es5/tests/unit/Array/pop.test.js +0 -50
- package/module/es5/tests/unit/Array/quickSort.test.d.ts +0 -1
- package/module/es5/tests/unit/Array/quickSort.test.js +0 -118
- package/module/es5/tests/unit/Array/randomSelect.test.d.ts +0 -1
- package/module/es5/tests/unit/Array/randomSelect.test.js +0 -51
- package/module/es5/tests/unit/Array/range.test.d.ts +0 -1
- package/module/es5/tests/unit/Array/range.test.js +0 -42
- package/module/es5/tests/unit/Array/shuffle.test.d.ts +0 -1
- package/module/es5/tests/unit/Array/shuffle.test.js +0 -84
- package/module/es5/tests/unit/Array/shuffle2DArray.test.d.ts +0 -1
- package/module/es5/tests/unit/Array/shuffle2DArray.test.js +0 -90
- package/module/es5/tests/unit/Array/sum.test.d.ts +0 -1
- package/module/es5/tests/unit/Array/sum.test.js +0 -44
- package/module/es5/tests/unit/Array/timSort.test.d.ts +0 -1
- package/module/es5/tests/unit/Array/timSort.test.js +0 -128
- package/module/es5/tests/unit/Array/zip.test.d.ts +0 -1
- package/module/es5/tests/unit/Array/zip.test.js +0 -69
- package/module/es5/tests/unit/Array/zipLongest.test.d.ts +0 -1
- package/module/es5/tests/unit/Array/zipLongest.test.js +0 -74
- package/module/es5/tests/unit/Color/cmykToRgba.test.d.ts +0 -1
- package/module/es5/tests/unit/Color/cmykToRgba.test.js +0 -58
- package/module/es5/tests/unit/Color/hexaToRgba.test.d.ts +0 -1
- package/module/es5/tests/unit/Color/hexaToRgba.test.js +0 -115
- package/module/es5/tests/unit/Color/hslaToRgba.test.d.ts +0 -1
- package/module/es5/tests/unit/Color/hslaToRgba.test.js +0 -141
- package/module/es5/tests/unit/Color/rgbaToCmyk.test.d.ts +0 -1
- package/module/es5/tests/unit/Color/rgbaToCmyk.test.js +0 -139
- package/module/es5/tests/unit/Color/rgbaToHexA.test.d.ts +0 -1
- package/module/es5/tests/unit/Color/rgbaToHexA.test.js +0 -114
- package/module/es5/tests/unit/Color/rgbaToHsla.test.d.ts +0 -1
- package/module/es5/tests/unit/Color/rgbaToHsla.test.js +0 -190
- package/module/es5/tests/unit/Consts/clock.test.d.ts +0 -1
- package/module/es5/tests/unit/Consts/clock.test.js +0 -71
- package/module/es5/tests/unit/Consts/httpClientErrorStatus.test.d.ts +0 -1
- package/module/es5/tests/unit/Consts/httpClientErrorStatus.test.js +0 -33
- package/module/es5/tests/unit/Consts/httpInformationalStatus.test.d.ts +0 -1
- package/module/es5/tests/unit/Consts/httpInformationalStatus.test.js +0 -13
- package/module/es5/tests/unit/Consts/httpRedirectionStatus.test.d.ts +0 -1
- package/module/es5/tests/unit/Consts/httpRedirectionStatus.test.js +0 -16
- package/module/es5/tests/unit/Consts/httpServerErrorStatus.test.d.ts +0 -1
- package/module/es5/tests/unit/Consts/httpServerErrorStatus.test.js +0 -15
- package/module/es5/tests/unit/Consts/httpStatus.test.d.ts +0 -1
- package/module/es5/tests/unit/Consts/httpStatus.test.js +0 -82
- package/module/es5/tests/unit/Consts/httpSuccessStatus.test.d.ts +0 -1
- package/module/es5/tests/unit/Consts/httpSuccessStatus.test.js +0 -16
- package/module/es5/tests/unit/Date/birthday.test.d.ts +0 -1
- package/module/es5/tests/unit/Date/birthday.test.js +0 -31
- package/module/es5/tests/unit/Date/dateRange.test.d.ts +0 -1
- package/module/es5/tests/unit/Date/dateRange.test.js +0 -40
- package/module/es5/tests/unit/Date/dayOfWeek.test.d.ts +0 -1
- package/module/es5/tests/unit/Date/dayOfWeek.test.js +0 -39
- package/module/es5/tests/unit/Date/deleteSpace.test.d.ts +0 -1
- package/module/es5/tests/unit/Date/deleteSpace.test.js +0 -35
- package/module/es5/tests/unit/Date/format.test.d.ts +0 -1
- package/module/es5/tests/unit/Date/format.test.js +0 -50
- package/module/es5/tests/unit/Date/getDay.test.d.ts +0 -1
- package/module/es5/tests/unit/Date/getDay.test.js +0 -40
- package/module/es5/tests/unit/Date/getTimezoneOffsetString.test.d.ts +0 -1
- package/module/es5/tests/unit/Date/getTimezoneOffsetString.test.js +0 -26
- package/module/es5/tests/unit/Date/isLeapYear.test.d.ts +0 -1
- package/module/es5/tests/unit/Date/isLeapYear.test.js +0 -30
- package/module/es5/tests/unit/Date/new.test.d.ts +0 -1
- package/module/es5/tests/unit/Date/new.test.js +0 -39
- package/module/es5/tests/unit/Date/now.test.d.ts +0 -1
- package/module/es5/tests/unit/Date/now.test.js +0 -42
- package/module/es5/tests/unit/Error/safeExecute.test.d.ts +0 -1
- package/module/es5/tests/unit/Error/safeExecute.test.js +0 -75
- package/module/es5/tests/unit/Function/curry.test.d.ts +0 -1
- package/module/es5/tests/unit/Function/curry.test.js +0 -138
- package/module/es5/tests/unit/IP/cidrToLong.test.d.ts +0 -1
- package/module/es5/tests/unit/IP/cidrToLong.test.js +0 -32
- package/module/es5/tests/unit/IP/cidrToSubnetMask.test.d.ts +0 -1
- package/module/es5/tests/unit/IP/cidrToSubnetMask.test.js +0 -36
- package/module/es5/tests/unit/IP/getIpClass.test.d.ts +0 -1
- package/module/es5/tests/unit/IP/getIpClass.test.js +0 -36
- package/module/es5/tests/unit/IP/getNetworkAddress.test.d.ts +0 -1
- package/module/es5/tests/unit/IP/getNetworkAddress.test.js +0 -40
- package/module/es5/tests/unit/IP/ipToBinaryString.test.d.ts +0 -1
- package/module/es5/tests/unit/IP/ipToBinaryString.test.js +0 -46
- package/module/es5/tests/unit/IP/ipToLong.test.d.ts +0 -1
- package/module/es5/tests/unit/IP/ipToLong.test.js +0 -34
- package/module/es5/tests/unit/IP/isInRange.test.d.ts +0 -1
- package/module/es5/tests/unit/IP/isInRange.test.js +0 -82
- package/module/es5/tests/unit/IP/isPrivateIp.test.d.ts +0 -1
- package/module/es5/tests/unit/IP/isPrivateIp.test.js +0 -26
- package/module/es5/tests/unit/IP/longToIp.test.d.ts +0 -1
- package/module/es5/tests/unit/IP/longToIp.test.js +0 -39
- package/module/es5/tests/unit/IP/subnetMaskToCidr.test.d.ts +0 -1
- package/module/es5/tests/unit/IP/subnetMaskToCidr.test.js +0 -41
- package/module/es5/tests/unit/Math/addition.test.d.ts +0 -1
- package/module/es5/tests/unit/Math/addition.test.js +0 -79
- package/module/es5/tests/unit/Math/average.test.d.ts +0 -1
- package/module/es5/tests/unit/Math/average.test.js +0 -48
- package/module/es5/tests/unit/Math/bitwise.test.d.ts +0 -1
- package/module/es5/tests/unit/Math/bitwise.test.js +0 -62
- package/module/es5/tests/unit/Math/calculator/calculator.test.d.ts +0 -1
- package/module/es5/tests/unit/Math/calculator/calculator.test.js +0 -76
- package/module/es5/tests/unit/Math/calculator/calculatorInitialization.test.d.ts +0 -1
- package/module/es5/tests/unit/Math/calculator/calculatorInitialization.test.js +0 -21
- package/module/es5/tests/unit/Math/calculator/convertCurrency.test.d.ts +0 -1
- package/module/es5/tests/unit/Math/calculator/convertCurrency.test.js +0 -40
- package/module/es5/tests/unit/Math/calculator/literalExpression.test.d.ts +0 -1
- package/module/es5/tests/unit/Math/calculator/literalExpression.test.js +0 -51
- package/module/es5/tests/unit/Math/degToRad.test.d.ts +0 -1
- package/module/es5/tests/unit/Math/degToRad.test.js +0 -50
- package/module/es5/tests/unit/Math/deviationValue.test.d.ts +0 -1
- package/module/es5/tests/unit/Math/deviationValue.test.js +0 -30
- package/module/es5/tests/unit/Math/division.test.d.ts +0 -1
- package/module/es5/tests/unit/Math/division.test.js +0 -81
- package/module/es5/tests/unit/Math/factorial.test.d.ts +0 -1
- package/module/es5/tests/unit/Math/factorial.test.js +0 -26
- package/module/es5/tests/unit/Math/factorize.test.d.ts +0 -1
- package/module/es5/tests/unit/Math/factorize.test.js +0 -38
- package/module/es5/tests/unit/Math/flexibleNumberConversion.test.d.ts +0 -1
- package/module/es5/tests/unit/Math/flexibleNumberConversion.test.js +0 -195
- package/module/es5/tests/unit/Math/gcd.test.d.ts +0 -1
- package/module/es5/tests/unit/Math/gcd.test.js +0 -35
- package/module/es5/tests/unit/Math/getDecimalLength.test.d.ts +0 -1
- package/module/es5/tests/unit/Math/getDecimalLength.test.js +0 -44
- package/module/es5/tests/unit/Math/lcm.test.d.ts +0 -1
- package/module/es5/tests/unit/Math/lcm.test.js +0 -43
- package/module/es5/tests/unit/Math/linearCongruentialGenerator.test.d.ts +0 -1
- package/module/es5/tests/unit/Math/linearCongruentialGenerator.test.js +0 -25
- package/module/es5/tests/unit/Math/mathConverter.test.d.ts +0 -1
- package/module/es5/tests/unit/Math/mathConverter.test.js +0 -37
- package/module/es5/tests/unit/Math/mathSeparator.test.d.ts +0 -1
- package/module/es5/tests/unit/Math/mathSeparator.test.js +0 -59
- package/module/es5/tests/unit/Math/max.test.d.ts +0 -1
- package/module/es5/tests/unit/Math/max.test.js +0 -22
- package/module/es5/tests/unit/Math/median.test.d.ts +0 -1
- package/module/es5/tests/unit/Math/median.test.js +0 -17
- package/module/es5/tests/unit/Math/min.test.d.ts +0 -1
- package/module/es5/tests/unit/Math/min.test.js +0 -22
- package/module/es5/tests/unit/Math/multiples.test.d.ts +0 -1
- package/module/es5/tests/unit/Math/multiples.test.js +0 -30
- package/module/es5/tests/unit/Math/multiplication.test.d.ts +0 -1
- package/module/es5/tests/unit/Math/multiplication.test.js +0 -48
- package/module/es5/tests/unit/Math/nCr.test.d.ts +0 -1
- package/module/es5/tests/unit/Math/nCr.test.js +0 -34
- package/module/es5/tests/unit/Math/nHr.test.d.ts +0 -1
- package/module/es5/tests/unit/Math/nHr.test.js +0 -35
- package/module/es5/tests/unit/Math/nPr.test.d.ts +0 -1
- package/module/es5/tests/unit/Math/nPr.test.js +0 -38
- package/module/es5/tests/unit/Math/primeFactorization.test.d.ts +0 -1
- package/module/es5/tests/unit/Math/primeFactorization.test.js +0 -84
- package/module/es5/tests/unit/Math/quotient.test.d.ts +0 -1
- package/module/es5/tests/unit/Math/quotient.test.js +0 -36
- package/module/es5/tests/unit/Math/radToDeg.test.d.ts +0 -1
- package/module/es5/tests/unit/Math/radToDeg.test.js +0 -50
- package/module/es5/tests/unit/Math/random.test.d.ts +0 -1
- package/module/es5/tests/unit/Math/random.test.js +0 -61
- package/module/es5/tests/unit/Math/reduce.test.d.ts +0 -1
- package/module/es5/tests/unit/Math/reduce.test.js +0 -93
- package/module/es5/tests/unit/Math/repeatedTrial.test.d.ts +0 -1
- package/module/es5/tests/unit/Math/repeatedTrial.test.js +0 -39
- package/module/es5/tests/unit/Math/roundOf.test.d.ts +0 -1
- package/module/es5/tests/unit/Math/roundOf.test.js +0 -40
- package/module/es5/tests/unit/Math/solveEquation.test.d.ts +0 -1
- package/module/es5/tests/unit/Math/solveEquation.test.js +0 -24
- package/module/es5/tests/unit/Math/standardDeviation.test.d.ts +0 -1
- package/module/es5/tests/unit/Math/standardDeviation.test.js +0 -23
- package/module/es5/tests/unit/Math/subtract.test.d.ts +0 -1
- package/module/es5/tests/unit/Math/subtract.test.js +0 -46
- package/module/es5/tests/unit/Math/toBaseN.test.d.ts +0 -1
- package/module/es5/tests/unit/Math/toBaseN.test.js +0 -40
- package/module/es5/tests/unit/Math/toCelsius.test.d.ts +0 -1
- package/module/es5/tests/unit/Math/toCelsius.test.js +0 -18
- package/module/es5/tests/unit/Math/toKelvin.test.d.ts +0 -1
- package/module/es5/tests/unit/Math/toKelvin.test.js +0 -18
- package/module/es5/tests/unit/Math/uuidv7.test.d.ts +0 -1
- package/module/es5/tests/unit/Math/uuidv7.test.js +0 -33
- package/module/es5/tests/unit/Math/valueSwap.test.d.ts +0 -1
- package/module/es5/tests/unit/Math/valueSwap.test.js +0 -28
- package/module/es5/tests/unit/Math/xoshiro256.test.d.ts +0 -1
- package/module/es5/tests/unit/Math/xoshiro256.test.js +0 -33
- package/module/es5/tests/unit/Object/has.test.d.ts +0 -1
- package/module/es5/tests/unit/Object/has.test.js +0 -60
- package/module/es5/tests/unit/Object/keyBy.test.d.ts +0 -1
- package/module/es5/tests/unit/Object/keyBy.test.js +0 -120
- package/module/es5/tests/unit/Object/pick.test.d.ts +0 -1
- package/module/es5/tests/unit/Object/pick.test.js +0 -109
- package/module/es5/tests/unit/Object/pickDeep.test.d.ts +0 -1
- package/module/es5/tests/unit/Object/pickDeep.test.js +0 -222
- package/module/es5/tests/unit/Simple/Array/quickSortSimple.test.d.ts +0 -1
- package/module/es5/tests/unit/Simple/Array/quickSortSimple.test.js +0 -18
- package/module/es5/tests/unit/Simple/Date/dayOfWeekSimple.test.d.ts +0 -1
- package/module/es5/tests/unit/Simple/Date/dayOfWeekSimple.test.js +0 -58
- package/module/es5/tests/unit/Simple/Math/deviationValueSimple.test.d.ts +0 -1
- package/module/es5/tests/unit/Simple/Math/deviationValueSimple.test.js +0 -43
- package/module/es5/tests/unit/String/deleteSpaces.test.d.ts +0 -1
- package/module/es5/tests/unit/String/deleteSpaces.test.js +0 -22
- package/module/es5/tests/unit/String/formatString.test.d.ts +0 -1
- package/module/es5/tests/unit/String/formatString.test.js +0 -47
- package/module/es5/tests/unit/String/fromBase64.test.d.ts +0 -1
- package/module/es5/tests/unit/String/fromBase64.test.js +0 -37
- package/module/es5/tests/unit/String/hasNoLetters.test.d.ts +0 -1
- package/module/es5/tests/unit/String/hasNoLetters.test.js +0 -29
- package/module/es5/tests/unit/String/padEnd.test.d.ts +0 -1
- package/module/es5/tests/unit/String/padEnd.test.js +0 -22
- package/module/es5/tests/unit/String/padStart.test.d.ts +0 -1
- package/module/es5/tests/unit/String/padStart.test.js +0 -40
- package/module/es5/tests/unit/String/randomString.test.d.ts +0 -1
- package/module/es5/tests/unit/String/randomString.test.js +0 -21
- package/module/es5/tests/unit/String/randomStringInitialization.test.d.ts +0 -1
- package/module/es5/tests/unit/String/randomStringInitialization.test.js +0 -25
- package/module/es5/tests/unit/String/reverseString.test.d.ts +0 -1
- package/module/es5/tests/unit/String/reverseString.test.js +0 -35
- package/module/es5/tests/unit/String/toBase64.test.d.ts +0 -1
- package/module/es5/tests/unit/String/toBase64.test.js +0 -20
- package/module/es5/tests/unit/String/toHalfWidth.test.d.ts +0 -1
- package/module/es5/tests/unit/String/toHalfWidth.test.js +0 -16
- package/module/es5/tests/unit/String/trimCharacters.test.d.ts +0 -1
- package/module/es5/tests/unit/String/trimCharacters.test.js +0 -17
- package/module/es5/tests/unit/String/trimEndCharacters.test.d.ts +0 -1
- package/module/es5/tests/unit/String/trimEndCharacters.test.js +0 -33
- package/module/es5/tests/unit/String/trimStartCharacters.test.d.ts +0 -1
- package/module/es5/tests/unit/String/trimStartCharacters.test.js +0 -33
- package/module/es5/tests/unit/Time/convertTime.test.d.ts +0 -1
- package/module/es5/tests/unit/Time/convertTime.test.js +0 -135
- package/module/es5/tests/unit/Time/normalizeTimeUnit.test.d.ts +0 -1
- package/module/es5/tests/unit/Time/normalizeTimeUnit.test.js +0 -29
- package/module/es5/tests/unit/Tool/createPipeline.test.d.ts +0 -1
- package/module/es5/tests/unit/Tool/createPipeline.test.js +0 -184
- package/module/es5/tests/unit/Tool/parseJson.test.d.ts +0 -1
- package/module/es5/tests/unit/Tool/parseJson.test.js +0 -46
- package/module/es5/tests/unit/Tool/pipe.test.d.ts +0 -1
- package/module/es5/tests/unit/Tool/pipe.test.js +0 -445
- package/module/es5/tests/unit/UA/extractBrowserFromUserAgent.test.d.ts +0 -1
- package/module/es5/tests/unit/UA/extractBrowserFromUserAgent.test.js +0 -47
- package/module/es5/tests/unit/UA/extractDeviceFromUserAgent.test.d.ts +0 -1
- package/module/es5/tests/unit/UA/extractDeviceFromUserAgent.test.js +0 -55
- package/module/es5/tests/unit/UA/extractOsFromUserAgent.test.d.ts +0 -1
- package/module/es5/tests/unit/UA/extractOsFromUserAgent.test.js +0 -57
- package/module/es5/tests/unit/UA/parseUserAgent.test.d.ts +0 -1
- package/module/es5/tests/unit/UA/parseUserAgent.test.js +0 -95
- package/module/es5/tests/unit/Unit/unitConverterInitialization.test.d.ts +0 -1
- package/module/es5/tests/unit/Unit/unitConverterInitialization.test.js +0 -40
- package/module/es5/tests/unit/Validate/array/core.test.d.ts +0 -1
- package/module/es5/tests/unit/Validate/array/core.test.js +0 -86
- package/module/es5/tests/unit/Validate/boolean/core.test.d.ts +0 -1
- package/module/es5/tests/unit/Validate/boolean/core.test.js +0 -29
- package/module/es5/tests/unit/Validate/core/core.test.d.ts +0 -1
- package/module/es5/tests/unit/Validate/core/core.test.js +0 -87
- package/module/es5/tests/unit/Validate/isArray.test.d.ts +0 -1
- package/module/es5/tests/unit/Validate/isArray.test.js +0 -36
- package/module/es5/tests/unit/Validate/isDictionaryObject.test.d.ts +0 -1
- package/module/es5/tests/unit/Validate/isDictionaryObject.test.js +0 -62
- package/module/es5/tests/unit/Validate/isDouble.test.d.ts +0 -1
- package/module/es5/tests/unit/Validate/isDouble.test.js +0 -47
- package/module/es5/tests/unit/Validate/isEqual.test.d.ts +0 -1
- package/module/es5/tests/unit/Validate/isEqual.test.js +0 -74
- package/module/es5/tests/unit/Validate/isNotEmpty.test.d.ts +0 -1
- package/module/es5/tests/unit/Validate/isNotEmpty.test.js +0 -43
- package/module/es5/tests/unit/Validate/isNumber.test.d.ts +0 -1
- package/module/es5/tests/unit/Validate/isNumber.test.js +0 -77
- package/module/es5/tests/unit/Validate/isPerfectSquare.test.d.ts +0 -1
- package/module/es5/tests/unit/Validate/isPerfectSquare.test.js +0 -27
- package/module/es5/tests/unit/Validate/isPrimeNumber.test.d.ts +0 -1
- package/module/es5/tests/unit/Validate/isPrimeNumber.test.js +0 -51
- package/module/es5/tests/unit/Validate/isValueNaN.test.d.ts +0 -1
- package/module/es5/tests/unit/Validate/isValueNaN.test.js +0 -54
- package/module/es5/tests/unit/Validate/number/core.test.d.ts +0 -1
- package/module/es5/tests/unit/Validate/number/core.test.js +0 -36
- package/module/es5/tests/unit/Validate/number/double.test.d.ts +0 -1
- package/module/es5/tests/unit/Validate/number/double.test.js +0 -23
- package/module/es5/tests/unit/Validate/number/even.test.d.ts +0 -1
- package/module/es5/tests/unit/Validate/number/even.test.js +0 -23
- package/module/es5/tests/unit/Validate/number/maxValue.test.d.ts +0 -1
- package/module/es5/tests/unit/Validate/number/maxValue.test.js +0 -20
- package/module/es5/tests/unit/Validate/number/minValue.test.d.ts +0 -1
- package/module/es5/tests/unit/Validate/number/minValue.test.js +0 -20
- package/module/es5/tests/unit/Validate/number/odd.test.d.ts +0 -1
- package/module/es5/tests/unit/Validate/number/odd.test.js +0 -23
- package/module/es5/tests/unit/Validate/number/prime.test.d.ts +0 -1
- package/module/es5/tests/unit/Validate/number/prime.test.js +0 -25
- package/module/es5/tests/unit/Validate/object/core.test.d.ts +0 -1
- package/module/es5/tests/unit/Validate/object/core.test.js +0 -79
- package/module/es5/tests/unit/Validate/string/core.test.d.ts +0 -1
- package/module/es5/tests/unit/Validate/string/core.test.js +0 -27
- package/module/es5/tests/unit/Validate/string/email.test.d.ts +0 -1
- package/module/es5/tests/unit/Validate/string/email.test.js +0 -21
- package/module/es5/tests/unit/Validate/string/length.test.d.ts +0 -1
- package/module/es5/tests/unit/Validate/string/length.test.js +0 -18
- package/module/es5/tests/unit/Validate/string/maxLength.test.d.ts +0 -1
- package/module/es5/tests/unit/Validate/string/maxLength.test.js +0 -18
- package/module/es5/tests/unit/Validate/string/minLength.test.d.ts +0 -1
- package/module/es5/tests/unit/Validate/string/minLength.test.js +0 -18
- package/module/es5/tests/unit/Validate/string/numberString.test.d.ts +0 -1
- package/module/es5/tests/unit/Validate/string/numberString.test.js +0 -22
- package/module/es5/tests/unit/Validate/string/regexMatch.test.d.ts +0 -1
- package/module/es5/tests/unit/Validate/string/regexMatch.test.js +0 -29
- package/module/es5/tests/unit/Validate/string/uuid.test.d.ts +0 -1
- package/module/es5/tests/unit/Validate/string/uuid.test.js +0 -72
- package/module/es5/tests/unit/types/arrayType.test.d.ts +0 -1
- package/module/es5/tests/unit/types/arrayType.test.js +0 -11
- package/module/es5/tests/unit/types/clockType.test.d.ts +0 -1
- package/module/es5/tests/unit/types/clockType.test.js +0 -37
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _parseUserAgent = require("@/UA/parseUserAgent");
|
|
4
|
-
describe("parseUserAgent", function () {
|
|
5
|
-
it("should detect iOS mobile with Safari", function () {
|
|
6
|
-
var ua = "Mozilla/5.0 (iPhone; CPU iPhone OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0.3 Mobile/15E148 Safari/604.1";
|
|
7
|
-
var result = (0, _parseUserAgent.parseUserAgent)(ua);
|
|
8
|
-
expect(result).toEqual({
|
|
9
|
-
os: "ios",
|
|
10
|
-
browser: "safari",
|
|
11
|
-
device: "mobile"
|
|
12
|
-
});
|
|
13
|
-
});
|
|
14
|
-
it("should detect Android mobile with Chrome", function () {
|
|
15
|
-
var ua = "Mozilla/5.0 (Linux; Android 10; SM-A505FN) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.105 Mobile Safari/537.36";
|
|
16
|
-
var result = (0, _parseUserAgent.parseUserAgent)(ua);
|
|
17
|
-
expect(result).toEqual({
|
|
18
|
-
os: "android",
|
|
19
|
-
browser: "chrome",
|
|
20
|
-
device: "mobile"
|
|
21
|
-
});
|
|
22
|
-
});
|
|
23
|
-
it("should detect macOS desktop with Firefox", function () {
|
|
24
|
-
var ua = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:88.0) Gecko/20100101 Firefox/88.0";
|
|
25
|
-
var result = (0, _parseUserAgent.parseUserAgent)(ua);
|
|
26
|
-
expect(result).toEqual({
|
|
27
|
-
os: "macos",
|
|
28
|
-
browser: "firefox",
|
|
29
|
-
device: "desktop"
|
|
30
|
-
});
|
|
31
|
-
});
|
|
32
|
-
it("should detect Windows desktop with Edge", function () {
|
|
33
|
-
var ua = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36 Edg/89.0.774.57";
|
|
34
|
-
var result = (0, _parseUserAgent.parseUserAgent)(ua);
|
|
35
|
-
expect(result).toEqual({
|
|
36
|
-
os: "windows",
|
|
37
|
-
browser: "edge",
|
|
38
|
-
device: "desktop"
|
|
39
|
-
});
|
|
40
|
-
});
|
|
41
|
-
it("should detect Linux desktop with Chrome", function () {
|
|
42
|
-
var ua = "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36";
|
|
43
|
-
var result = (0, _parseUserAgent.parseUserAgent)(ua);
|
|
44
|
-
expect(result).toEqual({
|
|
45
|
-
os: "linux",
|
|
46
|
-
browser: "chrome",
|
|
47
|
-
device: "desktop"
|
|
48
|
-
});
|
|
49
|
-
});
|
|
50
|
-
it("should detect iPad as tablet", function () {
|
|
51
|
-
var ua = "Mozilla/5.0 (iPad; CPU OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 Mobile/15E148 Safari/604.1";
|
|
52
|
-
var result = (0, _parseUserAgent.parseUserAgent)(ua);
|
|
53
|
-
expect(result).toEqual({
|
|
54
|
-
os: "ios",
|
|
55
|
-
browser: "safari",
|
|
56
|
-
device: "tablet"
|
|
57
|
-
});
|
|
58
|
-
});
|
|
59
|
-
it("should detect Android tablet", function () {
|
|
60
|
-
var ua = "Mozilla/5.0 (Linux; Android 11; SM-T870) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.105 Safari/537.36";
|
|
61
|
-
var result = (0, _parseUserAgent.parseUserAgent)(ua);
|
|
62
|
-
expect(result).toEqual({
|
|
63
|
-
os: "android",
|
|
64
|
-
browser: "chrome",
|
|
65
|
-
device: "tablet"
|
|
66
|
-
});
|
|
67
|
-
});
|
|
68
|
-
it("should detect Internet Explorer on Windows", function () {
|
|
69
|
-
var ua = "Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko";
|
|
70
|
-
var result = (0, _parseUserAgent.parseUserAgent)(ua);
|
|
71
|
-
expect(result).toEqual({
|
|
72
|
-
os: "windows",
|
|
73
|
-
browser: "ie",
|
|
74
|
-
device: "desktop"
|
|
75
|
-
});
|
|
76
|
-
});
|
|
77
|
-
it("should detect Googlebot", function () {
|
|
78
|
-
var ua = "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)";
|
|
79
|
-
var result = (0, _parseUserAgent.parseUserAgent)(ua);
|
|
80
|
-
expect(result).toEqual({
|
|
81
|
-
os: "other",
|
|
82
|
-
browser: "other",
|
|
83
|
-
device: "bot"
|
|
84
|
-
});
|
|
85
|
-
});
|
|
86
|
-
it("should handle unknown user agent", function () {
|
|
87
|
-
var ua = "Unknown User Agent String";
|
|
88
|
-
var result = (0, _parseUserAgent.parseUserAgent)(ua);
|
|
89
|
-
expect(result).toEqual({
|
|
90
|
-
os: "other",
|
|
91
|
-
browser: "other",
|
|
92
|
-
device: "other"
|
|
93
|
-
});
|
|
94
|
-
});
|
|
95
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _unitConverterInitialization = require("@/Unit/unitConverterInitialization");
|
|
4
|
-
// Example unit converter for length measurements
|
|
5
|
-
var convertLength = (0, _unitConverterInitialization.unitConverterInitialization)({
|
|
6
|
-
meters: 1,
|
|
7
|
-
// base unit
|
|
8
|
-
kilometers: 0.001,
|
|
9
|
-
centimeters: 100,
|
|
10
|
-
millimeters: 1000
|
|
11
|
-
});
|
|
12
|
-
describe("Unit Converter", function () {
|
|
13
|
-
it("converts between base unit and larger units", function () {
|
|
14
|
-
expect(convertLength(1000, "meters", "kilometers")).toBeCloseTo(1);
|
|
15
|
-
expect(convertLength(1, "kilometers", "meters")).toBeCloseTo(1000);
|
|
16
|
-
});
|
|
17
|
-
it("converts between base unit and smaller units", function () {
|
|
18
|
-
expect(convertLength(1, "meters", "centimeters")).toBeCloseTo(100);
|
|
19
|
-
expect(convertLength(100, "centimeters", "meters")).toBeCloseTo(1);
|
|
20
|
-
});
|
|
21
|
-
it("converts between different small units", function () {
|
|
22
|
-
expect(convertLength(100, "centimeters", "millimeters")).toBeCloseTo(1000);
|
|
23
|
-
expect(convertLength(1000, "millimeters", "centimeters")).toBeCloseTo(100);
|
|
24
|
-
});
|
|
25
|
-
it("handles zero values correctly", function () {
|
|
26
|
-
expect(convertLength(0, "meters", "kilometers")).toBe(0);
|
|
27
|
-
expect(convertLength(0, "millimeters", "centimeters")).toBe(0);
|
|
28
|
-
});
|
|
29
|
-
it("returns same value when converting to same unit", function () {
|
|
30
|
-
expect(convertLength(5, "meters", "meters")).toBe(5);
|
|
31
|
-
expect(convertLength(100, "centimeters", "centimeters")).toBe(100);
|
|
32
|
-
});
|
|
33
|
-
it("maintains precision in round-trip conversions", function () {
|
|
34
|
-
var original = 5;
|
|
35
|
-
var roundTrip = convertLength(convertLength(original, "meters", "kilometers"), "kilometers", "meters");
|
|
36
|
-
expect(roundTrip).toBeCloseTo(original);
|
|
37
|
-
var smallUnitsRoundTrip = convertLength(convertLength(original, "centimeters", "millimeters"), "millimeters", "centimeters");
|
|
38
|
-
expect(smallUnitsRoundTrip).toBeCloseTo(original);
|
|
39
|
-
});
|
|
40
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _Validate = require("@/Validate");
|
|
4
|
-
var _core = require("@/Validate/array/core");
|
|
5
|
-
var _string = require("@/Validate/string");
|
|
6
|
-
describe("Array core validation", function () {
|
|
7
|
-
// Test for empty array
|
|
8
|
-
it("should validate an empty array", function () {
|
|
9
|
-
var validateArray = (0, _core.array)();
|
|
10
|
-
expect(validateArray([]).validate).toBe(true);
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
// Test for null and undefined
|
|
14
|
-
it("should fail validation for null and undefined", function () {
|
|
15
|
-
var validateArray = (0, _core.array)();
|
|
16
|
-
// @ts-ignore
|
|
17
|
-
expect(validateArray(null).validate).toBe(false);
|
|
18
|
-
// @ts-ignore
|
|
19
|
-
expect(validateArray(undefined).validate).toBe(false);
|
|
20
|
-
});
|
|
21
|
-
it("should validate an array of mixed values without type validation", function () {
|
|
22
|
-
var validateArray = (0, _core.array)();
|
|
23
|
-
expect(validateArray(["apple", true, 123]).validate).toBe(true);
|
|
24
|
-
});
|
|
25
|
-
it("should validate an array of strings with validation", function () {
|
|
26
|
-
var validateArray = (0, _core.array)({
|
|
27
|
-
string: (0, _string.string)()
|
|
28
|
-
});
|
|
29
|
-
expect(validateArray(["apple", "banana", "cherry"]).validate).toBe(true);
|
|
30
|
-
// @ts-ignore
|
|
31
|
-
expect(validateArray(["apple", 1, true]).validate).toBe(false);
|
|
32
|
-
});
|
|
33
|
-
it("should validate an array of numbers with range validation", function () {
|
|
34
|
-
var validateArray = (0, _core.array)({
|
|
35
|
-
number: (0, _Validate.number)([(0, _Validate.minValue)(0), (0, _Validate.maxValue)(10)])
|
|
36
|
-
});
|
|
37
|
-
expect(validateArray([1, 2, 3]).validate).toBe(true);
|
|
38
|
-
expect(validateArray([1, 2, 3, 11]).validate).toBe(false);
|
|
39
|
-
// @ts-ignore
|
|
40
|
-
expect(validateArray([1, "2", 3]).validate).toBe(false);
|
|
41
|
-
});
|
|
42
|
-
it("should validate an array of mixed types with specific validations", function () {
|
|
43
|
-
var validateArray = (0, _core.array)({
|
|
44
|
-
string: (0, _string.string)([(0, _string.maxLength)(1)]),
|
|
45
|
-
number: (0, _Validate.number)([(0, _Validate.minValue)(0), (0, _Validate.maxValue)(10)])
|
|
46
|
-
});
|
|
47
|
-
expect(validateArray([1, 2, 3]).validate).toBe(true);
|
|
48
|
-
expect(validateArray([1, 2, 3, 11]).validate).toBe(false);
|
|
49
|
-
expect(validateArray([1, "2", 3]).validate).toBe(true);
|
|
50
|
-
expect(validateArray([1, 2, 3, "11"]).validate).toBe(false);
|
|
51
|
-
});
|
|
52
|
-
it("should return a custom message on array type validation failure", function () {
|
|
53
|
-
var customMessage = "Array validation failed";
|
|
54
|
-
var validateArray = (0, _core.array)({
|
|
55
|
-
string: (0, _string.string)()
|
|
56
|
-
}, customMessage);
|
|
57
|
-
// @ts-ignore
|
|
58
|
-
var result = validateArray("not an array");
|
|
59
|
-
expect(result.validate).toBe(false);
|
|
60
|
-
expect(result.message).toBe(customMessage);
|
|
61
|
-
});
|
|
62
|
-
it("should return element validation error message", function () {
|
|
63
|
-
var elementMessage = "String too long";
|
|
64
|
-
var validateArray = (0, _core.array)({
|
|
65
|
-
string: (0, _string.string)([(0, _string.maxLength)(3, elementMessage)])
|
|
66
|
-
});
|
|
67
|
-
var result = validateArray(["ok", "good", "toolong"]);
|
|
68
|
-
expect(result.validate).toBe(false);
|
|
69
|
-
expect(result.message).toBe(elementMessage);
|
|
70
|
-
});
|
|
71
|
-
it("should return an empty message when no custom message is provided", function () {
|
|
72
|
-
var validateArray = (0, _core.array)({
|
|
73
|
-
string: (0, _string.string)()
|
|
74
|
-
});
|
|
75
|
-
// @ts-ignore
|
|
76
|
-
var result = validateArray("not an array");
|
|
77
|
-
expect(result.validate).toBe(false);
|
|
78
|
-
expect(result.message).toBe("");
|
|
79
|
-
});
|
|
80
|
-
it("should preserve the original array in the return type", function () {
|
|
81
|
-
var testArray = [1, 2, 3];
|
|
82
|
-
var validateArray = (0, _core.array)();
|
|
83
|
-
var result = validateArray(testArray);
|
|
84
|
-
expect(result.type).toBe(testArray);
|
|
85
|
-
});
|
|
86
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _core = require("@/Validate/boolean/core");
|
|
4
|
-
describe("boolean core validation", function () {
|
|
5
|
-
it("should return true for boolean values", function () {
|
|
6
|
-
var validateBoolean = (0, _core["boolean"])();
|
|
7
|
-
expect(validateBoolean(true).validate).toBe(true);
|
|
8
|
-
expect(validateBoolean(false).validate).toBe(true);
|
|
9
|
-
});
|
|
10
|
-
it("should return false for non-boolean values", function () {
|
|
11
|
-
var validateBoolean = (0, _core["boolean"])();
|
|
12
|
-
// @ts-ignore
|
|
13
|
-
expect(validateBoolean(0).validate).toBe(false);
|
|
14
|
-
// @ts-ignore
|
|
15
|
-
expect(validateBoolean(null).validate).toBe(false);
|
|
16
|
-
// @ts-ignore
|
|
17
|
-
expect(validateBoolean(undefined).validate).toBe(false);
|
|
18
|
-
// @ts-ignore
|
|
19
|
-
expect(validateBoolean("true").validate).toBe(false);
|
|
20
|
-
});
|
|
21
|
-
it("should return the custom message for invalid input", function () {
|
|
22
|
-
var customMessage = "This is not a boolean";
|
|
23
|
-
var validateBoolean = (0, _core["boolean"])(customMessage);
|
|
24
|
-
// @ts-ignore
|
|
25
|
-
expect(validateBoolean(0).validate).toBe(false);
|
|
26
|
-
// @ts-ignore
|
|
27
|
-
expect(validateBoolean(0).message).toBe(customMessage);
|
|
28
|
-
});
|
|
29
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _core = require("@/Validate/core");
|
|
4
|
-
describe("Core validation", function () {
|
|
5
|
-
it("should validate type correctly", function () {
|
|
6
|
-
var validateString = (0, _core.core)("string");
|
|
7
|
-
expect(validateString("test").validate).toBe(true);
|
|
8
|
-
// @ts-ignore
|
|
9
|
-
expect(validateString(123).validate).toBe(false);
|
|
10
|
-
});
|
|
11
|
-
it("should respect custom message for type validation", function () {
|
|
12
|
-
var message = "Not a string";
|
|
13
|
-
var validateString = (0, _core.core)("string");
|
|
14
|
-
// @ts-ignore
|
|
15
|
-
expect(validateString(123, [], message).message).toBe(message);
|
|
16
|
-
});
|
|
17
|
-
it("should return empty message when no message provided", function () {
|
|
18
|
-
var validateString = (0, _core.core)("string");
|
|
19
|
-
// @ts-ignore
|
|
20
|
-
expect(validateString(123).message).toBe("");
|
|
21
|
-
});
|
|
22
|
-
it("should validate with additional validation rules", function () {
|
|
23
|
-
var validateString = (0, _core.core)("string");
|
|
24
|
-
var minLength = {
|
|
25
|
-
type: "string",
|
|
26
|
-
validate: function validate(value) {
|
|
27
|
-
return value.length >= 3;
|
|
28
|
-
},
|
|
29
|
-
message: "String too short"
|
|
30
|
-
};
|
|
31
|
-
expect(validateString("test", [minLength]).validate).toBe(true);
|
|
32
|
-
expect(validateString("ab", [minLength]).validate).toBe(false);
|
|
33
|
-
expect(validateString("ab", [minLength]).message).toBe("String too short");
|
|
34
|
-
|
|
35
|
-
// Test validation rule without message
|
|
36
|
-
var noMessage = {
|
|
37
|
-
type: "string",
|
|
38
|
-
validate: function validate(value) {
|
|
39
|
-
return value.length >= 3;
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
|
-
expect(validateString("ab", [noMessage]).message).toBe("");
|
|
43
|
-
});
|
|
44
|
-
it("should validate numbers", function () {
|
|
45
|
-
var validateNumber = (0, _core.core)("number");
|
|
46
|
-
expect(validateNumber(123).validate).toBe(true);
|
|
47
|
-
// @ts-ignore
|
|
48
|
-
expect(validateNumber("123").validate).toBe(false);
|
|
49
|
-
});
|
|
50
|
-
it("should validate booleans", function () {
|
|
51
|
-
var validateBoolean = (0, _core.core)("boolean");
|
|
52
|
-
expect(validateBoolean(true).validate).toBe(true);
|
|
53
|
-
expect(validateBoolean(false).validate).toBe(true);
|
|
54
|
-
// @ts-ignore
|
|
55
|
-
expect(validateBoolean("true").validate).toBe(false);
|
|
56
|
-
});
|
|
57
|
-
it("should validate with multiple validation rules", function () {
|
|
58
|
-
var validateString = (0, _core.core)("string");
|
|
59
|
-
var minLength = {
|
|
60
|
-
type: "string",
|
|
61
|
-
validate: function validate(value) {
|
|
62
|
-
return value.length >= 3;
|
|
63
|
-
},
|
|
64
|
-
message: "String too short"
|
|
65
|
-
};
|
|
66
|
-
var maxLength = {
|
|
67
|
-
type: "string",
|
|
68
|
-
validate: function validate(value) {
|
|
69
|
-
return value.length <= 10;
|
|
70
|
-
},
|
|
71
|
-
message: "String too long"
|
|
72
|
-
};
|
|
73
|
-
expect(validateString("test", [minLength, maxLength]).validate).toBe(true);
|
|
74
|
-
expect(validateString("ab", [minLength, maxLength]).validate).toBe(false);
|
|
75
|
-
expect(validateString("ab", [minLength, maxLength]).message).toBe("String too short");
|
|
76
|
-
expect(validateString("very long string", [minLength, maxLength]).validate).toBe(false);
|
|
77
|
-
expect(validateString("very long string", [minLength, maxLength]).message).toBe("String too long");
|
|
78
|
-
});
|
|
79
|
-
it("should preserve type information in return value", function () {
|
|
80
|
-
var validateString = (0, _core.core)("string");
|
|
81
|
-
var validateNumber = (0, _core.core)("number");
|
|
82
|
-
var validateBoolean = (0, _core.core)("boolean");
|
|
83
|
-
expect(validateString("test").type).toBe("string");
|
|
84
|
-
expect(validateNumber(123).type).toBe("number");
|
|
85
|
-
expect(validateBoolean(true).type).toBe("boolean");
|
|
86
|
-
});
|
|
87
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _isArray = require("@/Validate/isArray");
|
|
4
|
-
describe("isArray", function () {
|
|
5
|
-
it("should return true for an array", function () {
|
|
6
|
-
expect((0, _isArray.isArray)([1, 2, 3])).toBe(true);
|
|
7
|
-
expect((0, _isArray.isArray)(["a", "b", "c"])).toBe(true);
|
|
8
|
-
expect((0, _isArray.isArray)([true, false])).toBe(true);
|
|
9
|
-
expect((0, _isArray.isArray)([{
|
|
10
|
-
a: 1
|
|
11
|
-
}, {
|
|
12
|
-
b: 2
|
|
13
|
-
}])).toBe(true);
|
|
14
|
-
expect((0, _isArray.isArray)([])).toBe(true);
|
|
15
|
-
});
|
|
16
|
-
it("should work as a type guard", function () {
|
|
17
|
-
var value = [1, 2, 3];
|
|
18
|
-
if ((0, _isArray.isArray)(value)) {
|
|
19
|
-
// TypeScript should recognize value as number[] here
|
|
20
|
-
var sum = value.reduce(function (a, b) {
|
|
21
|
-
return a + b;
|
|
22
|
-
}, 0);
|
|
23
|
-
expect(sum).toBe(6);
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
it("should return false for a non-array value", function () {
|
|
27
|
-
expect((0, _isArray.isArray)(1)).toBe(false);
|
|
28
|
-
expect((0, _isArray.isArray)("hello")).toBe(false);
|
|
29
|
-
expect((0, _isArray.isArray)(true)).toBe(false);
|
|
30
|
-
expect((0, _isArray.isArray)({
|
|
31
|
-
a: 1
|
|
32
|
-
})).toBe(false);
|
|
33
|
-
expect((0, _isArray.isArray)(null)).toBe(false);
|
|
34
|
-
expect((0, _isArray.isArray)(undefined)).toBe(false);
|
|
35
|
-
});
|
|
36
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _isDictionaryObject = require("@/Validate/isDictionaryObject");
|
|
4
|
-
describe("isDictionaryObject", function () {
|
|
5
|
-
it("should return true for an empty object", function () {
|
|
6
|
-
expect((0, _isDictionaryObject.isDictionaryObject)({})).toBe(true);
|
|
7
|
-
});
|
|
8
|
-
it("should return true for an object with string properties", function () {
|
|
9
|
-
expect((0, _isDictionaryObject.isDictionaryObject)({
|
|
10
|
-
foo: "bar",
|
|
11
|
-
baz: "qux"
|
|
12
|
-
})).toBe(true);
|
|
13
|
-
});
|
|
14
|
-
it("should work as a type guard", function () {
|
|
15
|
-
var value = {
|
|
16
|
-
x: 1,
|
|
17
|
-
y: 2
|
|
18
|
-
};
|
|
19
|
-
if ((0, _isDictionaryObject.isDictionaryObject)(value)) {
|
|
20
|
-
// TypeScript should recognize value as { x: number; y: number }
|
|
21
|
-
var sum = value.x + value.y;
|
|
22
|
-
expect(sum).toBe(3);
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
|
-
it("should return true for an object with number properties", function () {
|
|
26
|
-
expect((0, _isDictionaryObject.isDictionaryObject)({
|
|
27
|
-
foo: 1,
|
|
28
|
-
bar: 2
|
|
29
|
-
})).toBe(true);
|
|
30
|
-
});
|
|
31
|
-
it("should return true for an object with boolean properties", function () {
|
|
32
|
-
expect((0, _isDictionaryObject.isDictionaryObject)({
|
|
33
|
-
foo: true,
|
|
34
|
-
bar: false
|
|
35
|
-
})).toBe(true);
|
|
36
|
-
});
|
|
37
|
-
it("should return true for an object with mixed properties", function () {
|
|
38
|
-
expect((0, _isDictionaryObject.isDictionaryObject)({
|
|
39
|
-
foo: "bar",
|
|
40
|
-
baz: 1,
|
|
41
|
-
qux: true
|
|
42
|
-
})).toBe(true);
|
|
43
|
-
});
|
|
44
|
-
it("should return false for an array", function () {
|
|
45
|
-
expect((0, _isDictionaryObject.isDictionaryObject)([1, 2, 3])).toBe(false);
|
|
46
|
-
});
|
|
47
|
-
it("should return false for a string", function () {
|
|
48
|
-
expect((0, _isDictionaryObject.isDictionaryObject)("foo")).toBe(false);
|
|
49
|
-
});
|
|
50
|
-
it("should return false for a number", function () {
|
|
51
|
-
expect((0, _isDictionaryObject.isDictionaryObject)(42)).toBe(false);
|
|
52
|
-
});
|
|
53
|
-
it("should return false for a boolean", function () {
|
|
54
|
-
expect((0, _isDictionaryObject.isDictionaryObject)(true)).toBe(false);
|
|
55
|
-
});
|
|
56
|
-
it("should return false for null", function () {
|
|
57
|
-
expect((0, _isDictionaryObject.isDictionaryObject)(null)).toBe(false);
|
|
58
|
-
});
|
|
59
|
-
it("should return false for undefined", function () {
|
|
60
|
-
expect((0, _isDictionaryObject.isDictionaryObject)(undefined)).toBe(false);
|
|
61
|
-
});
|
|
62
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _isDouble = require("@/Validate/isDouble");
|
|
4
|
-
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
5
|
-
describe("isDouble", function () {
|
|
6
|
-
it("should return true for valid doubles", function () {
|
|
7
|
-
expect((0, _isDouble.isDouble)(1.5)).toBe(true);
|
|
8
|
-
expect((0, _isDouble.isDouble)(-1.5)).toBe(true);
|
|
9
|
-
expect((0, _isDouble.isDouble)(1.23e-4)).toBe(true);
|
|
10
|
-
expect((0, _isDouble.isDouble)("1.5")).toBe(true);
|
|
11
|
-
expect((0, _isDouble.isDouble)("1.5", false)).toBe(false);
|
|
12
|
-
});
|
|
13
|
-
it("should work as a type guard", function () {
|
|
14
|
-
var value = 1.5;
|
|
15
|
-
if ((0, _isDouble.isDouble)(value)) {
|
|
16
|
-
// TypeScript should recognize value as number | string
|
|
17
|
-
expect(typeof value === "number" || typeof value === "string").toBe(true);
|
|
18
|
-
expect(Number(value)).toBe(1.5);
|
|
19
|
-
}
|
|
20
|
-
var strictValue = 1.5;
|
|
21
|
-
if ((0, _isDouble.isDouble)(strictValue, false)) {
|
|
22
|
-
// TypeScript should recognize strictValue as number
|
|
23
|
-
expect(_typeof(strictValue)).toBe("number");
|
|
24
|
-
expect(strictValue).toBe(1.5);
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
it("should return false for invalid doubles", function () {
|
|
28
|
-
expect((0, _isDouble.isDouble)(1)).toBe(false);
|
|
29
|
-
expect((0, _isDouble.isDouble)(1, false)).toBe(false);
|
|
30
|
-
expect((0, _isDouble.isDouble)("1")).toBe(false);
|
|
31
|
-
expect((0, _isDouble.isDouble)("1", false)).toBe(false);
|
|
32
|
-
expect((0, _isDouble.isDouble)(Number.NaN)).toBe(false);
|
|
33
|
-
expect((0, _isDouble.isDouble)(Number.POSITIVE_INFINITY)).toBe(false);
|
|
34
|
-
expect((0, _isDouble.isDouble)(Number.NEGATIVE_INFINITY)).toBe(false);
|
|
35
|
-
expect((0, _isDouble.isDouble)(null)).toBe(false);
|
|
36
|
-
expect((0, _isDouble.isDouble)(undefined)).toBe(false);
|
|
37
|
-
expect((0, _isDouble.isDouble)(true)).toBe(false);
|
|
38
|
-
expect((0, _isDouble.isDouble)(false)).toBe(false);
|
|
39
|
-
expect((0, _isDouble.isDouble)({})).toBe(false);
|
|
40
|
-
expect((0, _isDouble.isDouble)([])).toBe(false);
|
|
41
|
-
expect((0, _isDouble.isDouble)(0x12)).toBe(false);
|
|
42
|
-
expect((0, _isDouble.isDouble)(Number.NEGATIVE_INFINITY, false)).toBe(false);
|
|
43
|
-
expect((0, _isDouble.isDouble)(null, false)).toBe(false);
|
|
44
|
-
expect((0, _isDouble.isDouble)(true, false)).toBe(false);
|
|
45
|
-
expect((0, _isDouble.isDouble)(false, false)).toBe(false);
|
|
46
|
-
});
|
|
47
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _isEqual = require("@/Validate/isEqual");
|
|
4
|
-
var _lodash = _interopRequireDefault(require("lodash"));
|
|
5
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
6
|
-
describe("isEqual", function () {
|
|
7
|
-
it("should compare primitive values correctly", function () {
|
|
8
|
-
expect((0, _isEqual.isEqual)(1, 1)).toBe(true);
|
|
9
|
-
expect((0, _isEqual.isEqual)("test", "test")).toBe(true);
|
|
10
|
-
expect((0, _isEqual.isEqual)(true, true)).toBe(true);
|
|
11
|
-
expect((0, _isEqual.isEqual)(null, null)).toBe(true);
|
|
12
|
-
expect((0, _isEqual.isEqual)(undefined, undefined)).toBe(true);
|
|
13
|
-
expect((0, _isEqual.isEqual)(Number.NaN, Number.NaN)).toBe(true);
|
|
14
|
-
});
|
|
15
|
-
it("should return false for different primitive values", function () {
|
|
16
|
-
expect((0, _isEqual.isEqual)(1, 2)).toBe(false);
|
|
17
|
-
expect((0, _isEqual.isEqual)("test", "other")).toBe(false);
|
|
18
|
-
expect((0, _isEqual.isEqual)(true, false)).toBe(false);
|
|
19
|
-
expect((0, _isEqual.isEqual)(null, undefined)).toBe(false);
|
|
20
|
-
});
|
|
21
|
-
it("should handle object references correctly", function () {
|
|
22
|
-
var obj = {
|
|
23
|
-
a: 1
|
|
24
|
-
};
|
|
25
|
-
expect((0, _isEqual.isEqual)(obj, obj)).toBe(true);
|
|
26
|
-
expect((0, _isEqual.isEqual)(obj, {
|
|
27
|
-
a: 1
|
|
28
|
-
})).toBe(false);
|
|
29
|
-
});
|
|
30
|
-
it("should handle array references correctly", function () {
|
|
31
|
-
var arr = [1, 2, 3];
|
|
32
|
-
expect((0, _isEqual.isEqual)(arr, arr)).toBe(true);
|
|
33
|
-
expect((0, _isEqual.isEqual)(arr, [1, 2, 3])).toBe(false);
|
|
34
|
-
});
|
|
35
|
-
it("should distinguish between -0 and +0", function () {
|
|
36
|
-
expect((0, _isEqual.isEqual)(-0, +0)).toBe(false);
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
// lodash tests
|
|
40
|
-
it("should compare primitive values correctly (using lodash)", function () {
|
|
41
|
-
expect(_lodash["default"].isEqual(1, 1)).toBe(true);
|
|
42
|
-
expect(_lodash["default"].isEqual("test", "test")).toBe(true);
|
|
43
|
-
expect(_lodash["default"].isEqual(true, true)).toBe(true);
|
|
44
|
-
expect(_lodash["default"].isEqual(null, null)).toBe(true);
|
|
45
|
-
expect(_lodash["default"].isEqual(undefined, undefined)).toBe(true);
|
|
46
|
-
expect(_lodash["default"].isEqual(Number.NaN, Number.NaN)).toBe(true);
|
|
47
|
-
});
|
|
48
|
-
it("should return false for different primitive values (using lodash)", function () {
|
|
49
|
-
expect(_lodash["default"].isEqual(1, 2)).toBe(false);
|
|
50
|
-
expect(_lodash["default"].isEqual("test", "other")).toBe(false);
|
|
51
|
-
expect(_lodash["default"].isEqual(true, false)).toBe(false);
|
|
52
|
-
expect(_lodash["default"].isEqual(null, undefined)).toBe(false);
|
|
53
|
-
});
|
|
54
|
-
it("should handle object references correctly (using lodash)", function () {
|
|
55
|
-
var obj = {
|
|
56
|
-
a: 1
|
|
57
|
-
};
|
|
58
|
-
expect(_lodash["default"].isEqual(obj, obj)).toBe(true);
|
|
59
|
-
// This test returns true because the implementation of lodash and isEqual is different.
|
|
60
|
-
expect(_lodash["default"].isEqual(obj, {
|
|
61
|
-
a: 1
|
|
62
|
-
})).toBe(true);
|
|
63
|
-
});
|
|
64
|
-
it("should handle array references correctly (using lodash)", function () {
|
|
65
|
-
var arr = [1, 2, 3];
|
|
66
|
-
expect(_lodash["default"].isEqual(arr, arr)).toBe(true);
|
|
67
|
-
// This test returns true because the implementation of lodash and isEqual is different.
|
|
68
|
-
expect(_lodash["default"].isEqual(arr, [1, 2, 3])).toBe(true);
|
|
69
|
-
});
|
|
70
|
-
it("should distinguish between -0 and +0 (using lodash)", function () {
|
|
71
|
-
// This test returns true because the implementation of lodash and isEqual is different.
|
|
72
|
-
expect(_lodash["default"].isEqual(-0, +0)).toBe(true);
|
|
73
|
-
});
|
|
74
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _isNotEmpty = require("@/Validate/isNotEmpty");
|
|
4
|
-
describe("isNotEmpty", function () {
|
|
5
|
-
it("should return true for a non-empty object", function () {
|
|
6
|
-
expect((0, _isNotEmpty.isNotEmpty)({
|
|
7
|
-
a: 1
|
|
8
|
-
})).toBe(true);
|
|
9
|
-
expect((0, _isNotEmpty.isNotEmpty)({
|
|
10
|
-
a: 1,
|
|
11
|
-
b: 2
|
|
12
|
-
})).toBe(true);
|
|
13
|
-
expect((0, _isNotEmpty.isNotEmpty)({
|
|
14
|
-
a: {
|
|
15
|
-
b: 2
|
|
16
|
-
}
|
|
17
|
-
})).toBe(true);
|
|
18
|
-
});
|
|
19
|
-
it("should return false for an empty object", function () {
|
|
20
|
-
expect((0, _isNotEmpty.isNotEmpty)({})).toBe(false);
|
|
21
|
-
});
|
|
22
|
-
it("should return true for a non-empty array", function () {
|
|
23
|
-
expect((0, _isNotEmpty.isNotEmpty)([1, 2, 3])).toBe(true);
|
|
24
|
-
expect((0, _isNotEmpty.isNotEmpty)(["a", "b", "c"])).toBe(true);
|
|
25
|
-
expect((0, _isNotEmpty.isNotEmpty)([true, false])).toBe(true);
|
|
26
|
-
expect((0, _isNotEmpty.isNotEmpty)([{
|
|
27
|
-
a: 1
|
|
28
|
-
}, {
|
|
29
|
-
b: 2
|
|
30
|
-
}])).toBe(true);
|
|
31
|
-
});
|
|
32
|
-
it("should return false for an empty array", function () {
|
|
33
|
-
expect((0, _isNotEmpty.isNotEmpty)([])).toBe(false);
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
// Note: Map and Set are always considered empty by Object.keys()
|
|
37
|
-
it("should return false for Map and Set (regardless of content)", function () {
|
|
38
|
-
expect((0, _isNotEmpty.isNotEmpty)(new Map([["a", 1], ["b", 2]]))).toBe(false);
|
|
39
|
-
expect((0, _isNotEmpty.isNotEmpty)(new Set([1, 2, 3]))).toBe(false);
|
|
40
|
-
expect((0, _isNotEmpty.isNotEmpty)(new Map())).toBe(false);
|
|
41
|
-
expect((0, _isNotEmpty.isNotEmpty)(new Set())).toBe(false);
|
|
42
|
-
});
|
|
43
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|