umt 2.2.1 → 2.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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/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/Function/curry.d.ts +141 -0
- package/module/Function/curry.js +11 -0
- package/module/Function/curry.js.map +1 -0
- package/module/Function/index.d.ts +1 -0
- package/module/Function/index.js +2 -0
- package/module/Function/index.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/Tool/pipe.d.ts +66 -0
- package/module/Tool/pipe.js +98 -0
- package/module/Tool/pipe.js.map +1 -0
- package/module/Validate/index.d.ts +1 -0
- package/module/Validate/index.js +1 -0
- package/module/Validate/index.js.map +1 -1
- package/module/Validate/isString.d.ts +9 -0
- package/module/Validate/isString.js +12 -0
- package/module/Validate/isString.js.map +1 -0
- 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/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/Function/curry.d.ts +141 -0
- package/module/es5/Function/curry.js +38 -0
- package/module/es5/Function/index.d.ts +1 -0
- package/module/es5/Function/index.js +16 -0
- package/module/es5/Tool/index.d.ts +1 -0
- package/module/es5/Tool/index.js +11 -0
- package/module/es5/Tool/pipe.d.ts +66 -0
- package/module/es5/Tool/pipe.js +129 -0
- package/module/es5/Validate/index.d.ts +1 -0
- package/module/es5/Validate/index.js +11 -0
- package/module/es5/Validate/isString.d.ts +9 -0
- package/module/es5/Validate/isString.js +16 -0
- package/module/es5/Validate/object/core.d.ts +2 -6
- package/module/es5/Validate/type.d.ts +1 -0
- package/module/es5/index.d.ts +1 -0
- package/module/es5/index.js +11 -0
- package/module/es5/tsconfig.tsbuildinfo +1 -1
- package/module/index.d.ts +1 -0
- package/module/index.js +1 -0
- package/module/index.js.map +1 -1
- package/package.json +26 -22
- 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/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/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,29 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _compareFunctionDefault = require("@/Array/compareFunctionDefault");
|
|
4
|
-
describe("compareFunctionDefault", function () {
|
|
5
|
-
test("should return 1 when first value is greater", function () {
|
|
6
|
-
expect((0, _compareFunctionDefault.compareFunctionDefault)(2, 1)).toBe(1);
|
|
7
|
-
expect((0, _compareFunctionDefault.compareFunctionDefault)("b", "a")).toBe(1);
|
|
8
|
-
});
|
|
9
|
-
test("should return -1 when first value is lesser", function () {
|
|
10
|
-
expect((0, _compareFunctionDefault.compareFunctionDefault)(1, 2)).toBe(-1);
|
|
11
|
-
expect((0, _compareFunctionDefault.compareFunctionDefault)("a", "b")).toBe(-1);
|
|
12
|
-
});
|
|
13
|
-
test("should return 0 when values are equal", function () {
|
|
14
|
-
expect((0, _compareFunctionDefault.compareFunctionDefault)(1, 1)).toBe(0);
|
|
15
|
-
expect((0, _compareFunctionDefault.compareFunctionDefault)("a", "a")).toBe(0);
|
|
16
|
-
});
|
|
17
|
-
test("should work with different types", function () {
|
|
18
|
-
expect((0, _compareFunctionDefault.compareFunctionDefault)(true, false)).toBe(1);
|
|
19
|
-
expect((0, _compareFunctionDefault.compareFunctionDefault)(false, true)).toBe(-1);
|
|
20
|
-
expect((0, _compareFunctionDefault.compareFunctionDefault)(true, true)).toBe(0);
|
|
21
|
-
});
|
|
22
|
-
test("should work with objects that are comparable", function () {
|
|
23
|
-
var date1 = new Date(2024, 0, 1);
|
|
24
|
-
var date2 = new Date(2024, 0, 2);
|
|
25
|
-
expect((0, _compareFunctionDefault.compareFunctionDefault)(date2, date1)).toBe(1);
|
|
26
|
-
expect((0, _compareFunctionDefault.compareFunctionDefault)(date1, date2)).toBe(-1);
|
|
27
|
-
expect((0, _compareFunctionDefault.compareFunctionDefault)(date1, new Date(2024, 0, 1))).toBe(0);
|
|
28
|
-
});
|
|
29
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _drop = require("@/Array/drop");
|
|
4
|
-
var _lodash = _interopRequireDefault(require("lodash"));
|
|
5
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
6
|
-
describe("drop function", function () {
|
|
7
|
-
it("should exclude n elements from the start of the array", function () {
|
|
8
|
-
// umt
|
|
9
|
-
expect((0, _drop.drop)([1, 2, 3, 4, 5], 2)).toEqual([3, 4, 5]);
|
|
10
|
-
expect((0, _drop.drop)([1, 2, 3, 4, 5])).toEqual([2, 3, 4, 5]);
|
|
11
|
-
|
|
12
|
-
// lodash
|
|
13
|
-
expect(_lodash["default"].drop([1, 2, 3, 4, 5], 2)).toEqual([3, 4, 5]);
|
|
14
|
-
expect(_lodash["default"].drop([1, 2, 3, 4, 5])).toEqual([2, 3, 4, 5]);
|
|
15
|
-
});
|
|
16
|
-
it("should exclude n elements from the start when direction is 'left'", function () {
|
|
17
|
-
// umt
|
|
18
|
-
expect((0, _drop.drop)([1, 2, 3, 4, 5], 2, "left")).toEqual([3, 4, 5]);
|
|
19
|
-
|
|
20
|
-
// lodash
|
|
21
|
-
expect(_lodash["default"].drop([1, 2, 3, 4, 5], 2)).toEqual([3, 4, 5]);
|
|
22
|
-
});
|
|
23
|
-
it("should exclude n elements from the end when direction is 'right'", function () {
|
|
24
|
-
// umt
|
|
25
|
-
expect((0, _drop.drop)([1, 2, 3, 4, 5], 2, "right")).toEqual([1, 2, 3]);
|
|
26
|
-
|
|
27
|
-
// lodash
|
|
28
|
-
expect(_lodash["default"].dropRight([1, 2, 3, 4, 5], 2)).toEqual([1, 2, 3]);
|
|
29
|
-
});
|
|
30
|
-
it("should exclude n elements from the middle when direction is 'between'", function () {
|
|
31
|
-
// umt
|
|
32
|
-
expect((0, _drop.drop)([1, 2, 3, 4, 5], 1, "between")).toEqual([1, 2, 4, 5]);
|
|
33
|
-
expect((0, _drop.drop)([1, 2, 3, 4, 5, 6], 2, "between")).toEqual([1, 2, 5, 6]);
|
|
34
|
-
});
|
|
35
|
-
it("should return an empty array when n is greater than or equal to array length", function () {
|
|
36
|
-
// umt
|
|
37
|
-
expect((0, _drop.drop)([1, 2, 3], 4)).toEqual([]);
|
|
38
|
-
expect((0, _drop.drop)([1, 2, 3], 3)).toEqual([]);
|
|
39
|
-
|
|
40
|
-
// lodash
|
|
41
|
-
expect(_lodash["default"].drop([1, 2, 3], 4)).toEqual([]);
|
|
42
|
-
expect(_lodash["default"].drop([1, 2, 3], 3)).toEqual([]);
|
|
43
|
-
});
|
|
44
|
-
it("should return the original array when n is 0", function () {
|
|
45
|
-
// umt
|
|
46
|
-
expect((0, _drop.drop)([1, 2, 3], 0)).toEqual([1, 2, 3]);
|
|
47
|
-
expect((0, _drop.drop)([1, 2, 3], 0, "left")).toEqual([1, 2, 3]);
|
|
48
|
-
expect((0, _drop.drop)([1, 2, 3], 0, "right")).toEqual([1, 2, 3]);
|
|
49
|
-
expect((0, _drop.drop)([1, 2, 3], 0, "between")).toEqual([1, 2, 3]);
|
|
50
|
-
|
|
51
|
-
// lodash
|
|
52
|
-
expect(_lodash["default"].drop([1, 2, 3], 0)).toEqual([1, 2, 3]);
|
|
53
|
-
expect(_lodash["default"].drop([1, 2, 3], 0)).toEqual([1, 2, 3]);
|
|
54
|
-
expect(_lodash["default"].dropRight([1, 2, 3], 0)).toEqual([1, 2, 3]);
|
|
55
|
-
});
|
|
56
|
-
it("should return the original array when n is negative", function () {
|
|
57
|
-
// umt
|
|
58
|
-
expect((0, _drop.drop)([1, 2, 3], -1)).toEqual([1, 2, 3]);
|
|
59
|
-
expect((0, _drop.drop)([1, 2, 3], -2, "left")).toEqual([1, 2, 3]);
|
|
60
|
-
expect((0, _drop.drop)([1, 2, 3], -3, "right")).toEqual([1, 2, 3]);
|
|
61
|
-
expect((0, _drop.drop)([1, 2, 3], -4, "between")).toEqual([1, 2, 3]);
|
|
62
|
-
|
|
63
|
-
// lodash
|
|
64
|
-
expect(_lodash["default"].drop([1, 2, 3], -1)).toEqual([1, 2, 3]);
|
|
65
|
-
expect(_lodash["default"].drop([1, 2, 3], -2)).toEqual([1, 2, 3]);
|
|
66
|
-
expect(_lodash["default"].dropRight([1, 2, 3], -3)).toEqual([1, 2, 3]);
|
|
67
|
-
});
|
|
68
|
-
it("should return an empty array when an empty array is passed", function () {
|
|
69
|
-
// umt
|
|
70
|
-
expect((0, _drop.drop)([], 1)).toEqual([]);
|
|
71
|
-
expect((0, _drop.drop)([], 2, "left")).toEqual([]);
|
|
72
|
-
expect((0, _drop.drop)([], 3, "right")).toEqual([]);
|
|
73
|
-
expect((0, _drop.drop)([], 4, "between")).toEqual([]);
|
|
74
|
-
|
|
75
|
-
// lodash
|
|
76
|
-
expect(_lodash["default"].drop([], 1)).toEqual([]);
|
|
77
|
-
expect(_lodash["default"].drop([], 2)).toEqual([]);
|
|
78
|
-
expect(_lodash["default"].dropRight([], 3)).toEqual([]);
|
|
79
|
-
});
|
|
80
|
-
it("should treat as 'left' when an invalid direction is passed", function () {
|
|
81
|
-
// @ts-ignore
|
|
82
|
-
expect((0, _drop.drop)([1, 2, 3], 1, "invalid")).toEqual([2, 3]);
|
|
83
|
-
});
|
|
84
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _dualPivotQuickSort = require("../../../Array/dualPivotQuickSort");
|
|
4
|
-
describe("dualPivotQuickSort", function () {
|
|
5
|
-
test("should sort an array of numbers in ascending order", function () {
|
|
6
|
-
var array = [3, 1, 4, 1, 5, 9, 2, 6, 5, 3];
|
|
7
|
-
expect((0, _dualPivotQuickSort.dualPivotQuickSort)([].concat(array))).toEqual([1, 1, 2, 3, 3, 4, 5, 5, 6, 9]);
|
|
8
|
-
});
|
|
9
|
-
test("should sort an array of strings lexicographically", function () {
|
|
10
|
-
var array = ["banana", "apple", "orange", "grape"];
|
|
11
|
-
expect((0, _dualPivotQuickSort.dualPivotQuickSort)([].concat(array))).toEqual(["apple", "banana", "grape", "orange"]);
|
|
12
|
-
});
|
|
13
|
-
test("should sort in descending order when custom comparison function is provided", function () {
|
|
14
|
-
var array = [3, 1, 4, 1, 5, 9, 2, 6, 5, 3];
|
|
15
|
-
var compareFunction = function compareFunction(a, b) {
|
|
16
|
-
return b - a;
|
|
17
|
-
};
|
|
18
|
-
expect((0, _dualPivotQuickSort.dualPivotQuickSort)([].concat(array), compareFunction)).toEqual([9, 6, 5, 5, 4, 3, 3, 2, 1, 1]);
|
|
19
|
-
});
|
|
20
|
-
test("should handle empty array", function () {
|
|
21
|
-
expect((0, _dualPivotQuickSort.dualPivotQuickSort)([])).toEqual([]);
|
|
22
|
-
});
|
|
23
|
-
test("should handle array with single element", function () {
|
|
24
|
-
expect((0, _dualPivotQuickSort.dualPivotQuickSort)([1])).toEqual([1]);
|
|
25
|
-
});
|
|
26
|
-
test("should handle array with all identical elements", function () {
|
|
27
|
-
var array = [2, 2, 2, 2, 2];
|
|
28
|
-
expect((0, _dualPivotQuickSort.dualPivotQuickSort)([].concat(array))).toEqual([2, 2, 2, 2, 2]);
|
|
29
|
-
});
|
|
30
|
-
test("should handle already sorted array", function () {
|
|
31
|
-
var array = [1, 2, 3, 4, 5];
|
|
32
|
-
expect((0, _dualPivotQuickSort.dualPivotQuickSort)([].concat(array))).toEqual([1, 2, 3, 4, 5]);
|
|
33
|
-
});
|
|
34
|
-
test("should handle reverse sorted array", function () {
|
|
35
|
-
var array = [5, 4, 3, 2, 1];
|
|
36
|
-
expect((0, _dualPivotQuickSort.dualPivotQuickSort)([].concat(array))).toEqual([1, 2, 3, 4, 5]);
|
|
37
|
-
});
|
|
38
|
-
test("should handle array with negative numbers", function () {
|
|
39
|
-
var array = [-3, 1, -4, 1, 5, -9, 2, 6, 5, 3];
|
|
40
|
-
expect((0, _dualPivotQuickSort.dualPivotQuickSort)([].concat(array))).toEqual([-9, -4, -3, 1, 1, 2, 3, 5, 5, 6]);
|
|
41
|
-
});
|
|
42
|
-
test("should sort only specified range of array", function () {
|
|
43
|
-
var array = [3, 1, 4, 1, 5, 9, 2, 6, 5, 3];
|
|
44
|
-
expect((0, _dualPivotQuickSort.dualPivotQuickSort)([].concat(array), undefined, 2, 6)).toEqual([3, 1, 1, 2, 4, 5, 9, 6, 5, 3]);
|
|
45
|
-
});
|
|
46
|
-
test("should handle large arrays efficiently", function () {
|
|
47
|
-
var size = 1000;
|
|
48
|
-
var array = Array.from({
|
|
49
|
-
length: size
|
|
50
|
-
}, function () {
|
|
51
|
-
return Math.floor(Math.random() * size);
|
|
52
|
-
});
|
|
53
|
-
var sorted = (0, _dualPivotQuickSort.dualPivotQuickSort)([].concat(array));
|
|
54
|
-
for (var i = 1; i < sorted.length; i++) {
|
|
55
|
-
expect(sorted[i]).toBeGreaterThanOrEqual(sorted[i - 1]);
|
|
56
|
-
}
|
|
57
|
-
});
|
|
58
|
-
test("should use insertion sort for small arrays when threshold is adjusted", function () {
|
|
59
|
-
var array = [3, 1, 4, 1, 5, 9, 2, 6, 5, 3];
|
|
60
|
-
expect((0, _dualPivotQuickSort.dualPivotQuickSort)([].concat(array), undefined, 0, array.length - 1, 5)).toEqual([1, 1, 2, 3, 3, 4, 5, 5, 6, 9]);
|
|
61
|
-
});
|
|
62
|
-
test("should sort array of objects using custom comparison", function () {
|
|
63
|
-
var array = [{
|
|
64
|
-
id: 3,
|
|
65
|
-
value: "c"
|
|
66
|
-
}, {
|
|
67
|
-
id: 1,
|
|
68
|
-
value: "a"
|
|
69
|
-
}, {
|
|
70
|
-
id: 2,
|
|
71
|
-
value: "b"
|
|
72
|
-
}];
|
|
73
|
-
var compareFunction = function compareFunction(a, b) {
|
|
74
|
-
return a.id - b.id;
|
|
75
|
-
};
|
|
76
|
-
expect((0, _dualPivotQuickSort.dualPivotQuickSort)([].concat(array), compareFunction)).toEqual([{
|
|
77
|
-
id: 1,
|
|
78
|
-
value: "a"
|
|
79
|
-
}, {
|
|
80
|
-
id: 2,
|
|
81
|
-
value: "b"
|
|
82
|
-
}, {
|
|
83
|
-
id: 3,
|
|
84
|
-
value: "c"
|
|
85
|
-
}]);
|
|
86
|
-
});
|
|
87
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _first = require("@/Array/first");
|
|
4
|
-
describe("first", function () {
|
|
5
|
-
it("should return the first element of a non-empty array", function () {
|
|
6
|
-
expect((0, _first.first)([1, 2, 3])).toBe(1);
|
|
7
|
-
expect((0, _first.first)(["a", "b", "c"])).toBe("a");
|
|
8
|
-
expect((0, _first.first)([true, false, true])).toBe(true);
|
|
9
|
-
expect((0, _first.first)([{
|
|
10
|
-
key: "value"
|
|
11
|
-
}, {
|
|
12
|
-
key: "another"
|
|
13
|
-
}])).toEqual({
|
|
14
|
-
key: "value"
|
|
15
|
-
});
|
|
16
|
-
});
|
|
17
|
-
it("should return undefined for an empty array", function () {
|
|
18
|
-
expect((0, _first.first)([])).toBeUndefined();
|
|
19
|
-
});
|
|
20
|
-
it("should handle arrays with different types of elements", function () {
|
|
21
|
-
expect((0, _first.first)([1, "a", true])).toBe(1);
|
|
22
|
-
expect((0, _first.first)([undefined, null, 0])).toBeUndefined();
|
|
23
|
-
});
|
|
24
|
-
it("should handle arrays with only one element", function () {
|
|
25
|
-
expect((0, _first.first)([42])).toBe(42);
|
|
26
|
-
expect((0, _first.first)(["single"])).toBe("single");
|
|
27
|
-
});
|
|
28
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _generateNumberArray = require("@/Array/generateNumberArray");
|
|
4
|
-
describe("generateNumberArray", function () {
|
|
5
|
-
it("should generate an array with the specified length", function () {
|
|
6
|
-
var result = (0, _generateNumberArray.generateNumberArray)(5);
|
|
7
|
-
expect(result).toEqual([0, 1, 2, 3, 4]);
|
|
8
|
-
});
|
|
9
|
-
it("should generate an array with specified min and max values", function () {
|
|
10
|
-
var result = (0, _generateNumberArray.generateNumberArray)(5, 10, 14);
|
|
11
|
-
expect(result).toEqual([10, 11, 12, 13, 14]);
|
|
12
|
-
});
|
|
13
|
-
it("should return an empty array when length is 0", function () {
|
|
14
|
-
var result = (0, _generateNumberArray.generateNumberArray)(0);
|
|
15
|
-
expect(result).toEqual([]);
|
|
16
|
-
});
|
|
17
|
-
it("should throw an error when min is greater than max", function () {
|
|
18
|
-
expect(function () {
|
|
19
|
-
return (0, _generateNumberArray.generateNumberArray)(5, 10, 5);
|
|
20
|
-
}).toThrow("min should be less than or equal to max");
|
|
21
|
-
});
|
|
22
|
-
it("should return min value when length is 1", function () {
|
|
23
|
-
var result = (0, _generateNumberArray.generateNumberArray)(1, 10, 20);
|
|
24
|
-
expect(result).toEqual([10]);
|
|
25
|
-
});
|
|
26
|
-
it("should generate an array with random values", function () {
|
|
27
|
-
var result = (0, _generateNumberArray.generateNumberArray)(5, 10, 14, true);
|
|
28
|
-
expect(result).toHaveLength(5);
|
|
29
|
-
result.forEach(function (item) {
|
|
30
|
-
expect(item).toBeGreaterThanOrEqual(10);
|
|
31
|
-
expect(item).toBeLessThanOrEqual(14);
|
|
32
|
-
});
|
|
33
|
-
});
|
|
34
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _getArraysCommon = require("@/Array/getArraysCommon");
|
|
4
|
-
describe("getArraysCommon", function () {
|
|
5
|
-
it("should find common elements between arrays", function () {
|
|
6
|
-
// Test with two arrays
|
|
7
|
-
expect((0, _getArraysCommon.getArraysCommon)([1, 2, 3], [2, 3, 4])).toEqual([2, 3]);
|
|
8
|
-
|
|
9
|
-
// Test with three arrays
|
|
10
|
-
expect((0, _getArraysCommon.getArraysCommon)([1, 2, 3], [2, 3, 9], [3, 4, 5])).toEqual([3]);
|
|
11
|
-
|
|
12
|
-
// Test with four arrays (including duplicates)
|
|
13
|
-
expect((0, _getArraysCommon.getArraysCommon)([1, 2, 3], [2, 3, 9], [3, 4, 5], [3, 4, 5])).toEqual([3]);
|
|
14
|
-
});
|
|
15
|
-
it("should handle empty arrays", function () {
|
|
16
|
-
expect((0, _getArraysCommon.getArraysCommon)([], [])).toEqual([]);
|
|
17
|
-
expect((0, _getArraysCommon.getArraysCommon)([1, 2, 3], [])).toEqual([]);
|
|
18
|
-
expect((0, _getArraysCommon.getArraysCommon)([], [1, 2, 3])).toEqual([]);
|
|
19
|
-
});
|
|
20
|
-
it("should handle arrays with no common elements", function () {
|
|
21
|
-
expect((0, _getArraysCommon.getArraysCommon)([1, 2, 3], [4, 5, 6])).toEqual([]);
|
|
22
|
-
expect((0, _getArraysCommon.getArraysCommon)([1, 2], [3, 4], [5, 6])).toEqual([]);
|
|
23
|
-
});
|
|
24
|
-
it("should handle arrays of strings", function () {
|
|
25
|
-
expect((0, _getArraysCommon.getArraysCommon)(["a", "b", "c"], ["b", "c", "d"])).toEqual(["b", "c"]);
|
|
26
|
-
expect((0, _getArraysCommon.getArraysCommon)(["a", "b", "c"], ["b", "c", "d"], ["c", "d", "e"])).toEqual(["c"]);
|
|
27
|
-
});
|
|
28
|
-
it("should handle arrays of objects", function () {
|
|
29
|
-
var obj1 = {
|
|
30
|
-
id: 1
|
|
31
|
-
};
|
|
32
|
-
var obj2 = {
|
|
33
|
-
id: 2
|
|
34
|
-
};
|
|
35
|
-
var obj3 = {
|
|
36
|
-
id: 3
|
|
37
|
-
};
|
|
38
|
-
expect((0, _getArraysCommon.getArraysCommon)([obj1, obj2, obj3], [obj2, obj3], [obj3])).toEqual([obj3]);
|
|
39
|
-
});
|
|
40
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _getArraysDiff = require("@/Array/getArraysDiff");
|
|
4
|
-
describe("getArraysDiff function", function () {
|
|
5
|
-
// Normal cases
|
|
6
|
-
test("should handle standard arrays", function () {
|
|
7
|
-
expect((0, _getArraysDiff.getArraysDiff)([1, 2, 3], [2, 3, 4], [3, 4, 5])).toEqual([1, 5]);
|
|
8
|
-
expect((0, _getArraysDiff.getArraysDiff)([-1, 0, 1], [0, 1, 2], [1, 2, 3])).toEqual([-1, 3]);
|
|
9
|
-
expect((0, _getArraysDiff.getArraysDiff)([0.1, 0.2, 0.3], [0.2, 0.3, 0.4], [0.3, 0.4, 0.5])).toEqual([0.1, 0.5]);
|
|
10
|
-
expect((0, _getArraysDiff.getArraysDiff)(["a", "b", "c"], ["b", "c", "d"], ["c", "d", "e"])).toEqual(["a", "e"]);
|
|
11
|
-
expect((0, _getArraysDiff.getArraysDiff)(["あ", "い", "う"], ["い", "う", "え"], ["う", "え", "お"])).toEqual(["あ", "お"]);
|
|
12
|
-
expect((0, _getArraysDiff.getArraysDiff)([true, false], [false, true], [true, false])).toEqual([]);
|
|
13
|
-
expect((0, _getArraysDiff.getArraysDiff)([1, "a", true], [2, "b", false], [3, "c", true])).toEqual([1, "a", 2, "b", false, 3, "c"]);
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
// Cases with empty arrays
|
|
17
|
-
test("should handle empty arrays", function () {
|
|
18
|
-
expect((0, _getArraysDiff.getArraysDiff)([], [1, 2], [2, 3])).toEqual([1, 3]);
|
|
19
|
-
expect((0, _getArraysDiff.getArraysDiff)([1, 2], [], [2, 3])).toEqual([1, 3]);
|
|
20
|
-
expect((0, _getArraysDiff.getArraysDiff)([1, 2], [2, 3], [])).toEqual([1, 3]);
|
|
21
|
-
expect((0, _getArraysDiff.getArraysDiff)([], [], [1, 2, 3])).toEqual([1, 2, 3]);
|
|
22
|
-
expect((0, _getArraysDiff.getArraysDiff)(["a", "b"], [], ["b", "c"])).toEqual(["a", "c"]);
|
|
23
|
-
expect((0, _getArraysDiff.getArraysDiff)([], [true, false], [false, null])).toEqual([true, null]);
|
|
24
|
-
expect((0, _getArraysDiff.getArraysDiff)([{
|
|
25
|
-
x: 1
|
|
26
|
-
}], [], [{
|
|
27
|
-
z: 3
|
|
28
|
-
}])).toEqual([{
|
|
29
|
-
x: 1
|
|
30
|
-
}, {
|
|
31
|
-
z: 3
|
|
32
|
-
}]);
|
|
33
|
-
expect((0, _getArraysDiff.getArraysDiff)([], [[1, 2]], [[3, 4]])).toEqual([[1, 2], [3, 4]]);
|
|
34
|
-
expect((0, _getArraysDiff.getArraysDiff)([1, "a", true], [], [3, "c", false])).toEqual([1, "a", true, 3, "c", false]);
|
|
35
|
-
expect((0, _getArraysDiff.getArraysDiff)([], [], [])).toEqual([]);
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
// Cases with no duplicate elements
|
|
39
|
-
test("should handle arrays with no duplicates", function () {
|
|
40
|
-
expect((0, _getArraysDiff.getArraysDiff)([1, 2], [3, 4], [5, 6])).toEqual([1, 2, 3, 4, 5, 6]);
|
|
41
|
-
expect((0, _getArraysDiff.getArraysDiff)(["a", "b"], ["c", "d"], ["e", "f"])).toEqual(["a", "b", "c", "d", "e", "f"]);
|
|
42
|
-
expect((0, _getArraysDiff.getArraysDiff)([true], [false], [null])).toEqual([true, false, null]);
|
|
43
|
-
expect((0, _getArraysDiff.getArraysDiff)([{
|
|
44
|
-
x: 1
|
|
45
|
-
}], [{
|
|
46
|
-
y: 2
|
|
47
|
-
}], [{
|
|
48
|
-
z: 3
|
|
49
|
-
}])).toEqual([{
|
|
50
|
-
x: 1
|
|
51
|
-
}, {
|
|
52
|
-
y: 2
|
|
53
|
-
}, {
|
|
54
|
-
z: 3
|
|
55
|
-
}]);
|
|
56
|
-
expect((0, _getArraysDiff.getArraysDiff)([[1]], [[2]], [[3]])).toEqual([[1], [2], [3]]);
|
|
57
|
-
expect((0, _getArraysDiff.getArraysDiff)([1, "a"], [2, "b"], [3, "c"])).toEqual([1, "a", 2, "b", 3, "c"]);
|
|
58
|
-
expect((0, _getArraysDiff.getArraysDiff)([0.1], [0.2], [0.3])).toEqual([0.1, 0.2, 0.3]);
|
|
59
|
-
expect((0, _getArraysDiff.getArraysDiff)([new Date("2021-01-01")], [new Date("2021-01-02")], [new Date("2021-01-03")])).toEqual([new Date("2021-01-01"), new Date("2021-01-02"), new Date("2021-01-03")]);
|
|
60
|
-
expect((0, _getArraysDiff.getArraysDiff)([/a/], [/b/], [/c/])).toEqual([/a/, /b/, /c/]);
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
// Cases where all arrays have the same elements
|
|
64
|
-
test("should handle arrays with identical elements", function () {
|
|
65
|
-
expect((0, _getArraysDiff.getArraysDiff)([1, 2, 3], [1, 2, 3], [1, 2, 3])).toEqual([]);
|
|
66
|
-
expect((0, _getArraysDiff.getArraysDiff)(["a", "b", "c"], ["a", "b", "c"], ["a", "b", "c"])).toEqual([]);
|
|
67
|
-
expect((0, _getArraysDiff.getArraysDiff)([true, false], [true, false], [true, false])).toEqual([]);
|
|
68
|
-
expect((0, _getArraysDiff.getArraysDiff)([1, "a", true], [1, "a", true], [1, "a", true])).toEqual([]);
|
|
69
|
-
expect((0, _getArraysDiff.getArraysDiff)([0.1, 0.2], [0.1, 0.2], [0.1, 0.2])).toEqual([]);
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
// Cases where all arrays have the same elements but in different order
|
|
73
|
-
test("should handle arrays with identical elements in different order", function () {
|
|
74
|
-
expect((0, _getArraysDiff.getArraysDiff)([1, 2, 3], [3, 1, 2], [2, 3, 1])).toEqual([]);
|
|
75
|
-
expect((0, _getArraysDiff.getArraysDiff)(["a", "b", "c"], ["c", "a", "b"], ["b", "c", "a"])).toEqual([]);
|
|
76
|
-
expect((0, _getArraysDiff.getArraysDiff)([true, false, null], [null, true, false], [false, null, true])).toEqual([]);
|
|
77
|
-
expect((0, _getArraysDiff.getArraysDiff)([1, "a", true], [true, 1, "a"], ["a", true, 1])).toEqual([]);
|
|
78
|
-
expect((0, _getArraysDiff.getArraysDiff)([0.1, 0.2, 0.3], [0.3, 0.1, 0.2], [0.2, 0.3, 0.1])).toEqual([]);
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
// Cases with different types
|
|
82
|
-
test("should handle arrays with different types", function () {
|
|
83
|
-
expect((0, _getArraysDiff.getArraysDiff)([1, "a", true], [true, "a"], [1, 2])).toEqual([2]);
|
|
84
|
-
expect((0, _getArraysDiff.getArraysDiff)([{
|
|
85
|
-
x: 1
|
|
86
|
-
}, [1, 2], 3], ["a", true, null], [false, 5, {
|
|
87
|
-
y: 2
|
|
88
|
-
}])).toEqual([{
|
|
89
|
-
x: 1
|
|
90
|
-
}, [1, 2], 3, "a", true, null, false, 5, {
|
|
91
|
-
y: 2
|
|
92
|
-
}]);
|
|
93
|
-
expect((0, _getArraysDiff.getArraysDiff)([1, "2", true], ["1", 2, false], [true, "1", 2])).toEqual([1, "2", false]);
|
|
94
|
-
expect((0, _getArraysDiff.getArraysDiff)([0, ""], [false, null], [undefined, Number.NaN])).toEqual([0, "", false, null, undefined, Number.NaN]);
|
|
95
|
-
expect((0, _getArraysDiff.getArraysDiff)([1n, 2n], [BigInt(1), BigInt(2)], [1, 2])).toEqual([1, 2]);
|
|
96
|
-
expect((0, _getArraysDiff.getArraysDiff)([new Map()], [new Set()], [new WeakMap()])).toEqual([new Map(), new Set(), new WeakMap()]);
|
|
97
|
-
expect((0, _getArraysDiff.getArraysDiff)([Symbol.iterator], [Symbol.asyncIterator], [Symbol.toStringTag])).toEqual([Symbol.iterator, Symbol.asyncIterator, Symbol.toStringTag]);
|
|
98
|
-
});
|
|
99
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _groupBy = require("@/Array/groupBy");
|
|
4
|
-
describe("groupBy", function () {
|
|
5
|
-
it("should group numbers into odd and even", function () {
|
|
6
|
-
var array = [1, 2, 3, 4, 5];
|
|
7
|
-
var result = (0, _groupBy.groupBy)(array, function (num) {
|
|
8
|
-
return num % 2 === 0 ? "even" : "odd";
|
|
9
|
-
});
|
|
10
|
-
expect(result).toEqual({
|
|
11
|
-
odd: [1, 3, 5],
|
|
12
|
-
even: [2, 4]
|
|
13
|
-
});
|
|
14
|
-
});
|
|
15
|
-
it("should group strings based on their length", function () {
|
|
16
|
-
var array = ["one", "two", "three", "four", "five"];
|
|
17
|
-
var result = (0, _groupBy.groupBy)(array, function (str) {
|
|
18
|
-
return str.length.toString();
|
|
19
|
-
});
|
|
20
|
-
expect(result).toEqual({
|
|
21
|
-
"3": ["one", "two"],
|
|
22
|
-
"4": ["four", "five"],
|
|
23
|
-
"5": ["three"]
|
|
24
|
-
});
|
|
25
|
-
});
|
|
26
|
-
it("should group boolean values", function () {
|
|
27
|
-
var array = [true, false, true, false, true];
|
|
28
|
-
var result = (0, _groupBy.groupBy)(array, function (bool) {
|
|
29
|
-
return bool.toString();
|
|
30
|
-
});
|
|
31
|
-
expect(result).toEqual({
|
|
32
|
-
"true": [true, true, true],
|
|
33
|
-
"false": [false, false]
|
|
34
|
-
});
|
|
35
|
-
});
|
|
36
|
-
it("should group objects based on their properties", function () {
|
|
37
|
-
var array = [{
|
|
38
|
-
type: "fruit",
|
|
39
|
-
name: "apple"
|
|
40
|
-
}, {
|
|
41
|
-
type: "vegetable",
|
|
42
|
-
name: "carrot"
|
|
43
|
-
}, {
|
|
44
|
-
type: "fruit",
|
|
45
|
-
name: "banana"
|
|
46
|
-
}, {
|
|
47
|
-
type: "vegetable",
|
|
48
|
-
name: "lettuce"
|
|
49
|
-
}];
|
|
50
|
-
var result = (0, _groupBy.groupBy)(array, function (item) {
|
|
51
|
-
return item.type;
|
|
52
|
-
});
|
|
53
|
-
expect(result).toEqual({
|
|
54
|
-
fruit: [{
|
|
55
|
-
type: "fruit",
|
|
56
|
-
name: "apple"
|
|
57
|
-
}, {
|
|
58
|
-
type: "fruit",
|
|
59
|
-
name: "banana"
|
|
60
|
-
}],
|
|
61
|
-
vegetable: [{
|
|
62
|
-
type: "vegetable",
|
|
63
|
-
name: "carrot"
|
|
64
|
-
}, {
|
|
65
|
-
type: "vegetable",
|
|
66
|
-
name: "lettuce"
|
|
67
|
-
}]
|
|
68
|
-
});
|
|
69
|
-
});
|
|
70
|
-
it("should group all elements under undefined key when iterator returns undefined", function () {
|
|
71
|
-
var array = [1, 2, 3, 4, 5];
|
|
72
|
-
// @ts-ignore
|
|
73
|
-
var result = (0, _groupBy.groupBy)(array, function () {
|
|
74
|
-
return undefined;
|
|
75
|
-
});
|
|
76
|
-
expect(result).toEqual({
|
|
77
|
-
undefined: [1, 2, 3, 4, 5]
|
|
78
|
-
});
|
|
79
|
-
});
|
|
80
|
-
it("should return an empty object for an empty array", function () {
|
|
81
|
-
var array = [];
|
|
82
|
-
var result = (0, _groupBy.groupBy)(array, function (num) {
|
|
83
|
-
return num % 2 === 0 ? "even" : "odd";
|
|
84
|
-
});
|
|
85
|
-
expect(result).toEqual({});
|
|
86
|
-
});
|
|
87
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _insertionSort = require("@/Array/insertionSort");
|
|
4
|
-
describe("insertionSort", function () {
|
|
5
|
-
it("should return an empty array when sorting an empty array", function () {
|
|
6
|
-
expect((0, _insertionSort.insertionSort)([])).toEqual([]);
|
|
7
|
-
});
|
|
8
|
-
it("should return the same array when it's already sorted", function () {
|
|
9
|
-
expect((0, _insertionSort.insertionSort)([1, 2, 3])).toEqual([1, 2, 3]);
|
|
10
|
-
});
|
|
11
|
-
it("should correctly sort a reverse-sorted array", function () {
|
|
12
|
-
expect((0, _insertionSort.insertionSort)([3, 2, 1])).toEqual([1, 2, 3]);
|
|
13
|
-
});
|
|
14
|
-
it("should correctly sort a random array", function () {
|
|
15
|
-
var array = [3, 1, 4, 1, 5, 9, 2, 6, 5, 3, 5];
|
|
16
|
-
var sortedArray = [].concat(array).sort(function (a, b) {
|
|
17
|
-
return a - b;
|
|
18
|
-
});
|
|
19
|
-
expect((0, _insertionSort.insertionSort)(array)).toEqual(sortedArray);
|
|
20
|
-
});
|
|
21
|
-
it("should correctly sort an array with duplicate elements", function () {
|
|
22
|
-
expect((0, _insertionSort.insertionSort)([2, 3, 3, 1, 2])).toEqual([1, 2, 2, 3, 3]);
|
|
23
|
-
});
|
|
24
|
-
it("should correctly sort an array with negative numbers", function () {
|
|
25
|
-
expect((0, _insertionSort.insertionSort)([5, -1, 3, 2, 4, -5, 1, -2, 0])).toEqual([-5, -2, -1, 0, 1, 2, 3, 4, 5]);
|
|
26
|
-
});
|
|
27
|
-
it("should sort array in descending order", function () {
|
|
28
|
-
expect((0, _insertionSort.insertionSort)([1, 2, 3], function (a, b) {
|
|
29
|
-
return b - a;
|
|
30
|
-
})).toEqual([3, 2, 1]);
|
|
31
|
-
});
|
|
32
|
-
it("should sort a portion of the array", function () {
|
|
33
|
-
expect((0, _insertionSort.insertionSort)([1, 3, 2, 5, 4], function (a, b) {
|
|
34
|
-
return a - b;
|
|
35
|
-
}, 1, 3)).toEqual([1, 2, 3, 5, 4]);
|
|
36
|
-
});
|
|
37
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _mergeSort = require("@/Array/mergeSort");
|
|
4
|
-
describe("mergeSort", function () {
|
|
5
|
-
it("should return an empty array when given an empty array", function () {
|
|
6
|
-
expect((0, _mergeSort.mergeSort)([])).toEqual([]);
|
|
7
|
-
});
|
|
8
|
-
it("should return the same array when it's already sorted", function () {
|
|
9
|
-
expect((0, _mergeSort.mergeSort)([1, 2, 3])).toEqual([1, 2, 3]);
|
|
10
|
-
});
|
|
11
|
-
it("should correctly sort a reverse-sorted array", function () {
|
|
12
|
-
expect((0, _mergeSort.mergeSort)([3, 2, 1])).toEqual([1, 2, 3]);
|
|
13
|
-
});
|
|
14
|
-
it("should correctly sort a randomly ordered array", function () {
|
|
15
|
-
expect((0, _mergeSort.mergeSort)([2, 3, 1])).toEqual([1, 2, 3]);
|
|
16
|
-
});
|
|
17
|
-
it("should correctly sort an array with duplicate elements", function () {
|
|
18
|
-
expect((0, _mergeSort.mergeSort)([2, 3, 3, 1, 2])).toEqual([1, 2, 2, 3, 3]);
|
|
19
|
-
});
|
|
20
|
-
it("should handle a single-element array", function () {
|
|
21
|
-
expect((0, _mergeSort.mergeSort)([1])).toEqual([1]);
|
|
22
|
-
});
|
|
23
|
-
it("should correctly sort an array with negative numbers", function () {
|
|
24
|
-
expect((0, _mergeSort.mergeSort)([3, -1, 4, -5, 2, -3])).toEqual([-5, -3, -1, 2, 3, 4]);
|
|
25
|
-
});
|
|
26
|
-
it("should sort strings alphabetically", function () {
|
|
27
|
-
expect((0, _mergeSort.mergeSort)(["banana", "apple", "cherry"])).toEqual(["apple", "banana", "cherry"]);
|
|
28
|
-
});
|
|
29
|
-
it("should sort using custom comparison function", function () {
|
|
30
|
-
// Sort in descending order
|
|
31
|
-
var descendingCompare = function descendingCompare(a, b) {
|
|
32
|
-
return b - a;
|
|
33
|
-
};
|
|
34
|
-
expect((0, _mergeSort.mergeSort)([1, 3, 2], descendingCompare)).toEqual([3, 2, 1]);
|
|
35
|
-
|
|
36
|
-
// Sort strings by length
|
|
37
|
-
var lengthCompare = function lengthCompare(a, b) {
|
|
38
|
-
return a.length - b.length;
|
|
39
|
-
};
|
|
40
|
-
expect((0, _mergeSort.mergeSort)(["aaa", "a", "aa"], lengthCompare)).toEqual(["a", "aa", "aaa"]);
|
|
41
|
-
});
|
|
42
|
-
it("should handle arrays with mixed types when using appropriate compare function", function () {
|
|
43
|
-
var array = ["10", "2", "1"];
|
|
44
|
-
var numericCompare = function numericCompare(a, b) {
|
|
45
|
-
return Number(a) - Number(b);
|
|
46
|
-
};
|
|
47
|
-
expect((0, _mergeSort.mergeSort)(array, numericCompare)).toEqual(["1", "2", "10"]);
|
|
48
|
-
});
|
|
49
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _pop = require("@/Array/pop");
|
|
4
|
-
describe("pop", function () {
|
|
5
|
-
it("should remove and return the last element of the array", function () {
|
|
6
|
-
var array = [1, 2, 3];
|
|
7
|
-
var result = (0, _pop.pop)(array);
|
|
8
|
-
expect(result).toBe(3);
|
|
9
|
-
expect(array).toEqual([1, 2, 3]);
|
|
10
|
-
});
|
|
11
|
-
it("should return undefined for an empty array", function () {
|
|
12
|
-
var array = [];
|
|
13
|
-
var result = (0, _pop.pop)(array);
|
|
14
|
-
expect(result).toBeUndefined();
|
|
15
|
-
});
|
|
16
|
-
it("should handle arrays with one element", function () {
|
|
17
|
-
var array = [42];
|
|
18
|
-
var result = (0, _pop.pop)(array);
|
|
19
|
-
expect(result).toBe(42);
|
|
20
|
-
expect(array).toEqual([42]);
|
|
21
|
-
});
|
|
22
|
-
it("should handle arrays with multiple types", function () {
|
|
23
|
-
var array = [1, "two", true];
|
|
24
|
-
var result = (0, _pop.pop)(array);
|
|
25
|
-
expect(result).toBe(true);
|
|
26
|
-
expect(array).toEqual([1, "two", true]);
|
|
27
|
-
});
|
|
28
|
-
it("should handle arrays with nested arrays", function () {
|
|
29
|
-
var array = [1, [2, 3], 4];
|
|
30
|
-
var result = (0, _pop.pop)(array);
|
|
31
|
-
expect(result).toBe(4);
|
|
32
|
-
expect(array).toEqual([1, [2, 3], 4]);
|
|
33
|
-
});
|
|
34
|
-
it("should handle arrays with objects", function () {
|
|
35
|
-
var array = [{
|
|
36
|
-
a: 1
|
|
37
|
-
}, {
|
|
38
|
-
b: 2
|
|
39
|
-
}];
|
|
40
|
-
var result = (0, _pop.pop)(array);
|
|
41
|
-
expect(result).toEqual({
|
|
42
|
-
b: 2
|
|
43
|
-
});
|
|
44
|
-
expect(array).toEqual([{
|
|
45
|
-
a: 1
|
|
46
|
-
}, {
|
|
47
|
-
b: 2
|
|
48
|
-
}]);
|
|
49
|
-
});
|
|
50
|
-
});
|