Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}, function (error, response, body) {
if(error) {
geoclient.reject('[GEOCLIENT ERROR - 0] ' + error);
} else if(!error && response.statusCode === 200) {
// check out the response
var json = JSON.parse(body).address;
// address not found in geoclient
if(json.geosupportReturnCode !== '00' && json.geosupportReturnCode !== '01') {
geoclient.reject('[GEOCLIENT ERROR - 1] ' + json.message);
} else if(!json.bbl || json.bbl === '' ||
!json.latitudeInternalLabel || json.latitudeInternalLabel === '' ||
!json.longitudeInternalLabel || json.longitudeInternalLabel === '') {
rollbar.reportMessageWithPayloadData("Geoclient failed.", { level: "warning", addr: addr, boro: boro });
}
// address found in geoclient
var geo = {
bbl : json.bbl,
lon : json.longitudeInternalLabel,
lat : json.latitudeInternalLabel,
streetNum : json.houseNumber,
streetName : json.streetName1In,
bCode : json.boroughCode1In,
bUSPS : json.uspsPreferredCityName,
zip : json.zipCode,
cd: json.communityDistrict,
bin : json.giBuildingIdentificationNumber1
};
geoclient.resolve(geo);