pelias-openstreetmap
Advanced tools
Comparing version 5.11.2 to 5.12.0
{ | ||
"name": "pelias-openstreetmap", | ||
"version": "5.11.2", | ||
"version": "5.12.0", | ||
"engines": { | ||
@@ -5,0 +5,0 @@ "node": ">=10.0.0" |
@@ -65,3 +65,4 @@ | ||
if( val3 ){ | ||
doc.setAddress( ADDRESS_SCHEMA[key], val3 ); | ||
let label = ADDRESS_SCHEMA[key]; | ||
doc.setAddress(label, normalizeAddressField(label, val3)); | ||
} | ||
@@ -153,1 +154,18 @@ } | ||
} | ||
// apply some very basic normalization | ||
// note: in the future we should consider doing something more advanced like: | ||
// https://github.com/pelias/openaddresses/pull/477 | ||
function normalizeAddressField(key, value) { | ||
if (key === 'street') { | ||
// contract English diagonals | ||
value = value | ||
.replace(/\b(northwest)\b/i, 'NW') | ||
.replace(/\b(northeast)\b/i, 'NE') | ||
.replace(/\b(southwest)\b/i, 'SW') | ||
.replace(/\b(southeast)\b/i, 'SE'); | ||
} | ||
return value; | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
67046
1350