chore: Remove duplicate DigitSum algorithm (#873)

* Auto-update DIRECTORY.md

* chore: remove duplicate algorithm

* Auto-update DIRECTORY.md

* chore: remove duplicate algorithm tests

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
This commit is contained in:
Rak Laptudirm
2021-12-11 13:40:11 +05:30
committed by GitHub
parent c30b897324
commit f387ff327c
3 changed files with 9 additions and 30 deletions

View File

@ -113,6 +113,7 @@
* [PermutationinString](https://github.com/TheAlgorithms/Javascript/blob/master/Dynamic-Programming/Sliding-Window/PermutationinString.js)
* [SudokuSolver](https://github.com/TheAlgorithms/Javascript/blob/master/Dynamic-Programming/SudokuSolver.js)
* [TrappingRainWater](https://github.com/TheAlgorithms/Javascript/blob/master/Dynamic-Programming/TrappingRainWater.js)
* [TribonacciNumber](https://github.com/TheAlgorithms/Javascript/blob/master/Dynamic-Programming/TribonacciNumber.js)
* [ZeroOneKnapsack](https://github.com/TheAlgorithms/Javascript/blob/master/Dynamic-Programming/ZeroOneKnapsack.js)
## Geometry
@ -154,7 +155,6 @@
* [CoPrimeCheck](https://github.com/TheAlgorithms/Javascript/blob/master/Maths/CoPrimeCheck.js)
* [DecimalIsolate](https://github.com/TheAlgorithms/Javascript/blob/master/Maths/DecimalIsolate.js)
* [DegreeToRadian](https://github.com/TheAlgorithms/Javascript/blob/master/Maths/DegreeToRadian.js)
* [DigitSum](https://github.com/TheAlgorithms/Javascript/blob/master/Maths/DigitSum.js)
* [EulerMethod](https://github.com/TheAlgorithms/Javascript/blob/master/Maths/EulerMethod.js)
* [EulersTotient](https://github.com/TheAlgorithms/Javascript/blob/master/Maths/EulersTotient.js)
* [EulersTotientFunction](https://github.com/TheAlgorithms/Javascript/blob/master/Maths/EulersTotientFunction.js)
@ -167,6 +167,7 @@
* [FigurateNumber](https://github.com/TheAlgorithms/Javascript/blob/master/Maths/FigurateNumber.js)
* [FindHcf](https://github.com/TheAlgorithms/Javascript/blob/master/Maths/FindHcf.js)
* [FindLcm](https://github.com/TheAlgorithms/Javascript/blob/master/Maths/FindLcm.js)
* [FindMin](https://github.com/TheAlgorithms/Javascript/blob/master/Maths/FindMin.js)
* [GetEuclidGCD](https://github.com/TheAlgorithms/Javascript/blob/master/Maths/GetEuclidGCD.js)
* [GridGet](https://github.com/TheAlgorithms/Javascript/blob/master/Maths/GridGet.js)
* [IsDivisible](https://github.com/TheAlgorithms/Javascript/blob/master/Maths/IsDivisible.js)
@ -191,6 +192,7 @@
* [PiApproximationMonteCarlo](https://github.com/TheAlgorithms/Javascript/blob/master/Maths/PiApproximationMonteCarlo.js)
* [Polynomial](https://github.com/TheAlgorithms/Javascript/blob/master/Maths/Polynomial.js)
* [Pow](https://github.com/TheAlgorithms/Javascript/blob/master/Maths/Pow.js)
* [PowLogarithmic](https://github.com/TheAlgorithms/Javascript/blob/master/Maths/PowLogarithmic.js)
* [PrimeCheck](https://github.com/TheAlgorithms/Javascript/blob/master/Maths/PrimeCheck.js)
* [PrimeFactors](https://github.com/TheAlgorithms/Javascript/blob/master/Maths/PrimeFactors.js)
* [RadianToDegree](https://github.com/TheAlgorithms/Javascript/blob/master/Maths/RadianToDegree.js)
@ -231,7 +233,7 @@
* [BinaryEquivalent](https://github.com/TheAlgorithms/Javascript/blob/master/Recursive/BinaryEquivalent.js)
* [BinarySearch](https://github.com/TheAlgorithms/Javascript/blob/master/Recursive/BinarySearch.js)
* [EucledianGCD](https://github.com/TheAlgorithms/Javascript/blob/master/Recursive/EucledianGCD.js)
* [factorial](https://github.com/TheAlgorithms/Javascript/blob/master/Recursive/factorial.js)
* [Factorial](https://github.com/TheAlgorithms/Javascript/blob/master/Recursive/Factorial.js)
* [FibonacciNumberRecursive](https://github.com/TheAlgorithms/Javascript/blob/master/Recursive/FibonacciNumberRecursive.js)
* [FloodFill](https://github.com/TheAlgorithms/Javascript/blob/master/Recursive/FloodFill.js)
* [KochSnowflake](https://github.com/TheAlgorithms/Javascript/blob/master/Recursive/KochSnowflake.js)
@ -294,8 +296,8 @@
* [CheckPascalCase](https://github.com/TheAlgorithms/Javascript/blob/master/String/CheckPascalCase.js)
* [CheckRearrangePalindrome](https://github.com/TheAlgorithms/Javascript/blob/master/String/CheckRearrangePalindrome.js)
* [CheckSnakeCase](https://github.com/TheAlgorithms/Javascript/blob/master/String/CheckSnakeCase.js)
* [CheckVowels](https://github.com/TheAlgorithms/Javascript/blob/master/String/CheckVowels.js)
* [CheckWordOccurrence](https://github.com/TheAlgorithms/Javascript/blob/master/String/CheckWordOccurrence.js)
* [CountVowels](https://github.com/TheAlgorithms/Javascript/blob/master/String/CountVowels.js)
* [CreatePermutations](https://github.com/TheAlgorithms/Javascript/blob/master/String/CreatePermutations.js)
* [DiceCoefficient](https://github.com/TheAlgorithms/Javascript/blob/master/String/DiceCoefficient.js)
* [FormatPhoneNumber](https://github.com/TheAlgorithms/Javascript/blob/master/String/FormatPhoneNumber.js)
@ -303,6 +305,7 @@
* [HammingDistance](https://github.com/TheAlgorithms/Javascript/blob/master/String/HammingDistance.js)
* [KMPPatternSearching](https://github.com/TheAlgorithms/Javascript/blob/master/String/KMPPatternSearching.js)
* [LevenshteinDistance](https://github.com/TheAlgorithms/Javascript/blob/master/String/LevenshteinDistance.js)
* [Lower](https://github.com/TheAlgorithms/Javascript/blob/master/String/Lower.js)
* [MaxCharacter](https://github.com/TheAlgorithms/Javascript/blob/master/String/MaxCharacter.js)
* [MaxWord](https://github.com/TheAlgorithms/Javascript/blob/master/String/MaxWord.js)
* [PatternMatching](https://github.com/TheAlgorithms/Javascript/blob/master/String/PatternMatching.js)
@ -310,8 +313,10 @@
* [ReverseString](https://github.com/TheAlgorithms/Javascript/blob/master/String/ReverseString.js)
* [ReverseWords](https://github.com/TheAlgorithms/Javascript/blob/master/String/ReverseWords.js)
* [ScrambleStrings](https://github.com/TheAlgorithms/Javascript/blob/master/String/ScrambleStrings.js)
* [Upper](https://github.com/TheAlgorithms/Javascript/blob/master/String/Upper.js)
* [ValidateCreditCard](https://github.com/TheAlgorithms/Javascript/blob/master/String/ValidateCreditCard.js)
* [ValidateEmail](https://github.com/TheAlgorithms/Javascript/blob/master/String/ValidateEmail.js)
* [ValidateUrl](https://github.com/TheAlgorithms/Javascript/blob/master/String/ValidateUrl.js)
## Timing-Functions
* [GetMonthDays](https://github.com/TheAlgorithms/Javascript/blob/master/Timing-Functions/GetMonthDays.js)
@ -320,3 +325,4 @@
## Trees
* [BreadthFirstTreeTraversal](https://github.com/TheAlgorithms/Javascript/blob/master/Trees/BreadthFirstTreeTraversal.js)
* [DepthFirstSearch](https://github.com/TheAlgorithms/Javascript/blob/master/Trees/DepthFirstSearch.js)
* [FenwickTree](https://github.com/TheAlgorithms/Javascript/blob/master/Trees/FenwickTree.js)

View File

@ -1,16 +0,0 @@
// program to find sum of digits of a number
// function which would calculate sum and return it
const digitSum = (num) => {
// sum will store sum of digits of a number
let sum = 0
// while will run until num become 0
while (num) {
sum += num % 10
num = parseInt(num / 10)
}
return sum
}
export { digitSum }

View File

@ -1,11 +0,0 @@
import { digitSum } from '../DigitSum'
describe('digitSum', () => {
it('is a function', () => {
expect(typeof digitSum).toEqual('function')
})
it('should return the sum of digits of a given number', () => {
const sumOfNumber = digitSum(12345)
expect(sumOfNumber).toBe(15)
})
})