mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-17 22:24:49 +02:00
+1
-2
@@ -5,7 +5,6 @@ const _forEach = requireESM('lodash-es/forEach').default;
|
||||
const _isEmpty = requireESM('lodash-es/isEmpty').default;
|
||||
const _merge = requireESM('lodash-es/merge').default;
|
||||
const _toPairs = requireESM('lodash-es/toPairs').default;
|
||||
const _filter = requireESM('lodash-es/filter').default;
|
||||
|
||||
const colors = require('colors/safe');
|
||||
const fs = require('fs');
|
||||
@@ -561,7 +560,7 @@ function validatePresetFields(presets, fields) {
|
||||
if (fieldCount > maxFieldsBeforeWarning) {
|
||||
// Fields with `prerequisiteTag` probably won't show up initially,
|
||||
// so don't count them against the limits.
|
||||
var fieldsWithoutPrerequisites = _filter(preset.fields, function(fieldID) {
|
||||
var fieldsWithoutPrerequisites = preset.fields.filter(function(fieldID) {
|
||||
if (fields[fieldID] && fields[fieldID].prerequisiteTag) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import _every from 'lodash-es/every';
|
||||
import _filter from 'lodash-es/filter';
|
||||
import _intersection from 'lodash-es/intersection';
|
||||
import _isEqual from 'lodash-es/isEqual';
|
||||
import _map from 'lodash-es/map';
|
||||
@@ -34,7 +32,7 @@ export function actionMove(moveIds, tryDelta, projection, cache) {
|
||||
if (parents.length < 3) return true;
|
||||
|
||||
// Restrict movement of a vertex where >2 ways meet, unless all parentWays are moving too..
|
||||
var parentsMoving = _every(parents, function(id) { return cache.moving[id]; });
|
||||
var parentsMoving = parents.every(function(id) { return cache.moving[id]; });
|
||||
if (!parentsMoving) delete cache.moving[nodeId];
|
||||
|
||||
return parentsMoving;
|
||||
@@ -118,7 +116,7 @@ export function actionMove(moveIds, tryDelta, projection, cache) {
|
||||
|
||||
cacheEntities(moveIds);
|
||||
cacheIntersections(cache.ways);
|
||||
cache.nodes = _filter(cache.nodes, canMove);
|
||||
cache.nodes = cache.nodes.filter(canMove);
|
||||
|
||||
cache.ok = true;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import _cloneDeep from 'lodash-es/cloneDeep';
|
||||
import _cloneDeepWith from 'lodash-es/cloneDeepWith';
|
||||
import _difference from 'lodash-es/difference';
|
||||
import _filter from 'lodash-es/filter';
|
||||
import _flatten from 'lodash-es/flatten';
|
||||
import _groupBy from 'lodash-es/groupBy';
|
||||
import _isFunction from 'lodash-es/isFunction';
|
||||
@@ -502,7 +501,8 @@ export function coreHistory(context) {
|
||||
// childnodes that would normally have been downloaded with it.. #2142
|
||||
if (loadChildNodes) {
|
||||
var osm = context.connection();
|
||||
var nodes = _flatten(_uniq(_map(_filter(baseEntities, { type: 'way' }), 'nodes')));
|
||||
var baseWays = baseEntities.filter(function(e) { return e.type === 'way'; });
|
||||
var nodes = _flatten(_uniq(_map(baseWays, 'nodes')));
|
||||
var missing = _reject(nodes, function(n) { return _stack[0].graph.hasEntity(n); });
|
||||
|
||||
if (!_isEmpty(missing) && osm) {
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import _isFunction from 'lodash-es/isFunction';
|
||||
import _filter from 'lodash-es/filter';
|
||||
import _flatten from 'lodash-es/flatten';
|
||||
import _flattenDeep from 'lodash-es/flattenDeep';
|
||||
import _uniq from 'lodash-es/uniq';
|
||||
@@ -18,14 +16,15 @@ export function coreValidator(context) {
|
||||
var self = {};
|
||||
var _issues = [];
|
||||
var _issuesByEntityID = {};
|
||||
|
||||
var _disabledValidations = {};
|
||||
|
||||
var validations = _filter(Validations, _isFunction).reduce(function(obj, validation) {
|
||||
var func = validation();
|
||||
obj[func.type] = func;
|
||||
return obj;
|
||||
}, {});
|
||||
var validations = {};
|
||||
Object.values(Validations).forEach(function(validation) {
|
||||
if (typeof validation === 'function') {
|
||||
var fn = validation();
|
||||
validations[fn.type] = fn;
|
||||
}
|
||||
});
|
||||
|
||||
var entityValidationIDs = [];
|
||||
var changesValidationIDs = [];
|
||||
@@ -121,7 +120,7 @@ export function coreValidator(context) {
|
||||
}
|
||||
|
||||
runValidation('missing_role');
|
||||
|
||||
|
||||
if (entity.type === 'relation') {
|
||||
if (!runValidation('old_multipolygon')) {
|
||||
// don't flag missing tags if they are on the outer way
|
||||
|
||||
+1
-3
@@ -1,5 +1,3 @@
|
||||
import _every from 'lodash-es/every';
|
||||
|
||||
import {
|
||||
geoVecAngle,
|
||||
geoVecCross,
|
||||
@@ -257,7 +255,7 @@ export function geoPointInPolygon(point, polygon) {
|
||||
|
||||
|
||||
export function geoPolygonContainsPolygon(outer, inner) {
|
||||
return _every(inner, function(point) {
|
||||
return inner.every(function(point) {
|
||||
return geoPointInPolygon(point, outer);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import _filter from 'lodash-es/filter';
|
||||
import _map from 'lodash-es/map';
|
||||
import _reduce from 'lodash-es/reduce';
|
||||
import _union from 'lodash-es/union';
|
||||
@@ -132,7 +131,10 @@ export function modeSave(context) {
|
||||
|
||||
// Do the full (slow) conflict check..
|
||||
} else {
|
||||
var modified = _filter(history.difference().summary(), { changeType: 'modified' });
|
||||
var summary = history.difference().summary();
|
||||
var modified = summary.filter(function(item) {
|
||||
return item.changeType === 'modified';
|
||||
});
|
||||
_toCheck = _map(_map(modified, 'entity'), 'id');
|
||||
_toLoad = withChildNodes(_toCheck, localGraph);
|
||||
_loaded = {};
|
||||
@@ -156,8 +158,10 @@ export function modeSave(context) {
|
||||
var entity = graph.entity(id);
|
||||
if (entity.type === 'way') {
|
||||
try {
|
||||
var children = graph.childNodes(entity);
|
||||
result.push.apply(result, _map(_filter(children, 'version'), 'id'));
|
||||
var children = graph.childNodes(entity)
|
||||
.filter(function(child) { return child.version !== undefined; });
|
||||
|
||||
result.push.apply(result, _map(children, 'id'));
|
||||
} catch (err) {
|
||||
/* eslint-disable no-console */
|
||||
if (typeof console !== 'undefined') console.error(err);
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import _filter from 'lodash-es/filter';
|
||||
import _without from 'lodash-es/without';
|
||||
|
||||
import { t } from '../util/locale';
|
||||
@@ -7,12 +6,12 @@ import { behaviorOperation } from '../behavior/index';
|
||||
|
||||
|
||||
export function operationDisconnect(selectedIDs, context) {
|
||||
var vertices = _filter(selectedIDs, function(entityId) {
|
||||
var vertices = selectedIDs.filter(function(entityId) {
|
||||
return context.geometry(entityId) === 'vertex';
|
||||
});
|
||||
|
||||
var entityId = vertices[0],
|
||||
action = actionDisconnect(entityId);
|
||||
var entityId = vertices[0];
|
||||
var action = actionDisconnect(entityId);
|
||||
|
||||
if (selectedIDs.length > 1) {
|
||||
action.limitWays(_without(selectedIDs, entityId));
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import _filter from 'lodash-es/filter';
|
||||
import _without from 'lodash-es/without';
|
||||
|
||||
import { t } from '../util/locale';
|
||||
@@ -8,13 +7,13 @@ import { modeSelect } from '../modes/index';
|
||||
|
||||
|
||||
export function operationSplit(selectedIDs, context) {
|
||||
var vertices = _filter(selectedIDs, function(entityId) {
|
||||
var vertices = selectedIDs.filter(function(entityId) {
|
||||
return context.geometry(entityId) === 'vertex';
|
||||
});
|
||||
|
||||
var entityId = vertices[0],
|
||||
action = actionSplit(entityId),
|
||||
ways = [];
|
||||
var entityId = vertices[0];
|
||||
var action = actionSplit(entityId);
|
||||
var ways = [];
|
||||
|
||||
if (vertices.length === 1) {
|
||||
if (selectedIDs.length > 1) {
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import _filter from 'lodash-es/filter';
|
||||
import _map from 'lodash-es/map';
|
||||
|
||||
import { osmEntity } from './entity';
|
||||
@@ -102,7 +101,7 @@ Object.assign(osmChangeset.prototype, {
|
||||
|
||||
while (processing.length > 0) {
|
||||
var next = processing[0],
|
||||
deps = _filter(next.member.map(resolve).filter(Boolean), isNew);
|
||||
deps = next.member.map(resolve).filter(Boolean).filter(isNew);
|
||||
if (deps.length === 0) {
|
||||
sorted[next['@id']] = next;
|
||||
processing.shift();
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import _every from 'lodash-es/every';
|
||||
import _union from 'lodash-es/union';
|
||||
import _without from 'lodash-es/without';
|
||||
|
||||
@@ -171,7 +170,7 @@ osmEntity.prototype = {
|
||||
|
||||
var deprecated = [];
|
||||
dataDeprecated.forEach(function(d) {
|
||||
var matchesDeprecatedTags = _every(Object.keys(d.old), function(key) {
|
||||
var matchesDeprecatedTags = Object.keys(d.old).every(function(key) {
|
||||
if (!tags[key]) return false;
|
||||
if (d.old[key] === '*') return true;
|
||||
|
||||
@@ -183,7 +182,7 @@ osmEntity.prototype = {
|
||||
} else {
|
||||
if (tags[key] === d.old[key]) {
|
||||
if (d.old[key] === d.replace[key]) {
|
||||
return !_every(Object.keys(d.replace), function(key) {
|
||||
return !Object.keys(d.replace).every(function(key) {
|
||||
return tags[key] === d.replace[key];
|
||||
});
|
||||
} else {
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import _isMatch from 'lodash-es/isMatch';
|
||||
import _intersection from 'lodash-es/intersection';
|
||||
import _reduce from 'lodash-es/reduce';
|
||||
import _every from 'lodash-es/every';
|
||||
import { areaKeys } from '../core/context';
|
||||
|
||||
import {
|
||||
@@ -201,7 +200,7 @@ export default {
|
||||
checks: this.filterRuleChecks(selector),
|
||||
// true if all conditions for a tag error are true..
|
||||
matches: function(entity) {
|
||||
return _every(this.checks, function(check) {
|
||||
return this.checks.every(function(check) {
|
||||
return check(entity.tags);
|
||||
});
|
||||
},
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import _groupBy from 'lodash-es/groupBy';
|
||||
import _filter from 'lodash-es/filter';
|
||||
import _flatten from 'lodash-es/flatten';
|
||||
import _forOwn from 'lodash-es/forOwn';
|
||||
import _map from 'lodash-es/map';
|
||||
@@ -211,7 +210,7 @@ export function svgLines(projection, context) {
|
||||
pathdata = _groupBy(ways, function(way) { return way.layer(); });
|
||||
|
||||
_forOwn(pathdata, function(v, k) {
|
||||
var onewayArr = _filter(v, function(d) { return d.isOneWay(); });
|
||||
var onewayArr = v.filter(function(d) { return d.isOneWay(); });
|
||||
var onewaySegments = svgMarkerSegments(
|
||||
projection, graph, 35,
|
||||
function shouldReverse(entity) { return entity.tags.oneway === '-1'; },
|
||||
@@ -221,7 +220,7 @@ export function svgLines(projection, context) {
|
||||
);
|
||||
onewaydata[k] = _flatten(_map(onewayArr, onewaySegments));
|
||||
|
||||
var sidedArr = _filter(v, function(d) { return d.isSided(); });
|
||||
var sidedArr = v.filter(function(d) { return d.isSided(); });
|
||||
var sidedSegments = svgMarkerSegments(
|
||||
projection, graph, 30,
|
||||
function shouldReverse() { return false; },
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import _filter from 'lodash-es/filter';
|
||||
import _map from 'lodash-es/map';
|
||||
import _reject from 'lodash-es/reject';
|
||||
import _remove from 'lodash-es/remove';
|
||||
@@ -185,7 +184,7 @@ export function uiFieldCombo(field, context) {
|
||||
taginfo[fn](params, function(err, data) {
|
||||
if (err) return;
|
||||
if (hasCountryPrefix) {
|
||||
data = _filter(data, function(d) {
|
||||
data = data.filter(function(d) {
|
||||
return d.value.toLowerCase().indexOf(_country + ':') === 0;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import _filter from 'lodash-es/filter';
|
||||
|
||||
import { t } from '../../util/locale';
|
||||
import { svgIcon } from '../../svg';
|
||||
import { utilDetect } from '../../util/detect';
|
||||
@@ -104,7 +102,8 @@ export function uiPanelHistory(context) {
|
||||
selected = [ t('note.note') + ' ' + selectedNoteID ];
|
||||
note = osm.getNote(selectedNoteID);
|
||||
} else { // selected 1..n entities
|
||||
selected = _filter(context.selectedIDs(), function(e) { return context.hasEntity(e); });
|
||||
selected = context.selectedIDs()
|
||||
.filter(function(e) { return context.hasEntity(e); });
|
||||
if (selected.length) {
|
||||
entity = context.entity(selected[0]);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import _filter from 'lodash-es/filter';
|
||||
|
||||
import { event as d3_event } from 'd3-selection';
|
||||
|
||||
import {
|
||||
@@ -15,8 +13,8 @@ import { services } from '../../services';
|
||||
|
||||
|
||||
export function uiPanelMeasurement(context) {
|
||||
var locale = utilDetect().locale,
|
||||
isImperial = (locale.toLowerCase() === 'en-us');
|
||||
var locale = utilDetect().locale;
|
||||
var isImperial = (locale.toLowerCase() === 'en-us');
|
||||
|
||||
|
||||
function radiansToMeters(r) {
|
||||
@@ -65,7 +63,8 @@ export function uiPanelMeasurement(context) {
|
||||
|
||||
} else { // selected 1..n entities
|
||||
var extent = geoExtent();
|
||||
selected = _filter(context.selectedIDs(), function(e) { return context.hasEntity(e); });
|
||||
selected = context.selectedIDs()
|
||||
.filter(function(e) { return context.hasEntity(e); });
|
||||
if (selected.length) {
|
||||
for (var i = 0; i < selected.length; i++) {
|
||||
entity = context.entity(selected[i]);
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import _filter from 'lodash-es/filter';
|
||||
import _groupBy from 'lodash-es/groupBy';
|
||||
|
||||
import {
|
||||
@@ -120,10 +119,8 @@ export function uiRawMembershipEditor(context) {
|
||||
});
|
||||
|
||||
// Dedupe identical names by appending relation id - see #2891
|
||||
var dupeGroups = _filter(
|
||||
_groupBy(result, 'value'),
|
||||
function(v) { return v.length > 1; }
|
||||
);
|
||||
var dupeGroups = _groupBy(result, 'value')
|
||||
.filter(function(v) { return v.length > 1; });
|
||||
|
||||
dupeGroups.forEach(function(group) {
|
||||
group.forEach(function(obj) {
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import _filter from 'lodash-es/filter';
|
||||
|
||||
import { dispatch as d3_dispatch } from 'd3-dispatch';
|
||||
import { select as d3_select } from 'd3-selection';
|
||||
|
||||
@@ -132,7 +130,7 @@ export function uiSuccess(context) {
|
||||
var matchIDs = matchFeatures.map(function(feature) { return feature.id; });
|
||||
|
||||
// Gather community resources that are either global or match a polygon.
|
||||
var matchResources = _filter(data.community.resources, function(v) {
|
||||
var matchResources = data.community.resources.filter(function(v) {
|
||||
return !v.featureId || matchIDs.indexOf(v.featureId) !== -1;
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user