mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-15 21:48:20 +02:00
Remove unused deprecate_tags action
This commit is contained in:
@@ -1,45 +0,0 @@
|
||||
import _assign from 'lodash-es/assign';
|
||||
import _clone from 'lodash-es/clone';
|
||||
import _omit from 'lodash-es/omit';
|
||||
import _toPairs from 'lodash-es/toPairs';
|
||||
|
||||
import { dataDeprecated } from '../../data';
|
||||
|
||||
|
||||
export function actionDeprecateTags(entityId) {
|
||||
|
||||
return function(graph) {
|
||||
var entity = graph.entity(entityId),
|
||||
newtags = _clone(entity.tags),
|
||||
change = false,
|
||||
rule;
|
||||
|
||||
// This handles dataDeprecated tags with a single condition
|
||||
for (var i = 0; i < dataDeprecated.length; i++) {
|
||||
|
||||
rule = dataDeprecated[i];
|
||||
var match = _toPairs(rule.old)[0],
|
||||
replacements = rule.replace ? _toPairs(rule.replace) : null;
|
||||
|
||||
if (entity.tags[match[0]] && match[1] === '*') {
|
||||
|
||||
var value = entity.tags[match[0]];
|
||||
if (replacements && !newtags[replacements[0][0]]) {
|
||||
newtags[replacements[0][0]] = value;
|
||||
}
|
||||
delete newtags[match[0]];
|
||||
change = true;
|
||||
|
||||
} else if (entity.tags[match[0]] === match[1]) {
|
||||
newtags = _assign({}, rule.replace || {}, _omit(newtags, match[0]));
|
||||
change = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (change) {
|
||||
return graph.replace(entity.update({tags: newtags}));
|
||||
} else {
|
||||
return graph;
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -13,7 +13,6 @@ export { actionDeleteMultiple } from './delete_multiple';
|
||||
export { actionDeleteNode } from './delete_node';
|
||||
export { actionDeleteRelation } from './delete_relation';
|
||||
export { actionDeleteWay } from './delete_way';
|
||||
export { actionDeprecateTags } from './deprecate_tags';
|
||||
export { actionDiscardTags } from './discard_tags';
|
||||
export { actionDisconnect } from './disconnect';
|
||||
export { actionJoin } from './join';
|
||||
|
||||
Reference in New Issue
Block a user