diff --git a/modules/actions/merge_remote_changes.js b/modules/actions/merge_remote_changes.js index 358f6a66b..01e940686 100644 --- a/modules/actions/merge_remote_changes.js +++ b/modules/actions/merge_remote_changes.js @@ -1,6 +1,6 @@ import deepEqual from 'fast-deep-equal'; import { diff3Merge } from 'node-diff3'; -import { escape } from 'lodash'; +import { escape } from 'lodash-es'; import { t } from '../core/localizer'; import { actionDeleteMultiple } from './delete_multiple'; diff --git a/modules/osm/tags.js b/modules/osm/tags.js index 959618dce..265f1e8b6 100644 --- a/modules/osm/tags.js +++ b/modules/osm/tags.js @@ -296,7 +296,7 @@ export function isColourValid(value) { } // https://wiki.openstreetmap.org/wiki/Special:WhatLinksHere/Property:P44 -export var osmMutuallyExclusiveTagPairs = [ +export const osmMutuallyExclusiveTagPairs = [ ['noname', 'name'], ['noref', 'ref'], ['nohousenumber', 'addr:housenumber'], diff --git a/modules/presets/preset.js b/modules/presets/preset.js index 4da3ccefd..8e6f68d2e 100644 --- a/modules/presets/preset.js +++ b/modules/presets/preset.js @@ -1,4 +1,4 @@ -import { isEqual } from 'lodash'; +import { isEqual } from 'lodash-es'; import { t } from '../core/localizer'; import { osmAreaKeys, osmAreaKeysExceptions } from '../osm/tags'; diff --git a/modules/renderer/background_source.js b/modules/renderer/background_source.js index 57bf26d8d..9d29779c3 100644 --- a/modules/renderer/background_source.js +++ b/modules/renderer/background_source.js @@ -1,6 +1,6 @@ import { geoArea as d3_geoArea, geoMercatorRaw as d3_geoMercatorRaw } from 'd3-geo'; import { json as d3_json } from 'd3-fetch'; -import { escape } from 'lodash'; +import { escape } from 'lodash-es'; import { t, localizer } from '../core/localizer'; import { geoExtent, geoSphericalDistance } from '../geo'; diff --git a/modules/renderer/map.js b/modules/renderer/map.js index 6b940bfb2..e57b03e21 100644 --- a/modules/renderer/map.js +++ b/modules/renderer/map.js @@ -17,7 +17,7 @@ import { utilGetDimensions } from '../util/dimensions'; import { utilRebind } from '../util/rebind'; import { utilZoomPan } from '../util/zoom_pan'; import { utilDoubleUp } from '../util/double_up'; -import { isArray } from 'lodash-es'; +import { isArray, clamp } from 'lodash-es'; // constants var TILESIZE = 256; @@ -26,10 +26,6 @@ var maxZoom = 24; var kMin = geoZoomToScale(minZoom, TILESIZE); var kMax = geoZoomToScale(maxZoom, TILESIZE); -function clamp(num, min, max) { - return Math.max(min, Math.min(num, max)); -} - export function rendererMap(context) { var dispatch = d3_dispatch( diff --git a/modules/services/mapilio.js b/modules/services/mapilio.js index 10582aff3..28a831f48 100644 --- a/modules/services/mapilio.js +++ b/modules/services/mapilio.js @@ -5,7 +5,7 @@ import { zoom as d3_zoom, zoomIdentity as d3_zoomIdentity } from 'd3-zoom'; import Protobuf from 'pbf'; import RBush from 'rbush'; import { VectorTile } from '@mapbox/vector-tile'; -import { isEqual } from 'lodash'; +import { isEqual } from 'lodash-es'; import { utilRebind, utilTiler, utilQsString, utilStringQs, utilSetTransform } from '../util'; import {geoExtent, geoScaleToZoom} from '../geo'; diff --git a/modules/svg/points.js b/modules/svg/points.js index 1e4056a86..123d0f566 100644 --- a/modules/svg/points.js +++ b/modules/svg/points.js @@ -1,4 +1,6 @@ import deepEqual from 'fast-deep-equal'; +import { clamp } from 'lodash-es'; + import { geoScaleToZoom } from '../geo'; import { osmEntity, osmIsInterestingTag } from '../osm'; import { svgPointTransform } from './helpers'; diff --git a/modules/ui/photoviewer.js b/modules/ui/photoviewer.js index 0756fee8f..811bea910 100644 --- a/modules/ui/photoviewer.js +++ b/modules/ui/photoviewer.js @@ -1,6 +1,7 @@ import { select as d3_select } from 'd3-selection'; +import { clamp } from 'lodash-es'; import { t } from '../core/localizer'; import { dispatch as d3_dispatch } from 'd3-dispatch'; @@ -247,10 +248,6 @@ export function uiPhotoviewer(context) { dispatch.call(eventName, target, subtractPadding(utilGetDimensions(target, true), target)); } - function clamp(num, min, max) { - return Math.max(min, Math.min(num, max)); - } - function stopResize(d3_event) { if (pointerId !== (d3_event.pointerId || 'mouse')) return; diff --git a/modules/ui/sections/background_display_options.js b/modules/ui/sections/background_display_options.js index 19bd24d7c..8b98a7cc7 100644 --- a/modules/ui/sections/background_display_options.js +++ b/modules/ui/sections/background_display_options.js @@ -1,6 +1,7 @@ import { select as d3_select } from 'd3-selection'; +import { clamp } from 'lodash-es'; import { prefs } from '../../core/preferences'; import { t, localizer } from '../../core/localizer'; @@ -27,10 +28,6 @@ export function uiSectionBackgroundDisplayOptions(context) { sharpness: 1 }; - function clamp(x, min, max) { - return Math.max(min, Math.min(x, max)); - } - function updateValue(d, val) { val = clamp(val, _minVal, _maxVal); diff --git a/modules/util/tiler.js b/modules/util/tiler.js index ead3a75b7..6b1410098 100644 --- a/modules/util/tiler.js +++ b/modules/util/tiler.js @@ -1,4 +1,6 @@ import { range as d3_range } from 'd3-array'; +import { clamp } from 'lodash-es'; + import { geoExtent, geoScaleToZoom } from '../geo'; @@ -12,11 +14,6 @@ export function utilTiler() { var _skipNullIsland = false; - function clamp(num, min, max) { - return Math.max(min, Math.min(num, max)); - } - - function nearNullIsland(tile) { var x = tile[0]; var y = tile[1]; diff --git a/modules/util/units.js b/modules/util/units.js index fb745830a..0483b1a90 100644 --- a/modules/util/units.js +++ b/modules/util/units.js @@ -1,3 +1,5 @@ +import { clamp } from 'lodash-es'; + import { t, localizer } from '../core/localizer'; var OSM_PRECISION = 7; @@ -102,10 +104,6 @@ function wrap(x, min, max) { return ((x - min) % d + d) % d + min; } -function clamp(x, min, max) { - return Math.max(min, Math.min(x, max)); -} - function roundToDecimal (target, decimalPlace) { target = Number(target); decimalPlace = Number(decimalPlace); diff --git a/modules/validations/crossing_ways.js b/modules/validations/crossing_ways.js index 4158d24da..3f2e27123 100644 --- a/modules/validations/crossing_ways.js +++ b/modules/validations/crossing_ways.js @@ -1,4 +1,4 @@ -import { isEqual } from 'lodash'; +import { isEqual } from 'lodash-es'; import { actionAddMidpoint } from '../actions/add_midpoint'; import { actionChangeTags } from '../actions/change_tags';