@dkudelko

Что за проблема в ответе node.js multi-geocoder TypeError: Expecting a function in instanceof check, but got #Object]?

взял пример из https://www.npmjs.com/package/multi-geocoder
пакет установил.
мой код
var MultiGeocoder = require('multi-geocoder'),
    geocoder = new MultiGeocoder({ provider: 'yandex', coordorder: 'latlong' });

geocoder.geocode(['Moscow', 'New York', 'Paris', 'London'])
    .then(function (res) {
        console.log(res);
    });

в ответе (логе) такая ошибка
{ result: { type: 'FeatureCollection', features: [] },
  errors: 
   [ { request: 'Moscow',
       index: 0,
       reason: [TypeError: Expecting a function in instanceof check, but got #<Object>] },
     { request: 'New York',
       index: 1,
       reason: [TypeError: Expecting a function in instanceof check, but got #<Object>] },
     { request: 'Paris',
       index: 2,
       reason: [TypeError: Expecting a function in instanceof check, but got #<Object>] },
     { request: 'London',
       index: 3,
       reason: [TypeError: Expecting a function in instanceof check, but got #<Object>] } ] }

Не сильно большой спец в node.js чтобы это понять
Может кто подскажет чего не хватает?
Заранее спасибо.
  • Вопрос задан
  • 2750 просмотров
Пригласить эксперта
Ответы на вопрос 1
smanioso
@smanioso
Отмечайте ответы на свои вопросы!
Все прекрасно работает. Вот возвращаемый результат:
$ node geocode.js 
{ result: 
   { type: 'FeatureCollection',
     features: [ [Object], [Object], [Object], [Object] ] },
  errors: [] }

[ { type: 'Feature',
    bbox: [ [Object], [Object] ],
    geometry: { type: 'Point', coordinates: [Object] },
    properties: 
     { name: 'Москва',
       description: 'Россия',
       metaDataProperty: [Object] } },
  { type: 'Feature',
    bbox: [ [Object], [Object] ],
    geometry: { type: 'Point', coordinates: [Object] },
    properties: 
     { name: 'Нью-Йорк',
       description: 'Соединённые Штаты Америки',
       metaDataProperty: [Object] } },
  { type: 'Feature',
    bbox: [ [Object], [Object] ],
    geometry: { type: 'Point', coordinates: [Object] },
    properties: 
     { name: 'Париж',
       description: 'Иль-Де-Франс, Франция',
       metaDataProperty: [Object] } },
  { type: 'Feature',
    bbox: [ [Object], [Object] ],
    geometry: { type: 'Point', coordinates: [Object] },
    properties: 
     { name: 'Лондон',
       description: 'Англия, Великобритания',
       metaDataProperty: [Object] } } ]


Для красоты добавил в вывод:
console.log(res.result.features);
Ответ написан
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы