Skip to content

Instantly share code, notes, and snippets.

@saleemdev
Created March 11, 2024 08:36
Show Gist options
  • Save saleemdev/2f5ff3ec11950389c55a3ed74aafaf4f to your computer and use it in GitHub Desktop.
Save saleemdev/2f5ff3ec11950389c55a3ed74aafaf4f to your computer and use it in GitHub Desktop.
Interview Prompt - KNS
Read Carefully:
The Office of the Data Protection Commissioner(ODPCC) requires that personally identifiable information MUST be masked.
For example
John Mutua should be presented as Jo** Mu***.
Dates should be masked as follows
2000-01-25
20**-0*-2*
Write a function in python and javascript that returns masked values in a dictionary/JSON object as below
first_name
last_name
date_of_birth
email
Example: Provided this prompt
{
first_name: "Greg",
last_name: "Salama",
date_of_birth: "1990-06-01",
email: "salamander90@gmail.com"
}
Write a function that takes this as input and returns the following:
{
first_name: "Gr**",
last_name: "Sa****",
date_of_birth: "19**-0*-0*",
email: "sa**********@*****.**m"
}
Note: For emails and dates please note that the delimiters @ and - MUST remain in place
Use any Object oriented programming language between : Java, Python and Javascript: The last 2 are preferred.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment