Geocodio/geocodio-library-node

Keyed dictionary fails as input

Closed this issue · 1 comments

Attempting to use a keyed dictionary as input fails:

Example from the library documentation:

// Optionally supply a custom key that will be returned along with results
geocoder.geocode({
      'MyId1': '1109 N Highland St, Arlington VA',
      'MyId2': '525 University Ave, Toronto, ON, Canada',
      'MyId3': '4410 S Highway 17 92, Casselberry FL',
      'MyId4': '15000 NE 24th Street, Redmond WA',
      'MyId5': '17015 Walnut Grove Drive, Morgan Hill CA'
  })
  .then(response => { ... })
  .catch(err => { ... });

UnhandledPromiseRejectionWarning: TypeError: query.map is not a function
at Geocodio.handleRequest (/Users/j...../node_modules/geocodio-library-node/lib/index.js:54:21)
at Geocodio.geocode (/Users/j...../node_modules/geocodio-library-node/lib/index.js:29:17)

But passing a single address or an array of address strings works.

Thanks so much for flagging this. It was indeed not working as intended.

I have added a test case along with a fix for this. This is released as v1.1.0 of the library.