mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-30 03:39:36 +02:00
refactor isOneWay to properly support bidirectional ways (#10730)
This commit is contained in:
@@ -7,3 +7,26 @@ export function utilObjectOmit(obj, omitKeys) {
|
||||
return result;
|
||||
}, {});
|
||||
}
|
||||
|
||||
/**
|
||||
* @template T
|
||||
* @typedef {{ [key: string]: { [value: string]: T } }} TagDictionary<T>
|
||||
*/
|
||||
|
||||
/**
|
||||
* searches a dictionary for a match, such as `osmOneWayForwardTags`,
|
||||
* `osmAreaKeysExceptions`, etc.
|
||||
* @template T
|
||||
* @param {Tags} tags
|
||||
* @param {TagDictionary<T>} tagDictionary
|
||||
* @returns {T | undefined}
|
||||
*/
|
||||
export function utilCheckTagDictionary(tags, tagDictionary) {
|
||||
for (const key in tags) {
|
||||
const value = tags[key];
|
||||
if (tagDictionary[key] && value in tagDictionary[key]) {
|
||||
return tagDictionary[key][value];
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user