Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const geojsonify = require('../../../helper/geojsonify');
const proxyquire = require('proxyquire').noCallThru();
const codec = require('pelias-model').codec;
module.exports.tests = {};
module.exports.tests.interface = function(test, common) {
test('valid interface', function(t) {
t.equal(typeof geojsonify, 'function', 'geojsonify is a function');
t.equal(geojsonify.length, 2, 'accepts x arguments');
t.end();
});
};
// ensure null island coordinates work
// ref: https://github.com/pelias/pelias/issues/84
module.exports.tests.earth = function(test, common) {
test('earth', function(t) {
var earth = [{
const GeoJSON = require('geojson');
const extent = require('@mapbox/geojson-extent');
const logger = require('pelias-logger').get('geojsonify');
const collectDetails = require('./geojsonify_place_details');
const _ = require('lodash');
const Document = require('pelias-model').Document;
const codec = require('pelias-model').codec;
const field = require('./fieldValue');
const decode_gid = require('./decode_gid');
function geojsonifyPlaces( params, docs ){
// flatten & expand data for geojson conversion
const geodata = docs
.filter(doc => {
if (!_.has(doc, 'center_point')) {
logger.warn('No doc or center_point property');
return false;
} else {
return true;
}
})
.map(geojsonifyPlace.bind(null, params));