This is my code in twilio functions,
exports.handler = function (context, event, callback) {
const got = require('got');
const mortgageInfo = event.mortgageInfo;
const mortgage_number = event.mortgage_number;
got('https://cyan-sparrow-7490.twil.io/assets/data6.json').then (response =>{
const mort = JSON.parse(response.body);
let mortgageData = mort;
//Begin filter code
let val = mortgageInfo;
// I think this line here is my problem
let index = mortgageData.map(function(e) { return e.mortgageid.value; }).indexOf(val);
// I think this line here is my problem
//End filter code
let mortgageSpecificData = mortgageData[index];
callback(null,mortgageSpecificData);
});
===========SAMPLE ASSET ==============
===========SAMPLE ASSET ==============
