mirror of
https://github.com/FoggedLens/iD.git
synced 2026-02-12 16:52:50 +00:00
@@ -1,7 +1,6 @@
|
||||
import _cloneDeep from 'lodash-es/cloneDeep';
|
||||
import _debounce from 'lodash-es/debounce';
|
||||
import _each from 'lodash-es/each';
|
||||
import _find from 'lodash-es/find';
|
||||
import _forOwn from 'lodash-es/forOwn';
|
||||
import _isObject from 'lodash-es/isObject';
|
||||
import _isString from 'lodash-es/isString';
|
||||
@@ -145,7 +144,7 @@ export function coreContext() {
|
||||
if (zoomTo !== false) {
|
||||
this.loadEntity(entityID, function(err, result) {
|
||||
if (err) return;
|
||||
var entity = _find(result.data, function(e) { return e.id === entityID; });
|
||||
var entity = result.data.find(function(e) { return e.id === entityID; });
|
||||
if (entity) {
|
||||
map.zoomTo(entity);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import _find from 'lodash-es/find';
|
||||
import _intersection from 'lodash-es/intersection';
|
||||
|
||||
import {
|
||||
@@ -311,7 +310,7 @@ export function modeDragNode(context) {
|
||||
// find active ring and test it for self intersections
|
||||
for (k = 0; k < rings.length; k++) {
|
||||
nodes = rings[k].nodes;
|
||||
if (_find(nodes, function(n) { return n.id === entity.id; })) {
|
||||
if (nodes.find(function(n) { return n.id === entity.id; })) {
|
||||
activeIndex = k;
|
||||
if (geoHasSelfIntersections(nodes, entity.id)) {
|
||||
return true;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import _extend from 'lodash-es/extend';
|
||||
import _filter from 'lodash-es/filter';
|
||||
import _find from 'lodash-es/find';
|
||||
import _map from 'lodash-es/map';
|
||||
|
||||
import { osmEntity } from './entity';
|
||||
@@ -75,7 +74,7 @@ _extend(osmChangeset.prototype, {
|
||||
|
||||
// find a referenced relation in the current changeset
|
||||
function resolve(item) {
|
||||
return _find(relations, function(relation) {
|
||||
return relations.find(function(relation) {
|
||||
return item.keyAttributes.type === 'relation'
|
||||
&& item.keyAttributes.ref === relation['@id'];
|
||||
});
|
||||
@@ -83,14 +82,14 @@ _extend(osmChangeset.prototype, {
|
||||
|
||||
// a new item is an item that has not been already processed
|
||||
function isNew(item) {
|
||||
return !sorted[ item['@id'] ] && !_find(processing, function(proc) {
|
||||
return !sorted[ item['@id'] ] && !processing.find(function(proc) {
|
||||
return proc['@id'] === item['@id'];
|
||||
});
|
||||
}
|
||||
|
||||
var processing = [],
|
||||
sorted = {},
|
||||
relations = changes.relation;
|
||||
var processing = [];
|
||||
var sorted = {};
|
||||
var relations = changes.relation;
|
||||
|
||||
if (!relations) return changes;
|
||||
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import _find from 'lodash-es/find';
|
||||
import _findIndex from 'lodash-es/findIndex';
|
||||
import _some from 'lodash-es/some';
|
||||
import _uniq from 'lodash-es/uniq';
|
||||
import _without from 'lodash-es/without';
|
||||
@@ -16,13 +14,13 @@ export function presetCollection(collection) {
|
||||
|
||||
|
||||
item: function(id) {
|
||||
return _find(this.collection, function(d) {
|
||||
return this.collection.find(function(d) {
|
||||
return d.id === id;
|
||||
});
|
||||
},
|
||||
|
||||
index: function(id) {
|
||||
return _findIndex(this.collection, function(d) {
|
||||
return this.collection.findIndex(function(d) {
|
||||
return d.id === id;
|
||||
});
|
||||
},
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import _find from 'lodash-es/find';
|
||||
|
||||
import { dispatch as d3_dispatch } from 'd3-dispatch';
|
||||
import { interpolateNumber as d3_interpolateNumber } from 'd3-interpolate';
|
||||
import { select as d3_select } from 'd3-selection';
|
||||
@@ -277,7 +275,7 @@ export function rendererBackground(context) {
|
||||
|
||||
|
||||
background.findSource = function(id) {
|
||||
return _find(_backgroundSources, function(d) {
|
||||
return _backgroundSources.find(function(d) {
|
||||
return d.id && d.id === id;
|
||||
});
|
||||
};
|
||||
@@ -441,7 +439,7 @@ export function rendererBackground(context) {
|
||||
|
||||
// Decide which background layer to display
|
||||
if (!requested && extent) {
|
||||
best = _find(this.sources(extent), function(s) { return s.best(); });
|
||||
best = this.sources(extent).find(function(s) { return s.best(); });
|
||||
}
|
||||
if (requested && requested.indexOf('custom:') === 0) {
|
||||
template = requested.replace(/^custom:/, '');
|
||||
@@ -458,7 +456,7 @@ export function rendererBackground(context) {
|
||||
);
|
||||
}
|
||||
|
||||
var locator = _find(_backgroundSources, function(d) {
|
||||
var locator = _backgroundSources.find(function(d) {
|
||||
return d.overlay && d.default;
|
||||
});
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import _extend from 'lodash-es/extend';
|
||||
import _find from 'lodash-es/find';
|
||||
import _forEach from 'lodash-es/forEach';
|
||||
|
||||
import rbush from 'rbush';
|
||||
@@ -37,9 +36,7 @@ function abortRequest(i) {
|
||||
|
||||
function abortUnwantedRequests(cache, tiles) {
|
||||
_forEach(cache.inflightTile, function(v, k) {
|
||||
var wanted = _find(tiles, function(tile) {
|
||||
return k === tile.id;
|
||||
});
|
||||
var wanted = tiles.find(function(tile) { return k === tile.id; });
|
||||
if (!wanted) {
|
||||
abortRequest(v);
|
||||
delete cache.inflightTile[k];
|
||||
@@ -481,4 +478,4 @@ export default {
|
||||
getClosedIDs: function() {
|
||||
return Object.keys(_erCache.closed).sort();
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import _extend from 'lodash-es/extend';
|
||||
import _find from 'lodash-es/find';
|
||||
import _forEach from 'lodash-es/forEach';
|
||||
|
||||
import rbush from 'rbush';
|
||||
@@ -42,9 +41,7 @@ function abortRequest(i) {
|
||||
|
||||
function abortUnwantedRequests(cache, tiles) {
|
||||
_forEach(cache.inflightTile, function(v, k) {
|
||||
var wanted = _find(tiles, function(tile) {
|
||||
return k === tile.id;
|
||||
});
|
||||
var wanted = tiles.find(function(tile) { return k === tile.id; });
|
||||
if (!wanted) {
|
||||
abortRequest(v);
|
||||
delete cache.inflightTile[k];
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
/* global Mapillary:false */
|
||||
import _find from 'lodash-es/find';
|
||||
import _forEach from 'lodash-es/forEach';
|
||||
import _some from 'lodash-es/some';
|
||||
import _union from 'lodash-es/union';
|
||||
@@ -55,8 +54,7 @@ function loadTiles(which, url, projection) {
|
||||
// abort inflight requests that are no longer needed
|
||||
var cache = _mlyCache[which];
|
||||
_forEach(cache.inflight, function(v, k) {
|
||||
var wanted = _find(tiles, function(tile) { return k.indexOf(tile.id + ',') === 0; });
|
||||
|
||||
var wanted = tiles.find(function(tile) { return k.indexOf(tile.id + ',') === 0; });
|
||||
if (!wanted) {
|
||||
abortRequest(v);
|
||||
delete cache.inflight[k];
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import _find from 'lodash-es/find';
|
||||
import _forEach from 'lodash-es/forEach';
|
||||
import _union from 'lodash-es/union';
|
||||
|
||||
@@ -20,13 +19,7 @@ import rbush from 'rbush';
|
||||
|
||||
import { geoExtent, geoScaleToZoom } from '../geo';
|
||||
import { utilDetect } from '../util/detect';
|
||||
|
||||
import {
|
||||
utilQsString,
|
||||
utilRebind,
|
||||
utilSetTransform,
|
||||
utilTiler
|
||||
} from '../util';
|
||||
import { utilQsString, utilRebind, utilSetTransform, utilTiler } from '../util';
|
||||
|
||||
|
||||
var apibase = 'https://openstreetcam.org';
|
||||
@@ -65,8 +58,7 @@ function loadTiles(which, url, projection) {
|
||||
// abort inflight requests that are no longer needed
|
||||
var cache = _oscCache[which];
|
||||
_forEach(cache.inflight, function(v, k) {
|
||||
var wanted = _find(tiles, function(tile) { return k.indexOf(tile.id + ',') === 0; });
|
||||
|
||||
var wanted = tiles.find(function(tile) { return k.indexOf(tile.id + ',') === 0; });
|
||||
if (!wanted) {
|
||||
abortRequest(v);
|
||||
delete cache.inflight[k];
|
||||
|
||||
@@ -2,7 +2,6 @@ import _chunk from 'lodash-es/chunk';
|
||||
import _cloneDeep from 'lodash-es/cloneDeep';
|
||||
import _extend from 'lodash-es/extend';
|
||||
import _forEach from 'lodash-es/forEach';
|
||||
import _find from 'lodash-es/find';
|
||||
import _groupBy from 'lodash-es/groupBy';
|
||||
import _isEmpty from 'lodash-es/isEmpty';
|
||||
import _map from 'lodash-es/map';
|
||||
@@ -79,7 +78,7 @@ function abortRequest(i) {
|
||||
|
||||
function abortUnwantedRequests(cache, tiles) {
|
||||
_forEach(cache.inflight, function(v, k) {
|
||||
var wanted = _find(tiles, function(tile) { return k === tile.id; });
|
||||
var wanted = tiles.find(function(tile) { return k === tile.id; });
|
||||
if (!wanted) {
|
||||
abortRequest(v);
|
||||
delete cache.inflight[k];
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import _extend from 'lodash-es/extend';
|
||||
import _find from 'lodash-es/find';
|
||||
import _forEach from 'lodash-es/forEach';
|
||||
import _union from 'lodash-es/union';
|
||||
|
||||
@@ -84,8 +83,7 @@ function loadTiles(which, url, projection, margin) {
|
||||
// abort inflight requests that are no longer needed
|
||||
var cache = _ssCache[which];
|
||||
_forEach(cache.inflight, function(v, k) {
|
||||
var wanted = _find(tiles, function(tile) { return k.indexOf(tile.id + ',') === 0; });
|
||||
|
||||
var wanted = tiles.find(function(tile) { return k.indexOf(tile.id + ',') === 0; });
|
||||
if (!wanted) {
|
||||
abortRequest(v);
|
||||
delete cache.inflight[k];
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import _clone from 'lodash-es/clone';
|
||||
import _find from 'lodash-es/find';
|
||||
import _isEqual from 'lodash-es/isEqual';
|
||||
import _forEach from 'lodash-es/forEach';
|
||||
|
||||
@@ -194,8 +193,7 @@ export default {
|
||||
|
||||
// abort inflight requests that are no longer needed
|
||||
_forEach(source.inflight, function(v, k) {
|
||||
var wanted = _find(tiles, function(tile) { return k === tile.id; });
|
||||
|
||||
var wanted = tiles.find(function(tile) { return k === tile.id; });
|
||||
if (!wanted) {
|
||||
abortRequest(v);
|
||||
delete source.inflight[k];
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
|
||||
import _difference from 'lodash-es/difference';
|
||||
import _find from 'lodash-es/find';
|
||||
import _map from 'lodash-es/map';
|
||||
import _reject from 'lodash-es/reject';
|
||||
|
||||
@@ -78,7 +76,7 @@ export function svgLayers(projection, context) {
|
||||
|
||||
|
||||
drawLayers.layer = function(id) {
|
||||
var obj = _find(layers, function(o) {return o.id === id;});
|
||||
var obj = layers.find(function(o) {return o.id === id;});
|
||||
return obj && obj.layer;
|
||||
};
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import _find from 'lodash-es/find';
|
||||
import _includes from 'lodash-es/includes';
|
||||
import _reduce from 'lodash-es/reduce';
|
||||
import _uniqBy from 'lodash-es/uniqBy';
|
||||
@@ -115,7 +114,7 @@ export function uiFieldAddress(field, context) {
|
||||
function countryCallback(err, countryCode) {
|
||||
if (err) return;
|
||||
|
||||
var addressFormat = _find(dataAddressFormats, function (a) {
|
||||
var addressFormat = dataAddressFormats.find(function (a) {
|
||||
return a && a.countryCodes && _includes(a.countryCodes, countryCode.toLowerCase());
|
||||
}) || dataAddressFormats[0];
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import _filter from 'lodash-es/filter';
|
||||
import _find from 'lodash-es/find';
|
||||
import _map from 'lodash-es/map';
|
||||
import _reject from 'lodash-es/reject';
|
||||
import _remove from 'lodash-es/remove';
|
||||
@@ -75,7 +74,7 @@ export function uiFieldCombo(field, context) {
|
||||
dval = clean(dval || '');
|
||||
|
||||
if (optstrings) {
|
||||
var found = _find(_comboData, function(o) {
|
||||
var found = _comboData.find(function(o) {
|
||||
return o.key && clean(o.value) === dval;
|
||||
});
|
||||
if (found) {
|
||||
@@ -97,7 +96,9 @@ export function uiFieldCombo(field, context) {
|
||||
tval = tval || '';
|
||||
|
||||
if (optstrings) {
|
||||
var found = _find(_comboData, function(o) { return o.key === tval && o.value; });
|
||||
var found = _comboData.find(function(o) {
|
||||
return o.key === tval && o.value;
|
||||
});
|
||||
if (found) {
|
||||
return found.value;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import _find from 'lodash-es/find';
|
||||
|
||||
import { dispatch as d3_dispatch } from 'd3-dispatch';
|
||||
|
||||
import {
|
||||
@@ -302,7 +300,7 @@ export function uiFieldLocalized(field, context) {
|
||||
if (_isLocked) return;
|
||||
|
||||
var defaultLang = utilDetect().locale.toLowerCase().split('-')[0];
|
||||
var langExists = _find(_multilingual, function(datum) { return datum.lang === defaultLang;});
|
||||
var langExists = _multilingual.find(function(datum) { return datum.lang === defaultLang; });
|
||||
var isLangEn = defaultLang.indexOf('en') > -1;
|
||||
if (isLangEn || langExists) {
|
||||
defaultLang = '';
|
||||
@@ -336,7 +334,7 @@ export function uiFieldLocalized(field, context) {
|
||||
function changeLang(d) {
|
||||
var lang = utilGetSetValue(d3_select(this));
|
||||
var t = {};
|
||||
var language = _find(dataWikipedia, function(d) {
|
||||
var language = dataWikipedia.find(function(d) {
|
||||
return d[0].toLowerCase() === lang.toLowerCase() ||
|
||||
d[1].toLowerCase() === lang.toLowerCase();
|
||||
});
|
||||
@@ -467,7 +465,7 @@ export function uiFieldLocalized(field, context) {
|
||||
var entry = selection.selectAll('.entry');
|
||||
|
||||
utilGetSetValue(entry.select('.localized-lang'), function(d) {
|
||||
var lang = _find(dataWikipedia, function(lang) { return lang[2] === d.lang; });
|
||||
var lang = dataWikipedia.find(function(lang) { return lang[2] === d.lang; });
|
||||
return lang ? lang[1] : d.lang;
|
||||
});
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import _clone from 'lodash-es/clone';
|
||||
import _find from 'lodash-es/find';
|
||||
|
||||
import { dispatch as d3_dispatch } from 'd3-dispatch';
|
||||
|
||||
@@ -140,7 +139,7 @@ export function uiFieldWikipedia(field, context) {
|
||||
var value = utilGetSetValue(lang).toLowerCase();
|
||||
var locale = utilDetect().locale.toLowerCase();
|
||||
var localeLanguage;
|
||||
return _find(dataWikipedia, function(d) {
|
||||
return dataWikipedia.find(function(d) {
|
||||
if (d[2] === locale) localeLanguage = d;
|
||||
return d[0].toLowerCase() === value ||
|
||||
d[1].toLowerCase() === value ||
|
||||
@@ -163,7 +162,7 @@ export function uiFieldWikipedia(field, context) {
|
||||
function change(skipWikidata) {
|
||||
var value = utilGetSetValue(title);
|
||||
var m = value.match(/https?:\/\/([-a-z]+)\.wikipedia\.org\/(?:wiki|\1-[-a-z]+)\/([^#]+)(?:#(.+))?/);
|
||||
var l = m && _find(dataWikipedia, function(d) { return m[1] === d[2]; });
|
||||
var l = m && dataWikipedia.find(function(d) { return m[1] === d[2]; });
|
||||
var syncTags = {};
|
||||
|
||||
if (l) {
|
||||
@@ -209,7 +208,7 @@ export function uiFieldWikipedia(field, context) {
|
||||
if (!data || !Object.keys(data).length) return;
|
||||
|
||||
var qids = Object.keys(data);
|
||||
var value = qids && _find(qids, function(id) { return id.match(/^Q\d+$/); });
|
||||
var value = qids && qids.find(function(id) { return id.match(/^Q\d+$/); });
|
||||
var currTags = _clone(context.entity(initEntityID).tags);
|
||||
|
||||
currTags.wikidata = value;
|
||||
@@ -229,7 +228,7 @@ export function uiFieldWikipedia(field, context) {
|
||||
wiki.tags = function(tags) {
|
||||
var value = tags[field.key] || '';
|
||||
var m = value.match(/([^:]+):([^#]+)(?:#(.+))?/);
|
||||
var l = m && _find(dataWikipedia, function(d) { return m[1] === d[2]; });
|
||||
var l = m && dataWikipedia.find(function(d) { return m[1] === d[2]; });
|
||||
var anchor = m && m[3];
|
||||
|
||||
// value in correct format
|
||||
|
||||
Reference in New Issue
Block a user