mirror of
https://github.com/FoggedLens/iD.git
synced 2026-06-04 22:18:06 +02:00
refactor isOneWay to properly support bidirectional ways (#10730)
This commit is contained in:
@@ -33,7 +33,7 @@ export { utilHashcode } from './util';
|
||||
export { utilHighlightEntities } from './util';
|
||||
export { utilKeybinding } from './keybinding';
|
||||
export { utilNoAuto } from './util';
|
||||
export { utilObjectOmit } from './object';
|
||||
export { utilObjectOmit, utilCheckTagDictionary } from './object';
|
||||
export { utilCompareIDs } from './util';
|
||||
export { utilOldestID } from './util';
|
||||
export { utilPrefixCSSProperty } from './util';
|
||||
|
||||
@@ -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