for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
const targets = Array.from(document.body.querySelectorAll('input[data-mapsfield=mapsfield]'));
const latField = document.getElementById('GoogleMapsLatField');
const lngField = document.getElementById('GoogleMapsLngField');
let options = {};
let autoComplete;
const fillAddress = () => {
const location = autoComplete.getPlace();
const components = location.address_components;
latField.setAttribute('value', location.geometry.location.lat());
lngField.setAttribute('value', location.geometry.location.lng());
components.forEach((component) => {
component.types.forEach((type) => {
const field = document.getElementById(type);
if (field) {
field.setAttribute('value', component.long_name);
}
});
};
const mountMapsField = (mapsfield) => {
options = Object.assign(options, window.customisations);
autoComplete = new google.maps.places.Autocomplete(mapsfield, options);
google
/** global: google */
This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.
To learn more about declaring variables in Javascript, see the MDN.
autoComplete.addListener('place_changed', fillAddress);
export default function() {
targets.forEach(mountMapsField);
This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.
To learn more about declaring variables in Javascript, see the MDN.