Skip to content

ebs-integrator/ebs-fe-internship-test-6

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

EBS Utils

Technologies

  1. ESLint + Prettier
  2. Typescript
  3. TS Compiler
  4. Tests using Mocha/Enzyme

Todo:

(scroll down to see more information about every task)

  1. Create filter function
  2. Create map function
  3. Create find function
  4. Create concat function
  5. Create pipe

All the functions should not use regular filter, map, find and concat, they should be realized using for(), while() and etc ..

filter

  • filters elements of array
const arr = ['spray', 'limit', 'elite', 'exuberant', 'destruction', 'present'];

filter(arr, (item) => item.length > 6); // returns ["exuberant", "destruction", "present"]

map

const arr = ['spray', 'limit'];

map(arr, (item, index) => ({ id: index, name: item })); // returns [{ id: 0, name: 'spray' }, { id: 1, name: 'limit' }]

find

const arr = [
  { id: 0, name: 'spray' },
  { id: 1, name: 'limit' },
];
const id = 1;

find(arr, (item) => item.id === id); // returns { id: 1, name: 'limit' }

concat

const arr1 = ['spray', 'limit', 'elite'];
const arr2 = ['exuberant', 'destruction', 'present'];

concat(arr1, arr2); // returns ['spray', 'limit', 'elite', 'exuberant', 'destruction', 'present']

pipe

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.

About

The test for Intership Javascript Developer (React)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published