Skip to content

Instantly share code, notes, and snippets.

@samin
Last active May 28, 2018 13:33
Show Gist options
  • Save samin/3a75a44d94a8dbd48a95 to your computer and use it in GitHub Desktop.
Save samin/3a75a44d94a8dbd48a95 to your computer and use it in GitHub Desktop.
ClassApp Dev Challenge

Dev Challenge

Create a program in Node.js where the input defined in input.csv is parsed and organised into the content shown in output.json.

Please write your program in only one file (like index.js) and write the output to a file (output.json) instead of printing it to logs or on the screen.

JSON order is not important, but its content is. The program should output the same content (not necessarily the same order) if the input column order is changed. Don't hard code the tags shown, meaning tags could be changed to "email Tio, Reponsável, Financeiro" and it should still parse accordingly.

Some libraries that may be useful, but not required:
https://lodash.com/
https://www.npmjs.com/package/google-libphonenumber

What will we consider? Succinct code, great and descriptive methods and variables, clear thinking skills, efficient code. Code documentation is not really important if your code is simple, easy to read and understand.

Complete this challenge in a maximum of 1 week and send your GitHub public project link to [email protected]

fullname eid class class email Responsável, Pai phone Pai phone Responsável, Mãe email Mãe email Aluno phone Aluno invisible see_all
John Doe 1 1234 Sala 1 / Sala 2 Sala 3 [email protected] :) 11 22221 (11) 38839332 [email protected] [email protected] hahaha 1
John Doe 1 1234 Sala 4 Sala 5, Sala 6 [email protected]/[email protected] 19 985504400 (11) 38839333 11 983340440 yes
Mary Doe 2 1235 Sala 1 [email protected] (11) 98334228 0 no
Victor Doe 3 1236 Sala 6 Sala 7 [email protected] [email protected] [email protected] 19 74430033
[{
"fullname": "John Doe 1",
"eid": "1234",
"classes": [
"Sala 1",
"Sala 2",
"Sala 3",
"Sala 4",
"Sala 5",
"Sala 6"
],
"addresses": [{
"type": "phone",
"tags": [
"Responsável",
"Mãe"
],
"address": "551138839332"
}, {
"type": "email",
"tags": [
"Mãe"
],
"address": "[email protected]"
}, {
"type": "email",
"tags": [
"Aluno"
],
"address": "[email protected]"
}, {
"type": "email",
"tags": [
"Responsável",
"Pai"
],
"address": "[email protected]"
}, {
"type": "email",
"tags": [
"Responsável",
"Pai"
],
"address": "[email protected]"
}, {
"type": "phone",
"tags": [
"Pai"
],
"address": "5519985504400"
}, {
"type": "phone",
"tags": [
"Responsável",
"Mãe"
],
"address": "551138839333"
}],
"invisible": true,
"see_all": true
}, {
"fullname": "Mary Doe 2",
"eid": "1235",
"classes": "Sala 1",
"addresses": [{
"type": "email",
"tags": [
"Responsável",
"Pai"
],
"address": "[email protected]"
}],
"invisible": false,
"see_all": false
}, {
"fullname": "Victor Doe 3",
"eid": "1236",
"classes": [
"Sala 6",
"Sala 7"
],
"addresses": [{
"type": "email",
"tags": [
"Responsável",
"Pai"
],
"address": "[email protected]"
}, {
"type": "email",
"tags": [
"Mãe",
"Aluno"
],
"address": "[email protected]"
}, {
"type": "phone",
"tags": [
"Aluno"
],
"address": "551974430033"
}],
"invisible": false,
"see_all": false
}]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment