Match any *:direction key, rather than hardcoding a list

This commit is contained in:
Bryan Housel
2017-12-11 15:17:17 -05:00
parent 6b9ccdb45a
commit 2edbcc4b82
2 changed files with 17 additions and 10 deletions
+2 -1
View File
@@ -87,7 +87,8 @@ export function actionReverse(wayId, options) {
// Update the direction based tags as appropriate then return an updated node
return node.update({tags: _transform(node.tags, function(acc, tagValue, tagKey) {
// See if this is a direction tag and reverse (or use existing value if not recognised)
if (tagKey.match(/direction$/) !== null) {
var re = /direction$/;
if (re.test(tagKey)) {
acc[tagKey] = {forward: 'backward', backward: 'forward', left: 'right', right: 'left'}[tagValue] || tagValue;
} else {
// Use the reverseKey method to cater for situations such as traffic_sign:forward=stop