achrefbs / back-end-test

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

# Javascript backend developer test Your job is to write a command-line interface in your choice langage. ## Filter In the attached file `data.js`, there are `Peoples` containing `Animals`. This option has to filter the Animals by name containing a pattern. The parents level of the element will be displayed to keep the data structure. The order should be kept intact. Empty array after filtering are NOT returned. Sample of running the command, and its output: Here, only animals containing `ry` are displayed. ```shell script $ node app.js --filter=ry [ { name: 'Uzuzozne', people: [ { name: 'Lillie Abbott', animals: [ { name: 'John Dory' } ] } ] }, { name: 'Satanwi', people: [ { name: 'Anthony Bruno', animals: [ { name: 'Oryx' } ] } ] } ] ``` ## Count The next goal is to print the counts of People and Animals by counting the number of children at each level of the arborescence and appending it in the name, eg. `Satanwi [2]`. Sample of running the command, and its output: ```shell script node app.js --count [ { name: 'Dillauti [16]', people: [ { name: 'Winifred Graham [6]', animals: [ { name: 'Anoa' }, { name: 'Duck' }, { name: 'Narwhal' }, { name: 'Badger' }, { name: 'Cobra' }, { name: 'Crow' } ] }, { name: 'Blanche Viciani [8]', animals: [ { name: 'Barbet' }, { name: 'Rhea' }, { name: 'Snakes' }, { name: 'Antelope' }, { name: 'Echidna' }, { name: 'Crow' }, { name: 'Guinea Fowl' }, { name: 'Deer Mouse' } ] }, ... ... ] ``` ## Requirements - The code must be available in a GIT repository - No library/modules should be used, except for the testing library ## Appreciation We will be really attentive to: - Code readability, structure and consistency - Tests, and how they are written - Overall App structure for production usage # back-end-test

About


Languages

Language:JavaScript 100.0%