/algorithms-with-es6

Just a bunch of algorithms using Javascript with ES6

Primary LanguageJavaScript

Algorithms with ES6

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:

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 make any changes and add your test to __tests__ folder run the test command
$ npm test
  1. To build from ES6 to ES5:
$ gulp build

Enjoy! 👻