Add browser-polyfills, remove lodash assign, compact, values

(re: #6087)
This commit is contained in:
Bryan Housel
2019-03-22 17:14:41 -04:00
parent 547267d7b6
commit 11bfeaabfc
21 changed files with 65 additions and 132 deletions
+9 -12
View File
@@ -1,6 +1,3 @@
import _compact from 'lodash-es/compact';
import _map from 'lodash-es/map';
import { event as d3_event } from 'd3-selection';
import { t } from '../util/locale';
@@ -10,15 +7,15 @@ import { tooltip } from '../util/tooltip';
export function uiFeatureInfo(context) {
function update(selection) {
var features = context.features(),
stats = features.stats(),
count = 0,
hiddenList = _compact(_map(features.hidden(), function(k) {
if (stats[k]) {
count += stats[k];
return String(stats[k]) + ' ' + t('feature.' + k + '.description');
}
}));
var features = context.features();
var stats = features.stats();
var count = 0;
var hiddenList = features.hidden().map(function(k) {
if (stats[k]) {
count += stats[k];
return String(stats[k]) + ' ' + t('feature.' + k + '.description');
}
}).filter(Boolean);
selection.html('');
+2 -3
View File
@@ -1,6 +1,5 @@
import _difference from 'lodash-es/difference';
import _uniq from 'lodash-es/uniq';
import _values from 'lodash-es/values';
import {
select as d3_select,
@@ -86,7 +85,7 @@ export function uiIntro(context) {
// Load semi-real data used in intro
if (osm) { osm.toggle(false).reset(); }
context.history().reset();
context.history().merge(_values(coreGraph().load(introGraph).entities));
context.history().merge(Object.values(coreGraph().load(introGraph).entities));
context.history().checkpoint('initial');
// Setup imagery
@@ -165,7 +164,7 @@ export function uiIntro(context) {
d3_selectAll('#map .layer-background').style('opacity', opacity);
d3_selectAll('button.sidebar-toggle').classed('disabled', false);
if (osm) { osm.toggle(true).reset().caches(caches); }
context.history().reset().merge(_values(baseEntities));
context.history().reset().merge(Object.values(baseEntities));
context.background().baseLayerSource(background);
overlays.forEach(function(d) { context.background().toggleOverlayLayer(d); });
if (history) { context.history().fromJSON(history, false); }