UNPKG

@goparrot/geocoder

Version:

TypeScript GeoCoder, node geocoding library, supports google maps, mapquest, here, open street map, tom tom

17 lines 780 B
import { GoogleMapsLocationTransformer } from '../../transformer'; import { GoogleMapsCommonCommandMixin } from './google-maps-common-command.mixin'; export function GoogleMapsLocationCommandMixin(Base) { class GoogleMapsLocationCommand extends GoogleMapsCommonCommandMixin(Base) { async parseResponse(response) { if (!Array.isArray(response.data.results) || !response.data.results.length) { return []; } return Promise.all(response.data.results.map(async (raw) => this.parseOneResult(raw))); } async parseOneResult(raw) { return new GoogleMapsLocationTransformer(raw); } } return GoogleMapsLocationCommand; } //# sourceMappingURL=google-maps-location-command.mixin.js.map