Goal: Obtain an abbreviated version of the elements in the array without losing the content of the items in that array unless it's impossible to achieve it.
Logic: It takes the array elements and find the common pieces from the words to discard those as part of the abbreviation, then it takes that array and uses 5 types of strategies to create the abbreviations:
- Check if removing common pieces of the words was enough.
- Check taking pieces (substrings) of the beginning/end of the array.
- Check if taking substring at the beginning of the joined words works.
- Check if start and end substring of the joined words is enough.
- More methods to be discovered, so creating numbers as keys for now.
Example:
Check
npm run start
Run test:
npm run test
All test are passing, check those for examples.
Structure:
There are two main with all the necessary logic.
Set of files for testing that logic, using Jest