This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//ES6 | |
var flatten = { | |
makeFlat : function(arr) { | |
var res = []; | |
for (var i = 0; i < arr.length; i++) { | |
if (arr[i] instanceof Array) { //if the current position is an array then we keep looking for a value. | |
res.push.apply(res, this.makeFlat(arr[i])); //recursively calls makeFlat and concatenates with res. | |
} else { | |
res.push(arr[i]); //when is not an array, directly concatenate the value |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//31.01.2000 | |
// startDateOfContract = parameter | |
//customerAgeWhenContractEnd = parameter | |
//return end date of the contract = 1 day before the start date at the moment that the customer has the age he picked. | |
const calculateEndDateOfContract = (customerBirthDate, startDateOfContract, customerAgeWhenContractEnd) => { | |
customerBirthDate = splitDate(customerBirthDate); | |
startDateOfContract = splitDate(startDateOfContract); | |
let endContractDate = new Date(customerBirthDate.year + customerAgeWhenContractEnd, startDateOfContract.month - 1, startDateOfContract.day - 1); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// We support the GET, POST, HEAD, and OPTIONS methods from any origin, | |
// and allow any header on requests. These headers must be present | |
// on all responses to all CORS preflight requests. In practice, this means | |
// all responses to OPTIONS requests. | |
const corsHeaders = { | |
"Access-Control-Allow-Origin": "*", | |
"Access-Control-Allow-Methods": "GET,HEAD,POST,OPTIONS", | |
"Access-Control-Max-Age": "86400", | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export default [ | |
{ | |
"symbol": "€", | |
"name": "Euro", | |
"symbol_native": "€", | |
"code": "EUR", | |
"emoji": "🇪🇺" | |
}, | |
{ | |
"symbol": "$", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"currencies": [ | |
{ | |
"symbol": "€", | |
"name": "Euro", | |
"symbol_native": "€", | |
"code": "EUR", | |
"emoji": "🇪🇺" | |
}, | |
{ |