This is a just a lab to test how it would look classic algorithms written with Ecmascript 6. The code result is incredible, because it resolve a lot of problems that we had when writting Javascript.
The list of Algorithms made by now:
| Algorithm | Description |
|---|---|
| factorial | Factorial algorithm |
| fibonacci | Fibonacci algorithm |
| greatestCommonDivisor | Get the greatest common divisor of two numbers |
| isPrime | Verify if is a prime number |
| permutation | Permutation algorithm |
| simpleCombination | Simple combination algorithm |
| Algorithm | Description |
|---|---|
| flatten | Flatten an array |
| removeFromArr | Remove an item from an array |
| reverse | Reverse an array |
| removeDuplicates | Remove duplicates item in array |
| concat | Concatenate arrays |
| intersection | Intersection between arrays |
| union | Union between arrays |
| Algorithm | Description |
|---|---|
| givenSum | Get two numbers in an array that the sum is equal a other number that is passed as second parameter |
| isPalindrome | Return if word is a palindrome |
| reorderByIndexes | Reorder an array based on other array with indexes |
| reverseStr | Reverses a given string |
You can see the compiled codes at here.
- Make sure to install all modules
$ npm install- After make any changes and add your test to
__tests__folder run the test command
$ npm test- To build from ES6 to ES5:
$ gulp buildEnjoy! 👻