/algorithms-with-es6

Just a bunch of algorithms using Javascript with ES6

Primary LanguageJavaScript

Algorithms with ES6

This is just a lab to test how classic algorithms written in Ecmascript 6 would look like. The code result is incredible, because it resolves a lot of problems that we used to have while writting Javascript.

The list of Algorithms so far:

Math Expressions

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

Array functions

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

Interview Questions

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.

How to run

  1. Make sure to install all modules
$ npm install
  1. After making any changes, add your tests to __tests__ folder and run the test command
$ npm test
  1. To build from ES6 to ES5:
$ gulp build

Enjoy! 👻