- ESLint + Prettier
- Typescript
- TS Compiler
- Tests using Mocha/Enzyme
(scroll down to see more information about every task)
- Create filter function
- Create map function
- Create find function
- Create concat function
- Create pipe
All the functions should not use regular filter, map, find and concat, they should be realized using for(), while() and etc ..
- filters elements of array
const arr = ['spray', 'limit', 'elite', 'exuberant', 'destruction', 'present'];
filter(arr, (item) => item.length > 6); // returns ["exuberant", "destruction", "present"]
const arr = ['spray', 'limit'];
map(arr, (item, index) => ({ id: index, name: item })); // returns [{ id: 0, name: 'spray' }, { id: 1, name: 'limit' }]
const arr = [
{ id: 0, name: 'spray' },
{ id: 1, name: 'limit' },
];
const id = 1;
find(arr, (item) => item.id === id); // returns { id: 1, name: 'limit' }
const arr1 = ['spray', 'limit', 'elite'];
const arr2 = ['exuberant', 'destruction', 'present'];
concat(arr1, arr2); // returns ['spray', 'limit', 'elite', 'exuberant', 'destruction', 'present']
const arr = ['spray', 'limit', 'elite', 'exuberant', 'destruction'];
pipe(arr, [
filter((item) => item.length > 6), // returns ["exuberant", "destruction"]
map((item, index) => ({ id: index, name: item })), // returns [{ id: 0, name: 'exuberant' }, { id: 1, name: 'destruction' }]
]);
// pipe returns [{ id: 0, name: 'exuberant' }, { id: 1, name: 'destruction' }]
- Noticed that all the functions such as filter, map, find and concat should not expect first argument (array) in case when they're in pipe, it should be passed automatically.