From 766b68ef7c9d88583bdfb8c4e631b40457fed50c Mon Sep 17 00:00:00 2001 From: Vesa Meskanen Date: Mon, 14 Mar 2016 15:27:04 +0200 Subject: [PATCH] Make street/number flipping configurable pelias_config.api.localization.flipNumberAndStreetCountries can define an array of ISO 3166-1 alpha-3 country codes, for which the street number should come after street name. --- middleware/localNamingConventions.js | 30 +++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/middleware/localNamingConventions.js b/middleware/localNamingConventions.js index 6170cda2..bd158639 100644 --- a/middleware/localNamingConventions.js +++ b/middleware/localNamingConventions.js @@ -1,5 +1,20 @@ +var check = require('check-types'); + +var flipNumberAndStreetCountries = ['DEU', 'FIN', 'SWE', 'NOR', 'DNK', 'ISL']; function setup() { + var api = require('pelias-config').generate().api; + var settings = api.localization; + if (settings && settings.flipNumberAndStreetCountries) { + var countries = settings.flipNumberAndStreetCountries; + for (var i=0; i 'Grolmanstraße 101' function flipNumberAndStreet(place) { var standard = ( place.address.number + ' ' + place.address.street ),