6 kyu

Visa application centre

Description:

You recently started working in a Visa application office. As the work is boring and repetitive you decide to write some functionality to help you with the job.

Task:

Given an array of objects that represent people, complete the function visa that should return all the people who have been approved.
In other words the function should return the same array back, with the inelligable people removed, and the elligable objects modified.

Each person is represented as an object with the following properties:
firstName (string),
lastName (string),
criminalRecord (boolean),
passportExpiration (string) // format dd.mm.yyyy,
visaType (string) // can be either 'business' or 'tourist'
.

Your job is to filter out all people whose passport expired (passportExpiration property should be at least 90 days from now to be considered valid) and who have a criminal record (criminalRecord should be false).
Every application (object) that meets the requirements should have two additional properties: visaExpiration (string) and
insuranceId (number).
If an applicants visaType is 'business', the visaExpiration should be set to a string in the format dd.mm.yyyy 90 days from now. If, however, the person applied for a 'tourist' visa the same property should be set to 30 days from now.
The insuranceId property is calculated as the sum of ASCII values from all characters in firstName and lastName.

Have fun!

Fundamentals

More By Author:

Check out these other kata created by St3f4n

Stats:

CreatedDec 16, 2016
PublishedDec 16, 2016
Warriors Trained240
Total Skips5
Total Code Submissions2942
Total Times Completed59
JavaScript Completions59
Total Stars13
% of votes with a positive feedback rating74% of 37
Total "Very Satisfied" Votes24
Total "Somewhat Satisfied" Votes7
Total "Not Satisfied" Votes6
Total Rank Assessments9
Average Assessed Rank
6 kyu
Highest Assessed Rank
6 kyu
Lowest Assessed Rank
7 kyu
Ad
Contributors
  • St3f4n Avatar
  • smile67 Avatar
Ad