diff --git a/modules/actions/merge_polygon.js b/modules/actions/merge_polygon.js index b3e1ffb24..7f0b6661d 100644 --- a/modules/actions/merge_polygon.js +++ b/modules/actions/merge_polygon.js @@ -2,14 +2,9 @@ import _extend from 'lodash-es/extend'; import _groupBy from 'lodash-es/groupBy'; import _map from 'lodash-es/map'; import _omit from 'lodash-es/omit'; -import _some from 'lodash-es/some'; import { geoPolygonContainsPolygon } from '../geo'; - -import { - osmJoinWays, - osmRelation -} from '../osm'; +import { osmJoinWays, osmRelation } from '../osm'; export function actionMergePolygon(ids, newRelationId) { @@ -55,13 +50,14 @@ export function actionMergePolygon(ids, newRelationId) { if (i === n) return null; return geoPolygonContainsPolygon( _map(d.nodes, 'loc'), - _map(w.nodes, 'loc')); + _map(w.nodes, 'loc') + ); }); }); // Sort all polygons as either outer or inner ways - var members = [], - outer = true; + var members = []; + var outer = true; while (polygons.length) { extractUncontained(polygons); @@ -70,7 +66,7 @@ export function actionMergePolygon(ids, newRelationId) { } function isContained(d, i) { - return _some(contained[i]); + return contained[i].some(function(val) { return val; }); } function filterContained(d) { diff --git a/modules/actions/merge_remote_changes.js b/modules/actions/merge_remote_changes.js index 77fcb7f1a..40cf19035 100644 --- a/modules/actions/merge_remote_changes.js +++ b/modules/actions/merge_remote_changes.js @@ -1,6 +1,5 @@ import _isEqual from 'lodash-es/isEqual'; import _isFunction from 'lodash-es/isFunction'; -import _keys from 'lodash-es/keys'; import _map from 'lodash-es/map'; import _reject from 'lodash-es/reject'; import _union from 'lodash-es/union'; @@ -174,7 +173,7 @@ export function actionMergeRemoteChanges(id, localGraph, remoteGraph, formatUser var o = base.tags || {}; var a = target.tags || {}; var b = remote.tags || {}; - var keys = _reject(_union(_keys(o), _keys(a), _keys(b)), ignoreKey); + var keys = _reject(_union(Object.keys(o), Object.keys(a), Object.keys(b)), ignoreKey); var tags = Object.assign({}, a); // shallow copy var changed = false; diff --git a/modules/actions/split.js b/modules/actions/split.js index ad19e2457..679eead43 100644 --- a/modules/actions/split.js +++ b/modules/actions/split.js @@ -1,17 +1,10 @@ import _extend from 'lodash-es/extend'; import _indexOf from 'lodash-es/indexOf'; import _intersection from 'lodash-es/intersection'; -import _some from 'lodash-es/some'; import { actionAddMember } from './add_member'; import { geoSphericalDistance } from '../geo'; - -import { - osmIsOldMultipolygonOuterMember, - osmRelation, - osmWay -} from '../osm'; - +import { osmIsOldMultipolygonOuterMember, osmRelation, osmWay } from '../osm'; import { utilWrap } from '../util'; @@ -225,7 +218,9 @@ export function actionSplit(nodeId, newWayIds) { action.ways = function(graph) { var node = graph.entity(nodeId); var parents = graph.parentWays(node); - var hasLines = _some(parents, function(parent) { return parent.geometry(graph) === 'line'; }); + var hasLines = parents.some(function(parent) { + return parent.geometry(graph) === 'line'; + }); return parents.filter(function(parent) { if (_wayIDs && _wayIDs.indexOf(parent.id) === -1) diff --git a/modules/geo/geom.js b/modules/geo/geom.js index d9eec87a0..0bb100e3d 100644 --- a/modules/geo/geom.js +++ b/modules/geo/geom.js @@ -1,5 +1,4 @@ import _every from 'lodash-es/every'; -import _some from 'lodash-es/some'; import { geoVecAngle, @@ -266,7 +265,7 @@ export function geoPolygonContainsPolygon(outer, inner) { export function geoPolygonIntersectsPolygon(outer, inner, checkSegments) { function testPoints(outer, inner) { - return _some(inner, function(point) { + return inner.some(function(point) { return geoPointInPolygon(point, outer); }); } diff --git a/modules/operations/delete.js b/modules/operations/delete.js index 820d3cbba..fb0e10b5b 100644 --- a/modules/operations/delete.js +++ b/modules/operations/delete.js @@ -1,5 +1,3 @@ -import _some from 'lodash-es/some'; - import { t } from '../util/locale'; import { actionDeleteMultiple } from '../actions'; import { behaviorOperation } from '../behavior'; @@ -72,11 +70,11 @@ export function operationDelete(selectedIDs, context) { var reason; if (extent.area() && extent.percentContainedIn(context.extent()) < 0.8) { reason = 'too_large'; - } else if (_some(selectedIDs, context.hasHiddenConnections)) { + } else if (selectedIDs.some(context.hasHiddenConnections)) { reason = 'connected_to_hidden'; - } else if (_some(selectedIDs, protectedMember)) { + } else if (selectedIDs.some(protectedMember)) { reason = 'part_of_relation'; - } else if (_some(selectedIDs, incompleteRelation)) { + } else if (selectedIDs.some(incompleteRelation)) { reason = 'incomplete_relation'; } return reason; diff --git a/modules/operations/detach_node.js b/modules/operations/detach_node.js index 268b8554e..5b03e731d 100644 --- a/modules/operations/detach_node.js +++ b/modules/operations/detach_node.js @@ -1,5 +1,3 @@ -import _some from 'lodash-es/some'; - import { actionDetachNode, actionMoveNode } from '../actions'; import { behaviorOperation } from '../behavior'; import { modeMove } from '../modes'; @@ -51,7 +49,7 @@ export function operationDetachNode(selectedIDs, context) { operation.disabled = function () { var reason; - if (_some(selectedIDs, context.hasHiddenConnections)) { + if (selectedIDs.some(context.hasHiddenConnections)) { reason = 'connected_to_hidden'; } return action.disabled(context.graph()) || reason; diff --git a/modules/operations/disconnect.js b/modules/operations/disconnect.js index 14f84538a..21aa783be 100644 --- a/modules/operations/disconnect.js +++ b/modules/operations/disconnect.js @@ -1,5 +1,4 @@ import _filter from 'lodash-es/filter'; -import _some from 'lodash-es/some'; import _without from 'lodash-es/without'; import { t } from '../util/locale'; @@ -32,7 +31,7 @@ export function operationDisconnect(selectedIDs, context) { operation.disabled = function() { var reason; - if (_some(selectedIDs, context.hasHiddenConnections)) { + if (selectedIDs.some(context.hasHiddenConnections)) { reason = 'connected_to_hidden'; } return action.disabled(context.graph()) || reason; diff --git a/modules/operations/move.js b/modules/operations/move.js index a5cc74e7f..d5c587767 100644 --- a/modules/operations/move.js +++ b/modules/operations/move.js @@ -1,5 +1,3 @@ -import _some from 'lodash-es/some'; - import { t } from '../util/locale'; import { behaviorOperation } from '../behavior'; import { geoExtent } from '../geo'; @@ -28,9 +26,9 @@ export function operationMove(selectedIDs, context) { var reason; if (extent.area() && extent.percentContainedIn(context.extent()) < 0.8) { reason = 'too_large'; - } else if (_some(selectedIDs, context.hasHiddenConnections)) { + } else if (selectedIDs.some(context.hasHiddenConnections)) { reason = 'connected_to_hidden'; - } else if (_some(selectedIDs, incompleteRelation)) { + } else if (selectedIDs.some(incompleteRelation)) { reason = 'incomplete_relation'; } return reason; diff --git a/modules/operations/reflect.js b/modules/operations/reflect.js index 09dcd5ad0..312313d8d 100644 --- a/modules/operations/reflect.js +++ b/modules/operations/reflect.js @@ -1,4 +1,3 @@ -import _some from 'lodash-es/some'; import _uniqBy from 'lodash-es/uniqBy'; import { t } from '../util/locale'; @@ -43,9 +42,9 @@ export function operationReflect(selectedIDs, context, axis) { var reason; if (extent.area() && extent.percentContainedIn(context.extent()) < 0.8) { reason = 'too_large'; - } else if (_some(selectedIDs, context.hasHiddenConnections)) { + } else if (selectedIDs.some(context.hasHiddenConnections)) { reason = 'connected_to_hidden'; - } else if (_some(selectedIDs, incompleteRelation)) { + } else if (selectedIDs.some(incompleteRelation)) { reason = 'incomplete_relation'; } return reason; diff --git a/modules/operations/rotate.js b/modules/operations/rotate.js index 75eac55b7..7236d2f54 100644 --- a/modules/operations/rotate.js +++ b/modules/operations/rotate.js @@ -1,4 +1,3 @@ -import _some from 'lodash-es/some'; import _uniqBy from 'lodash-es/uniqBy'; import { t } from '../util/locale'; @@ -30,9 +29,9 @@ export function operationRotate(selectedIDs, context) { var reason; if (extent.area() && extent.percentContainedIn(context.extent()) < 0.8) { reason = 'too_large'; - } else if (_some(selectedIDs, context.hasHiddenConnections)) { + } else if (selectedIDs.some(context.hasHiddenConnections)) { reason = 'connected_to_hidden'; - } else if (_some(selectedIDs, incompleteRelation)) { + } else if (selectedIDs.some(incompleteRelation)) { reason = 'incomplete_relation'; } return reason; diff --git a/modules/operations/split.js b/modules/operations/split.js index 05e8b5558..b3318836b 100644 --- a/modules/operations/split.js +++ b/modules/operations/split.js @@ -1,5 +1,4 @@ import _filter from 'lodash-es/filter'; -import _some from 'lodash-es/some'; import _without from 'lodash-es/without'; import { t } from '../util/locale'; @@ -38,7 +37,7 @@ export function operationSplit(selectedIDs, context) { operation.disabled = function() { var reason; - if (_some(selectedIDs, context.hasHiddenConnections)) { + if (selectedIDs.some(context.hasHiddenConnections)) { reason = 'connected_to_hidden'; } return action.disabled(context.graph()) || reason; diff --git a/modules/osm/entity.js b/modules/osm/entity.js index 3355ab924..b157fb8ae 100644 --- a/modules/osm/entity.js +++ b/modules/osm/entity.js @@ -1,4 +1,3 @@ -import _keys from 'lodash-es/keys'; import _every from 'lodash-es/every'; import _union from 'lodash-es/union'; import _without from 'lodash-es/without'; @@ -152,7 +151,7 @@ osmEntity.prototype = { }, hasInterestingTags: function() { - return _keys(this.tags).some(osmIsInterestingTag); + return Object.keys(this.tags).some(osmIsInterestingTag); }, diff --git a/modules/osm/node.js b/modules/osm/node.js index 956abe554..73e35597e 100644 --- a/modules/osm/node.js +++ b/modules/osm/node.js @@ -1,6 +1,5 @@ import _extend from 'lodash-es/extend'; import _map from 'lodash-es/map'; -import _some from 'lodash-es/some'; import _uniq from 'lodash-es/uniq'; import { osmEntity } from './entity'; @@ -167,12 +166,12 @@ _extend(osmNode.prototype, { } // vertex is connected to multiple parent lines - if (parents.length > 1 && _some(parents, isLine)) { + if (parents.length > 1 && parents.some(isLine)) { return true; } else if (parents.length === 1) { - var way = parents[0], - nodes = way.nodes.slice(); + var way = parents[0]; + var nodes = way.nodes.slice(); if (way.isClosed()) { nodes.pop(); } // ignore connecting node if closed // return true if vertex appears multiple times (way is self intersecting) diff --git a/modules/presets/collection.js b/modules/presets/collection.js index 8697453ca..d1bc06799 100644 --- a/modules/presets/collection.js +++ b/modules/presets/collection.js @@ -1,4 +1,3 @@ -import _some from 'lodash-es/some'; import _uniq from 'lodash-es/uniq'; import _without from 'lodash-es/without'; @@ -99,13 +98,13 @@ export function presetCollection(collection) { // matches value to preset.terms values var leading_terms = searchable .filter(function(a) { - return _some(a.terms() || [], leading); + return (a.terms() || []).some(leading); }); // matches value to preset.tags values var leading_tag_values = searchable .filter(function(a) { - return _some(_without(Object.values(a.tags || {}), '*'), leading); + return _without(Object.values(a.tags || {}), '*').some(leading); }); var leading_suggestions = suggestions @@ -128,7 +127,7 @@ export function presetCollection(collection) { // finds close matches to value in preset.terms var similar_terms = searchable .filter(function(a) { - return _some(a.terms() || [], function(b) { + return (a.terms() || []).some(function(b) { return utilEditDistance(value, b) + Math.min(value.length - b.length, 0) < 3; }); }); diff --git a/modules/renderer/background_source.js b/modules/renderer/background_source.js index 61dd15004..0ee86e797 100644 --- a/modules/renderer/background_source.js +++ b/modules/renderer/background_source.js @@ -1,5 +1,3 @@ -import _some from 'lodash-es/some'; - import { geoArea as d3_geoArea, geoMercatorRaw as d3_geoMercatorRaw @@ -246,7 +244,7 @@ rendererBackgroundSource.Bing = function(data, dispatch) { bing.copyrightNotices = function(zoom, extent) { zoom = Math.min(zoom, 21); return providers.filter(function(provider) { - return _some(provider.areas, function(area) { + return provider.areas.some(function(area) { return extent.intersects(area.extent) && area.zoom[0] <= zoom && area.zoom[1] >= zoom; diff --git a/modules/renderer/features.js b/modules/renderer/features.js index cf44918a9..2bae2d44b 100644 --- a/modules/renderer/features.js +++ b/modules/renderer/features.js @@ -1,6 +1,5 @@ import _groupBy from 'lodash-es/groupBy'; import _reduce from 'lodash-es/reduce'; -import _some from 'lodash-es/some'; import _union from 'lodash-es/union'; import { dispatch as d3_dispatch } from 'd3-dispatch'; @@ -476,9 +475,9 @@ export function rendererFeatures(context) { return resolver.isShared(e) ? _union(result, resolver.parentWays(e)) : result; }, connections); - return connections.length ? _some(connections, function(e) { + return connections.some(function(e) { return features.isHidden(e, resolver, e.geometry(resolver)); - }) : false; + }); }; diff --git a/modules/services/mapillary.js b/modules/services/mapillary.js index f4d41fb30..c5c6888b2 100644 --- a/modules/services/mapillary.js +++ b/modules/services/mapillary.js @@ -1,6 +1,5 @@ /* global Mapillary:false */ import _forEach from 'lodash-es/forEach'; -import _some from 'lodash-es/some'; import _union from 'lodash-es/union'; import { dispatch as d3_dispatch } from 'd3-dispatch'; @@ -535,7 +534,7 @@ export default { // if signs signs are shown, highlight the ones that appear in this image d3_selectAll('.layer-mapillary-signs .icon-sign') .classed('currentView', function(d) { - return _some(d.detections, function(detection) { + return d.detections.some(function(detection) { return detection.image_key === imageKey; }); }); diff --git a/modules/svg/labels.js b/modules/svg/labels.js index 6bda16f47..569cc4f6e 100644 --- a/modules/svg/labels.js +++ b/modules/svg/labels.js @@ -1,5 +1,4 @@ import _map from 'lodash-es/map'; -import _some from 'lodash-es/some'; import _throttle from 'lodash-es/throttle'; import { geoPath as d3_geoPath } from 'd3-geo'; @@ -76,7 +75,7 @@ export function svgLabels(projection, context) { function blacklisted(preset) { var noIcons = ['building', 'landuse', 'natural']; - return _some(noIcons, function(s) { + return noIcons.some(function(s) { return preset.id.indexOf(s) >= 0; }); } @@ -400,7 +399,7 @@ export function svgLabels(projection, context) { entity.isEndpoint(graph) || entity.isConnected(graph) || selectedIDs.indexOf(entity.id) !== -1 || - _some(graph.parentWays(entity), function(parent) { + graph.parentWays(entity).some(function(parent) { return selectedIDs.indexOf(parent.id) !== -1; }); } diff --git a/modules/svg/mapillary_signs.js b/modules/svg/mapillary_signs.js index ff4f06a1a..cffffdce7 100644 --- a/modules/svg/mapillary_signs.js +++ b/modules/svg/mapillary_signs.js @@ -1,4 +1,3 @@ -import _some from 'lodash-es/some'; import _throttle from 'lodash-es/throttle'; import { select as d3_select } from 'd3-selection'; import { svgPointTransform } from './index'; @@ -105,7 +104,7 @@ export function svgMapillarySigns(projection, context, dispatch) { .attr('y', '-12px') .attr('xlink:href', function(d) { return '#' + d.value; }) .classed('currentView', function(d) { - return _some(d.detections, function(detection) { + return d.detections.some(function(detection) { return detection.image_key === selectedImageKey; }); }) diff --git a/modules/ui/field.js b/modules/ui/field.js index b4dc46583..53a962404 100644 --- a/modules/ui/field.js +++ b/modules/ui/field.js @@ -1,5 +1,4 @@ import _extend from 'lodash-es/extend'; -import _some from 'lodash-es/some'; import { dispatch as d3_dispatch } from 'd3-dispatch'; @@ -60,14 +59,14 @@ export function uiField(context, presetField, entity, options) { function isModified() { if (!entity) return false; var original = context.graph().base().entities[entity.id]; - return _some(field.keys, function(key) { + return field.keys.some(function(key) { return original ? _tags[key] !== original.tags[key] : _tags[key]; }); } function isPresent() { - return _some(field.keys, function(key) { + return field.keys.some(function(key) { if (field.type === 'multiCombo') { for (var tagKey in _tags) { if (tagKey.indexOf(key) === 0) { diff --git a/modules/ui/fields/combo.js b/modules/ui/fields/combo.js index 266ddba96..c39831358 100644 --- a/modules/ui/fields/combo.js +++ b/modules/ui/fields/combo.js @@ -2,7 +2,6 @@ import _filter from 'lodash-es/filter'; import _map from 'lodash-es/map'; import _reject from 'lodash-es/reject'; import _remove from 'lodash-es/remove'; -import _some from 'lodash-es/some'; import _uniq from 'lodash-es/uniq'; import { dispatch as d3_dispatch } from 'd3-dispatch'; @@ -114,7 +113,7 @@ export function uiFieldCombo(field, context) { function objectDifference(a, b) { return _reject(a, function(d1) { - return _some(b, function(d2) { return d1.value === d2.value; }); + return b.some(function(d2) { return d1.value === d2.value; }); }); } diff --git a/modules/ui/fields/maxspeed.js b/modules/ui/fields/maxspeed.js index db6017dd7..338cc3541 100644 --- a/modules/ui/fields/maxspeed.js +++ b/modules/ui/fields/maxspeed.js @@ -1,5 +1,3 @@ -import _some from 'lodash-es/some'; - import { dispatch as d3_dispatch } from 'd3-dispatch'; import { select as d3_select } from 'd3-selection'; @@ -59,8 +57,8 @@ export function uiFieldMaxspeed(field, context) { loc = childNodes[~~(childNodes.length/2)].loc; } - _isImperial = _some(dataImperial.features, function(f) { - return _some(f.geometry.coordinates, function(d) { + _isImperial = dataImperial.features.some(function(f) { + return f.geometry.coordinates.some(function(d) { return geoPointInPolygon(loc, d); }); }); diff --git a/modules/ui/intro/line.js b/modules/ui/intro/line.js index 89e64334c..c50cf9bcc 100644 --- a/modules/ui/intro/line.js +++ b/modules/ui/intro/line.js @@ -1,5 +1,3 @@ -import _some from 'lodash-es/some'; - import { dispatch as d3_dispatch } from 'd3-dispatch'; import { @@ -191,8 +189,8 @@ export function uiIntroLine(context, reveal) { if (!entity) return false; var drawNodes = context.graph().childNodes(entity); - return _some(drawNodes, function(node) { - return _some(context.graph().parentWays(node), function(parent) { + return drawNodes.some(function(node) { + return context.graph().parentWays(node).some(function(parent) { return parent.id === flowerRoadID; }); });