Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

Expand lodash function names

Jo Spraguea27e75639317
diff --git a/web/js/animation/anim.js b/web/js/animation/anim.js
index ce0a075b6..91a42438f 100644
--- a/web/js/animation/anim.js
+++ b/web/js/animation/anim.js
@@ -1,4 +1,4 @@
-import loEach from 'lodash/each';
+import lodashEach from 'lodash/each';
export function parse (state, errors) {
if (state.a) {
@@ -17,7 +17,7 @@ export function parse (state, errors) {
// remove (, get key value pairs
str = str.match(/\(.*\)/)[0].replace(/[\(\)]/g, '');
var kvps = str.split(',');
- loEach(kvps, function (kvp) {
+ lodashEach(kvps, function (kvp) {
var parts = kvp.split('=');
astate.attributes.push({
id: parts[0],
diff --git a/web/js/animation/gif.js b/web/js/animation/gif.js
index 57c58d481..39bff2cc4 100644
--- a/web/js/animation/gif.js
+++ b/web/js/animation/gif.js
@@ -2,9 +2,9 @@ import $ from 'jquery';
import 'jquery-jcrop';
import wvui from '../ui/ui';
import gifshot from 'gifshot';
-import loFind from 'lodash/find';
-import loEach from 'lodash/each';
-import loIsUndefined from 'lodash/isundefined';
+import lodashFind from 'lodash/find';
+import lodashEach from 'lodash/each';
+import lodashIsUndefined from 'lodash/isundefined';
import {GA as googleAnalytics} from 'worldview-components';
import util from '../util/util';
import uiIndicator from '../ui/indicator';
@@ -199,7 +199,7 @@ export function animationGif(models, config, ui) {
});
return;
}
- if (loFind(layers, {
+ if (lodashFind(layers, {
id: 'Graticule'
}) && models.proj.selected.id === 'geographic') {
wvui.ask({
@@ -242,7 +242,7 @@ export function animationGif(models, config, ui) {
*/
var getLayers = function (products, proj) {
var layers = [];
- loEach(products, function (layer) {
+ lodashEach(products, function (layer) {
if (layer.projections[proj].layer) {
layers.push(layer.projections[proj].layer);
} else {
@@ -266,7 +266,7 @@ export function animationGif(models, config, ui) {
reverse: true,
renderable: true
});
- loEach(products, function (layer) {
+ lodashEach(products, function (layer) {
if (layer.endDate) {
if (date > new Date(layer.endDate)) return;
}
@@ -292,8 +292,8 @@ export function animationGif(models, config, ui) {
*/
var getOpacities = function (products) {
var opacities = [];
- loEach(products, function (product) {
- opacities.push((loIsUndefined(product.opacity)) ? 1 : product.opacity);
+ lodashEach(products, function (product) {
+ opacities.push((lodashIsUndefined(product.opacity)) ? 1 : product.opacity);
});
return opacities;
};
diff --git a/web/js/animation/ui.js b/web/js/animation/ui.js
index 75c9ef911..977e3f8de 100644
--- a/web/js/animation/ui.js
+++ b/web/js/animation/ui.js
@@ -1,4 +1,4 @@
-import loIsEmpty from 'lodash/isempty';
+import lodashIsEmpty from 'lodash/isempty';
import Queue from 'promise-queue';
import util from '../util/util';
import uiIndicator from '../ui/indicator';
@@ -349,7 +349,7 @@ export function animationUi(models, ui) {
for (var i = 0, len = layers.length; i < len; i++) {
layer = layers[i];
- if (!loIsEmpty(models.palettes.isActive(layer.id)) && layer.visible) {
+ if (!lodashIsEmpty(models.palettes.isActive(layer.id)) && layer.visible) {
return true;
}
}
@@ -588,7 +588,7 @@ export function animationUi(models, ui) {
}
if (self.state.supportingCustomLayers &&
preload[self.state.playIndex] &&
- loIsEmpty(inQueue)) {
+ lodashIsEmpty(inQueue)) {
self.play(self.state.playIndex);
return;
}
diff --git a/web/js/animation/widget.js b/web/js/animation/widget.js
index 7139ca9dd..f83bd0b9d 100644
--- a/web/js/animation/widget.js
+++ b/web/js/animation/widget.js
@@ -2,8 +2,8 @@ import $ from 'jquery';
import {AnimationWidget, GA as googleAnalytics} from 'worldview-components';
import React from 'react';
import ReactDOM from 'react-dom';
-import loWithout from 'lodash/without';
-import loIndexOf from 'lodash/indexof';
+import lodashWithout from 'lodash/without';
+import lodashIndexOf from 'lodash/indexof';
import util from '../util/util';
export function animationWidget (models, config, ui) {
@@ -34,7 +34,7 @@ export function animationWidget (models, config, ui) {
onPushGIF: self.onPressGIF,
looping: model.rangeState.loop,
increment: self.getIncrements(), // config.currentZoom is a number: 1,2,3
- incrementArray: loWithout(zooms, self.getIncrements()), // array of zooms without current zoom
+ incrementArray: lodashWithout(zooms, self.getIncrements()), // array of zooms without current zoom
onDateChange: self.dateUpdate,
sliderLabel: 'Frames Per Second',
sliderSpeed: model.rangeState.speed,
@@ -139,7 +139,7 @@ export function animationWidget (models, config, ui) {
endDate: new Date(state.endDate),
playing: state.playing,
increment: self.getIncrements(), // config.currentZoom is a number: 1,2,3
- incrementArray: loWithout(zooms, self.getIncrements()) // array of zooms without current zoom
+ incrementArray: lodashWithout(zooms, self.getIncrements()) // array of zooms without current zoom
});
};
@@ -171,7 +171,7 @@ export function animationWidget (models, config, ui) {
*
*/
self.onZoomSelect = function (increment) {
- var zoomLevel = loIndexOf(zooms, increment);
+ var zoomLevel = lodashIndexOf(zooms, increment);
return timeline.config.zoom(zoomLevel + 1);
};
diff --git a/web/js/brand.js b/web/js/brand.js
index c4916aa8d..bfe04edec 100644
--- a/web/js/brand.js
+++ b/web/js/brand.js
@@ -1,4 +1,4 @@
-import loIndexOf from 'lodash/indexOf';
+import lodashIndexOf from 'lodash/indexOf';
/**
* @class wv.brand
* @static
@@ -59,7 +59,7 @@ export default (function () {
};
self.url = function (base) {
- var joiner = (loIndexOf(base, '?') < 0) ? '?' : '&';
+ var joiner = (lodashIndexOf(base, '?') < 0) ? '?' : '&';
return base + joiner + 'v=' + self.BUILD_NONCE;
};
diff --git a/web/js/date/timeline-input.js b/web/js/date/timeline-input.js
index 1fbaf7e52..20cff9484 100644
--- a/web/js/date/timeline-input.js
+++ b/web/js/date/timeline-input.js
@@ -1,6 +1,6 @@
import $ from 'jquery';
import util from '../util/util';
-import loParseInt from 'lodash/parseInt';
+import lodashParseInt from 'lodash/parseInt';
/**
* Implements the date input
@@ -110,7 +110,7 @@ export function timelineInput(models, config, ui) {
}
var interval = $(this)
.attr('data-interval') || dataInterval;
- var amount = loParseInt($(this)
+ var amount = lodashParseInt($(this)
.attr('data-value')) || amt;
var date = rollingDate || models.date.selected;
var min = models.date.minDate();
diff --git a/web/js/image/panel.js b/web/js/image/panel.js
index 3cdf30309..2fa46e824 100644
--- a/web/js/image/panel.js
+++ b/web/js/image/panel.js
@@ -1,8 +1,8 @@
import $ from 'jquery';
import 'jquery-ui/button';
import 'jquery-ui/dialog';
-import loEach from 'lodash/each';
-import loIsUndefined from 'lodash/isUndefined';
+import lodashEach from 'lodash/each';
+import lodashIsUndefined from 'lodash/isUndefined';
import olProj from 'ol/proj';
import {GA as googleAnalytics} from 'worldview-components';
import util from '../util/util';
@@ -267,8 +267,8 @@ export function imagePanel(models, ui, config) {
// get layer transparencies (opacities)
var opacities = [];
- loEach(products, function (product) {
- opacities.push((loIsUndefined(product.opacity)) ? 1 : product.opacity);
+ lodashEach(products, function (product) {
+ opacities.push((lodashIsUndefined(product.opacity)) ? 1 : product.opacity);
});
// console.log("EPSG: " + epsg);
@@ -332,7 +332,7 @@ export function imagePanel(models, ui, config) {
// dlURL += "&switch="+s;
dlURL += '&epsg=' + epsg;
var layers = [];
- loEach(products, function (layer) {
+ lodashEach(products, function (layer) {
if (layer.projections[s].layer) {
layers.push(layer.projections[s].layer);
} else {
diff --git a/web/js/image/rubberband.js b/web/js/image/rubberband.js
index e4e804dd8..d782821be 100644
--- a/web/js/image/rubberband.js
+++ b/web/js/image/rubberband.js
@@ -1,7 +1,7 @@
import $ from 'jquery';
import 'jquery-ui/button';
import 'jquery-jcrop';
-import loFind from 'lodash/find';
+import lodashFind from 'lodash/find';
import util from '../util/util';
import wvui from '../ui/ui';
@@ -114,7 +114,7 @@ export function imageRubberband(models, ui, config) {
var layers = models.layers.get({
renderable: true
});
- if (loFind(layers, {
+ if (lodashFind(layers, {
id: 'Graticule'
}) && geographic) {
wvui.ask({
diff --git a/web/js/layers/active.js b/web/js/layers/active.js
index fb60cd02d..a6d03120e 100644
--- a/web/js/layers/active.js
+++ b/web/js/layers/active.js
@@ -4,8 +4,8 @@ import 'jquery-ui/button';
import 'jquery-ui/dialog';
import 'perfect-scrollbar/jquery';
import d3 from 'd3';
-import loEach from 'lodash/each';
-import loEachRight from 'lodash/eachRight';
+import lodashEach from 'lodash/each';
+import lodashEachRight from 'lodash/eachRight';
import util from '../util/util';
import wvui from '../ui/ui';
import {layersInfo} from './info';
@@ -54,7 +54,7 @@ export function layersActive(models, ui, config) {
var $container = $('<div />', {class: 'layer-container bank'});
$(self.selector).empty().append($container);
- loEachRight(groups, function (group) {
+ lodashEachRight(groups, function (group) {
renderGroup($container, group);
});
@@ -95,7 +95,7 @@ export function layersActive(models, ui, config) {
$('.layer-container ul.category')
.bind('sortstop', moveLayer);
- loEach(model.get({
+ lodashEach(model.get({
group: 'overlays'
}), function (layer) {
if (layer.palette) {
@@ -118,7 +118,7 @@ export function layersActive(models, ui, config) {
$parent.append($header);
- loEach(model.get({
+ lodashEach(model.get({
group: group.id
}), function (layer) {
renderLayer($container, group, layer);
@@ -455,7 +455,7 @@ export function layersActive(models, ui, config) {
};
var onPaletteUpdateAll = function () {
- loEach(legends, function (legend) {
+ lodashEach(legends, function (legend) {
legend.update();
});
};
@@ -467,8 +467,8 @@ export function layersActive(models, ui, config) {
setTimeout(render, 1);
};
var onZoomChange = function () {
- loEach(groups, function (group) {
- loEach(model.get({
+ lodashEach(groups, function (group) {
+ lodashEach(model.get({
group: group.id
}), function (layer) {
var $layer = $('#products li.productsitem[data-layer="' +
@@ -478,8 +478,8 @@ export function layersActive(models, ui, config) {
});
};
var onDateChange = function () {
- loEach(groups, function (group) {
- loEach(model.get({
+ lodashEach(groups, function (group) {
+ lodashEach(model.get({
group: group.id
}), function (layer) {
var $layer = $('#' + group.id + '-' + encodeURIComponent(layer.id));
diff --git a/web/js/layers/add.js b/web/js/layers/add.js
index 70a9f4825..3d5a25b8e 100644
--- a/web/js/layers/add.js
+++ b/web/js/layers/add.js
@@ -1,9 +1,9 @@
import $ from 'jquery';
import 'icheck';
import 'jscrollpane';
-import loEach from 'lodash/each';
-import loFind from 'lodash/find';
-import loThrottle from 'lodash/throttle';
+import lodashEach from 'lodash/each';
+import lodashFind from 'lodash/find';
+import lodashThrottle from 'lodash/throttle';
import util from '../util/util';
export function layersAdd(models, ui, config) {
@@ -18,7 +18,7 @@ export function layersAdd(models, ui, config) {
var visible = {};
var init = function () {
- loEach(config.layers, function (layer) {
+ lodashEach(config.layers, function (layer) {
visible[layer.id] = true;
});
@@ -129,7 +129,7 @@ export function layersAdd(models, ui, config) {
.addClass('category')
.addClass('scroll-pane');
- loEach(config.layerOrder, function (layerId) {
+ lodashEach(config.layerOrder, function (layerId) {
var layer = config.layers[layerId];
if (!layer) {
console.warn('In layer order but not defined', layerId);
@@ -182,7 +182,7 @@ export function layersAdd(models, ui, config) {
if (group === 'baselayers') {
$checkbox.attr('name', group);
}
- if (loFind(model.active, {
+ if (lodashFind(model.active, {
id: layer.id
})) {
$checkbox.attr('checked', 'checked');
@@ -321,7 +321,7 @@ export function layersAdd(models, ui, config) {
};
var adjustTitles = function () {
- loEach(config.layers, function (def) {
+ lodashEach(config.layers, function (def) {
var names = models.layers.getTitles(def.id);
$('#selectorbox [data-layer=\'' + encodeURIComponent(def.id) +
'\'] .title')
@@ -404,7 +404,7 @@ export function layersAdd(models, ui, config) {
return filtered;
};
- var filter = loThrottle(function () {
+ var filter = lodashThrottle(function () {
var search = searchTerms();
$.each(config.layers, function (layerId, layer) {
var fproj = filterProjection(layer);
diff --git a/web/js/layers/layers.js b/web/js/layers/layers.js
index ab3b2ce3a..08703f4c6 100644
--- a/web/js/layers/layers.js
+++ b/web/js/layers/layers.js
@@ -1,13 +1,13 @@
-import loCloneDeep from 'lodash/cloneDeep';
-import loEach from 'lodash/each';
-import loRemove from 'lodash/remove';
+import lodashCloneDeep from 'lodash/cloneDeep';
+import lodashEach from 'lodash/each';
+import lodashRemove from 'lodash/remove';
// Permalink versions 1.0 and 1.1
var parse11 = function (state, errors, config) {
var str = state.products;
var layers = [];
var ids = str.split(/[~,\.]/);
- loEach(ids, function (id) {
+ lodashEach(ids, function (id) {
if (id === 'baselayers' || id === 'overlays') {
return;
}
@@ -47,7 +47,7 @@ var parse12 = function (state, errors, config) {
// Split by layer definitions (commas not in parens)
var layerDefs = str.match(/[^\(,]+(\([^\)]*\))?,?/g);
var lstates = [];
- loEach(layerDefs, function (layerDef) {
+ lodashEach(layerDefs, function (layerDef) {
// Get the text before any paren or comma
var layerId = layerDef.match(/[^\(,]+/)[0];
if (config.redirects && config.redirects.layers) {
@@ -64,7 +64,7 @@ var parse12 = function (state, errors, config) {
var strAttr = arrayAttr[0].replace(/[\(\)]/g, '');
// Key value pairs
var kvps = strAttr.split(',');
- loEach(kvps, function (kvp) {
+ lodashEach(kvps, function (kvp) {
parts = kvp.split('=');
if (parts.length === 1) {
lstate.attributes.push({
@@ -101,16 +101,16 @@ export function validate(errors, config) {
layerRemoved: true
});
delete config.layers[layerId];
- loRemove(config.layerOrder.baselayers, function (e) {
+ lodashRemove(config.layerOrder.baselayers, function (e) {
return e === layerId;
});
- loRemove(config.layerOrder.overlays, function (e) {
+ lodashRemove(config.layerOrder.overlays, function (e) {
return e === layerId;
});
};
- var layers = loCloneDeep(config.layers);
- loEach(layers, function (layer) {
+ var layers = lodashCloneDeep(config.layers);
+ lodashEach(layers, function (layer) {
if (!layer.group) {
error(layer.id, 'No group defined');
return;
@@ -120,8 +120,8 @@ export function validate(errors, config) {
}
});
- var orders = loCloneDeep(config.layerOrder);
- loEach(orders, function (layerId) {
+ var orders = lodashCloneDeep(config.layerOrder);
+ lodashEach(orders, function (layerId) {
if (!config.layers[layerId]) {
error(layerId, 'No configuration');
}
diff --git a/web/js/layers/model.js b/web/js/layers/model.js
index f8020c6bc..98c104805 100644
--- a/web/js/layers/model.js
+++ b/web/js/layers/model.js
@@ -1,9 +1,9 @@
-import loEach from 'lodash/each';
-import loEachRight from 'lodash/eachRight';
-import loFilter from 'lodash/filter';
-import loFind from 'lodash/find';
-import loFindIndex from 'lodash/findIndex';
-import loIsUndefined from 'lodash/isUndefined';
+import lodashEach from 'lodash/each';
+import lodashEachRight from 'lodash/eachRight';
+import lodashFilter from 'lodash/filter';
+import lodashFind from 'lodash/find';
+import lodashFindIndex from 'lodash/findIndex';
+import lodashIsUndefined from 'lodash/isUndefined';
import util from '../util/util';
export function layersModel(models, config) {
@@ -21,7 +21,7 @@ export function layersModel(models, config) {
self.reset = function () {
self.clear();
if (config.defaults && config.defaults.startingLayers) {
- loEach(config.defaults.startingLayers, function (start) {
+ lodashEach(config.defaults.startingLayers, function (start) {
self.add(start.id, start);
});
}
@@ -86,7 +86,7 @@ export function layersModel(models, config) {
// if the layer exists in the active layer list
self.exists = function (layer) {
var found = false;
- loEach(self.active, function (current) {
+ lodashEach(self.active, function (current) {
if (layer === current.id) {
found = true;
}
@@ -97,7 +97,7 @@ export function layersModel(models, config) {
self.dateRange = function (spec) {
spec = spec || {};
var projId = spec.projId || models.proj.selected.id;
- var layers = (spec.layer) ? [loFind(self.active, {
+ var layers = (spec.layer) ? [lodashFind(self.active, {
id: spec.layer
})]
: self.active;
@@ -113,7 +113,7 @@ export function layersModel(models, config) {
var min = Number.MAX_VALUE;
var max = 0;
var range = false;
- loEach(layers, function (def) {
+ lodashEach(layers, function (def) {
if (def.startDate) {
range = true;
var start = util.parseDateUTC(def.startDate)
@@ -153,7 +153,7 @@ export function layersModel(models, config) {
};
self.add = function (id, spec) {
- if (loFind(self.active, {
+ if (lodashFind(self.active, {
id: id
})) {
return;
@@ -164,12 +164,12 @@ export function layersModel(models, config) {
throw new Error('No such layer: ' + id);
}
def.visible = true;
- if (!loIsUndefined(spec.visible)) {
+ if (!lodashIsUndefined(spec.visible)) {
def.visible = spec.visible;
- } else if (!loIsUndefined(spec.hidden)) {
+ } else if (!lodashIsUndefined(spec.hidden)) {
def.visible = !spec.hidden;
}
- def.opacity = (loIsUndefined(spec.opacity)) ? 1.0 : spec.opacity;
+ def.opacity = (lodashIsUndefined(spec.opacity)) ? 1.0 : spec.opacity;
if (def.group === 'overlays') {
self.active.unshift(def);
split += 1;
@@ -181,7 +181,7 @@ export function layersModel(models, config) {
};
self.remove = function (id) {
- var index = loFindIndex(self.active, {
+ var index = lodashFindIndex(self.active, {
id: id
});
var def = self.active[index];
@@ -196,7 +196,7 @@ export function layersModel(models, config) {
};
self.replace = function (idOld, idNew) {
- var index = loFindIndex(self.active, {
+ var index = lodashFindIndex(self.active, {
id: idOld
});
if (index < 0) {
@@ -214,7 +214,7 @@ export function layersModel(models, config) {
self.clear = function (projId) {
projId = projId || models.proj.selected.id;
var defs = self.active.slice(0);
- loEach(defs, function (def) {
+ lodashEach(defs, function (def) {
if (projId && def.projections[projId]) {
self.remove(def.id);
}
@@ -222,7 +222,7 @@ export function layersModel(models, config) {
};
self.pushToBottom = function (id) {
- var oldIndex = loFindIndex(self.active, {
+ var oldIndex = lodashFindIndex(self.active, {
id: id
});
if (oldIndex < 0) {
@@ -240,7 +240,7 @@ export function layersModel(models, config) {
};
self.moveBefore = function (sourceId, targetId) {
- var sourceIndex = loFindIndex(self.active, {
+ var sourceIndex = lodashFindIndex(self.active, {
id: sourceId
});
if (sourceIndex < 0) {
@@ -248,7 +248,7 @@ export function layersModel(models, config) {
}
var sourceDef = self.active[sourceIndex];
- var targetIndex = loFindIndex(self.active, {
+ var targetIndex = lodashFindIndex(self.active, {
id: targetId
});
if (targetIndex < 0) {
@@ -265,7 +265,7 @@ export function layersModel(models, config) {
};
self.setVisibility = function (id, visible) {
- var def = loFind(self.active, {
+ var def = lodashFind(self.active, {
id: id
});
if (def.visible !== visible) {
@@ -276,7 +276,7 @@ export function layersModel(models, config) {
};
self.setOpacity = function (id, opacity) {
- var def = loFind(self.active, {
+ var def = lodashFind(self.active, {
id: id
});
if (def.opacity !== opacity) {
@@ -287,7 +287,7 @@ export function layersModel(models, config) {
};
self.isRenderable = function (id) {
- var def = loFind(self.active, {
+ var def = lodashFind(self.active, {
id: id
});
if (!def) {
@@ -303,7 +303,7 @@ export function layersModel(models, config) {
return true;
}
var obscured = false;
- loEach(self.get({
+ lodashEach(self.get({
group: 'baselayers'
}), function (otherDef) {
if (otherDef.id === def.id) {
@@ -321,8 +321,8 @@ export function layersModel(models, config) {
self.save = function (state) {
var defs = self.get();
state.l = state.l || [];
- loEach(self.get(), function (def) {
- var lstate = loFind(state.l, {
+ lodashEach(self.get(), function (def) {
+ var lstate = lodashFind(state.l, {
id: def.id
});
if (!lstate) {
@@ -349,9 +349,9 @@ export function layersModel(models, config) {
};
self.load = function (state, errors) {
- if (!loIsUndefined(state.l)) {
+ if (!lodashIsUndefined(state.l)) {
self.clear(models.proj.selected.id);
- loEachRight(state.l, function (layerDef) {
+ lodashEachRight(state.l, function (layerDef) {
if (!config.layers[layerDef.id]) {
errors.push({
message: 'No such layer: ' + layerDef.id
@@ -360,7 +360,7 @@ export function layersModel(models, config) {
}
var hidden = false;
var opacity = 1.0;
- loEach(layerDef.attributes, function (attr) {
+ lodashEach(layerDef.attributes, function (attr) {
if (attr.id === 'hidden') {
hidden = true;
}
@@ -381,10 +381,10 @@ export function layersModel(models, config) {
spec = spec || {};
var projId = spec.proj || models.proj.selected.id;
var results = [];
- var defs = loFilter(self.active, {
+ var defs = lodashFilter(self.active, {
group: group
});
- loEach(defs, function (def) {
+ lodashEach(defs, function (def) {
// Skip if this layer isn't available for the selected projection
if (!def.projections[projId]) {
return;
diff --git a/web/js/layers/options.js b/web/js/layers/options.js
index 3b5c1f550..f7d66e6cd 100644
--- a/web/js/layers/options.js
+++ b/web/js/layers/options.js
@@ -4,11 +4,11 @@ import 'jquery-ui/dialog';
import 'icheck';
import 'nouislider/distribute/jquery.nouislider';
import 'perfect-scrollbar/jquery';
-import loEach from 'lodash/each';
-import loIndexOf from 'lodash/indexOf';
-import loIsEqual from 'lodash/isEqual';
-import loIsUndefined from 'lodash/isUndefined';
-import loParseInt from 'lodash/parseInt';
+import lodashEach from 'lodash/each';
+import lodashIndexOf from 'lodash/indexOf';
+import lodashIsEqual from 'lodash/isEqual';
+import lodashIsUndefined from 'lodash/isUndefined';
+import lodashParseInt from 'lodash/parseInt';
import util from '../util/util';
import wvui from '../ui/ui';
import palettes from '../palettes/palettes';
@@ -177,7 +177,7 @@ export function layersOptions(config, models, layer) {
.addClass('wv-legend-buttons');
var legends = models.palettes.getLegends(layer.id);
- loEach(legends, function (legend, index) {
+ lodashEach(legends, function (legend, index) {
id = 'wv-legend-' + index;
$panel.append('<input type=\'radio\' id=\'' + id + '\' ' +
'name=\'legend\' value=\'' + index + '\'>' +
@@ -188,7 +188,7 @@ export function layersOptions(config, models, layer) {
$('.wv-legend-buttons input[type=\'radio\']')
.change(function () {
- index = loParseInt($(this)
+ index = lodashParseInt($(this)
.val());
rerenderRange();
rerenderPaletteSelector();
@@ -273,12 +273,12 @@ export function layersOptions(config, models, layer) {
var onRangeUpdate = function () {
var palette = models.palettes.get(layer.id, index);
- var imin = (loIsUndefined(palette.min)) ? 0 : palette.min;
- var imax = (loIsUndefined(palette.max))
+ var imin = (lodashIsUndefined(palette.min)) ? 0 : palette.min;
+ var imax = (lodashIsUndefined(palette.max))
? palette.legend.tooltips.length - 1 : palette.max;
var current = [parseFloat($range.val()[0]), parseFloat($range.val()[1])];
updateRangeLabels();
- if (!loIsEqual(current, [imin, imax])) {
+ if (!lodashIsEqual(current, [imin, imax])) {
$range.val([imin, imax]);
}
@@ -326,14 +326,14 @@ export function layersOptions(config, models, layer) {
.empty();
$pane.append(defaultLegend());
var recommended = layer.palette.recommended || [];
- loEach(recommended, function (id) {
+ lodashEach(recommended, function (id) {
var item = customLegend(id);
if (item) {
$pane.append(item);
}
});
- loEach(config.paletteOrder, function (id) {
- if (loIndexOf(recommended, id) < 0) {
+ lodashEach(config.paletteOrder, function (id) {
+ if (lodashIndexOf(recommended, id) < 0) {
var item = customLegend(id);
if (item) {
$pane.append(item);
diff --git a/web/js/link/model.js b/web/js/link/model.js
index 6152d3df2..68285b6ea 100644
--- a/web/js/link/model.js
+++ b/web/js/link/model.js
@@ -1,8 +1,8 @@
import $ from 'jquery';
-import loEach from 'lodash/each';
-import loMap from 'lodash/map';
-import loIsArray from 'lodash/isArray';
-import loIsObject from 'lodash/isObject';
+import lodashEach from 'lodash/each';
+import lodashMap from 'lodash/map';
+import lodashIsArray from 'lodash/isArray';
+import lodashIsObject from 'lodash/isObject';
import util from '../util/util';
import Cache from 'cachai';
@@ -47,19 +47,19 @@ export function linkModel(config) {
// Returns a serialized string containing information of the current session
self.toQueryString = function () {
var state = {};
- loEach(components, function (component) {
+ lodashEach(components, function (component) {
component.save(state);
});
- var strings = loMap(state, function (value, key) {
- if (loIsArray(value)) {
+ var strings = lodashMap(state, function (value, key) {
+ if (lodashIsArray(value)) {
var parts = [];
- loEach(value, function (item) {
+ lodashEach(value, function (item) {
var part = '';
- if (loIsObject(item)) {
+ if (lodashIsObject(item)) {
part = item.id;
if (item.attributes && item.attributes.length > 0) {
var attributes = [];
- loEach(item.attributes, function (attribute) {
+ lodashEach(item.attributes, function (attribute) {
if (attribute.value) {
attributes.push(attribute.id + '=' + attribute.value);
} else {
@@ -112,14 +112,14 @@ export function linkModel(config) {
self.load = function (state, errors) {
errors = errors || [];
- loEach(components, function (component) {
+ lodashEach(components, function (component) {
component.load(state, errors);
});
};
var encode = function (value) {
var encoded = encodeURIComponent(value);
- loEach(ENCODING_EXCEPTIONS, function (exception) {
+ lodashEach(ENCODING_EXCEPTIONS, function (exception) {
encoded = encoded.replace(exception.match, exception.replace);
});
return encoded;
diff --git a/web/js/link/ui.js b/web/js/link/ui.js
index 91fdc4dee..9155f3314 100644
--- a/web/js/link/ui.js
+++ b/web/js/link/ui.js
@@ -2,7 +2,7 @@ import $ from 'jquery';
import 'jquery-ui/button';
import 'jquery-ui/dialog';
import 'icheck';
-import loThrottle from 'lodash/throttle';
+import lodashThrottle from 'lodash/throttle';
import React from 'react';
import ReactDOM from 'react-dom';
import Clipboard from 'clipboard';
@@ -49,7 +49,7 @@ export function linkUi(models, config) {
};
// Calls toQueryString to fetch updated state and returns URL
- var replaceHistoryState = loThrottle(function () {
+ var replaceHistoryState = lodashThrottle(function () {
if (util.browser.history) {
window.history.replaceState('', '@OFFICIAL_NAME@', '?' + models.link.toQueryString());
}
diff --git a/web/js/main.js b/web/js/main.js
index 4df477412..e292e2a01 100644
--- a/web/js/main.js
+++ b/web/js/main.js
@@ -1,5 +1,5 @@
import $ from 'jquery';
-import loEach from 'lodash/each';
+import lodashEach from 'lodash/each';
import {GA as googleAnalytics} from 'worldview-components';
// Utils
@@ -134,7 +134,7 @@ window.onload = () => {
// Load any additional scripts as needed
if (config.scripts) {
- loEach(config.scripts, function(script) {
+ lodashEach(config.scripts, function(script) {
$.getScript(script);
});
}
@@ -154,7 +154,7 @@ window.onload = () => {
if (config.features.animation) {
parsers.push(animationParser);
}
- loEach(parsers, function(parser) {
+ lodashEach(parsers, function(parser) {
parser(state, errors, config);
});
requirements = [
@@ -362,7 +362,7 @@ window.onload = () => {
var errorReport = function() {
var layersRemoved = 0;
- loEach(errors, function(error) {
+ lodashEach(errors, function(error) {
var cause = (error.cause) ? ': ' + error.cause : '';
util.warn(error.message + cause);
if (error.layerRemoved) {
diff --git a/web/js/map/layerbuilder.js b/web/js/map/layerbuilder.js
index 860c95f07..dd85100a1 100644
--- a/web/js/map/layerbuilder.js
+++ b/web/js/map/layerbuilder.js
@@ -5,9 +5,9 @@ import OlSourceTileWMS from 'ol/source/tilewms';
import OlLayerGroup from 'ol/layer/group';
import OlLayerTile from 'ol/layer/tile';
import OlTileGridTileGrid from 'ol/tilegrid/tilegrid';
-import loCloneDeep from 'lodash/cloneDeep';
-import loMerge from 'lodash/merge';
-import loEach from 'lodash/each';
+import lodashCloneDeep from 'lodash/cloneDeep';
+import lodashMerge from 'lodash/merge';
+import lodashEach from 'lodash/each';
import {lookupFactory} from '../ol/lookupimagetile';
export function mapLayerBuilder(models, config, cache, Parent) {
@@ -46,8 +46,8 @@ export function mapLayerBuilder(models, config, cache, Parent) {
proj: proj.id,
def: def
};
- def = loCloneDeep(def);
- loMerge(def, def.projections[proj.id]);
+ def = lodashCloneDeep(def);
+ lodashMerge(def, def.projections[proj.id]);
if (def.type === 'wmts') {
layer = createLayerWMTS(def, options);
if (proj.id === 'geographic' && def.wrapadjacentdays === true) {
@@ -143,7 +143,7 @@ export function mapLayerBuilder(models, config, cache, Parent) {
}
if (typeof def.matrixIds === 'undefined') {
matrixIds = [];
- loEach(matrixSet.resolutions, function (resolution, index) {
+ lodashEach(matrixSet.resolutions, function (resolution, index) {
matrixIds.push(index);
});
} else {
diff --git a/web/js/map/map.js b/web/js/map/map.js
index f30173e58..24421e2c1 100644
--- a/web/js/map/map.js
+++ b/web/js/map/map.js
@@ -1,7 +1,7 @@
-import loMap from 'lodash/map';
-import loEach from 'lodash/each';
-import loIsUndefined from 'lodash/isUndefined';
-import loFind from 'lodash/find';
+import lodashMap from 'lodash/map';
+import lodashEach from 'lodash/each';
+import lodashIsUndefined from 'lodash/isUndefined';
+import lodashFind from 'lodash/find';
import OlGeomPolygon from 'ol/geom/polygon';
export const CRS_WGS_84 = 'EPSG:4326';
@@ -31,7 +31,7 @@ export function mapParser(state, errors) {
delete state.map;
}
if (state.v) {
- var extent = loMap(state.v.split(','), function (str) {
+ var extent = lodashMap(state.v.split(','), function (str) {
return parseFloat(str);
});
var valid = mapIsExtentValid(extent);
@@ -58,14 +58,14 @@ export function mapParser(state, errors) {
* true.
*/
export function mapIsExtentValid(extent) {
- if (loIsUndefined(extent)) {
+ if (lodashIsUndefined(extent)) {
return false;
}
var valid = true;
if (extent.toArray) {
extent = extent.toArray();
}
- loEach(extent, function (value) {
+ lodashEach(extent, function (value) {
if (isNaN(value)) {
valid = false;
return false;
@@ -140,7 +140,7 @@ export function setVisibility(layer, visible, opacity) {
export function getLayerByName(map, name) {
var layers = map.getLayers()
.getArray();
- return loFind(layers, {
+ return lodashFind(layers, {
'wvname': name
});
};
diff --git a/web/js/map/model.js b/web/js/map/model.js
index a66ad05a9..65ea76269 100644
--- a/web/js/map/model.js
+++ b/web/js/map/model.js
@@ -1,5 +1,5 @@
import util from '../util/util';
-import loClone from 'lodash/clone';
+import lodashClone from 'lodash/clone';
import olExtent from 'ol/extent';
export function mapModel(models, config) {
@@ -47,7 +47,7 @@ export function mapModel(models, config) {
if (olExtent.intersects(extent, maxExtent)) {
self.extent = state.v;
} else {
- self.extent = loClone(proj.maxExtent);
+ self.extent = lodashClone(proj.maxExtent);
errors.push({
message: 'Extent outside of range'
});
@@ -72,7 +72,7 @@ export function mapModel(models, config) {
* @returns {void}
*/
self.save = function (state) {
- state.v = loClone(self.extent);
+ state.v = lodashClone(self.extent);
if (self.rotation !== 0.0 && self.rotation !== 0 && models.proj.selected.id !== 'geographic') {
state.r = (self.rotation * (180.0 / Math.PI))
.toPrecision(6);
diff --git a/web/js/map/precachetile.js b/web/js/map/precachetile.js
index df0920787..b25506ebb 100644
--- a/web/js/map/precachetile.js
+++ b/web/js/map/precachetile.js
@@ -1,4 +1,4 @@
-import loEach from 'lodash/each';
+import lodashEach from 'lodash/each';
import olExtent from 'ol/extent';
import OlRendererCanvasTileLayer from 'ol/renderer/canvas/tilelayer';
@@ -57,7 +57,7 @@ export function mapPrecacheTile(models, config, cache, parent) {
var layers;
var arra = [];
layers = models.layers.get();
- loEach(layers, function (layer) {
+ lodashEach(layers, function (layer) {
if (layer.visible && new Date(layer.startDate > date)) {
arra.push(layer);
}
diff --git a/web/js/map/runningdata.js b/web/js/map/runningdata.js
index 7017703f6..253d164bb 100644
--- a/web/js/map/runningdata.js
+++ b/web/js/map/runningdata.js
@@ -1,7 +1,7 @@
import $ from 'jquery';
import util from '../util/util';
-import loDifference from 'lodash/difference';
-import loEach from 'lodash/each';
+import lodashDifference from 'lodash/difference';
+import lodashEach from 'lodash/each';
export function MapRunningData(models) {
var self;
@@ -186,7 +186,7 @@ export function MapRunningData(models) {
*
*/
self.LayersToRemove = function (oldArray, newArray) {
- return loDifference(oldArray, newArray);
+ return lodashDifference(oldArray, newArray);
};
/*
@@ -220,7 +220,7 @@ export function MapRunningData(models) {
legends = models.palettes.getLegends(layerId);
hex = util.rgbaToHex(data[0], data[1], data[2], data[3]);
- loEach(legends, function (legend) {
+ lodashEach(legends, function (legend) {
if (legend) {
self.createRunnerFromLegend(legend, hex);
}
diff --git a/web/js/map/ui.js b/web/js/map/ui.js
index 2c7363f59..aba2dc8aa 100644
--- a/web/js/map/ui.js
+++ b/web/js/map/ui.js
@@ -1,10 +1,10 @@
import $ from 'jquery';
import 'jquery-ui/button';
-import loFindIndex from 'lodash/findIndex';
-import loEach from 'lodash/each';
-import loForOwn from 'lodash/forOwn';
-import loThrottle from 'lodash/throttle';
-import loFind from 'lodash/find';
+import lodashFindIndex from 'lodash/findIndex';
+import lodashEach from 'lodash/each';
+import lodashForOwn from 'lodash/forOwn';
+import lodashThrottle from 'lodash/throttle';
+import lodashFind from 'lodash/find';
import util from '../util/util';
import OlMap from 'ol/map';
import OlView from 'ol/view';
@@ -67,7 +67,7 @@ export function mapui(models, config) {
}
// NOTE: iOS sometimes bombs if this is _.each instead. In that case,
// it is possible that config.projections somehow becomes array-like.
- loForOwn(config.projections, function (proj) {
+ lodashForOwn(config.projections, function (proj) {
var map = createMap(proj);
self.proj[proj.id] = map;
});
@@ -209,7 +209,7 @@ export function mapui(models, config) {
var activeLayers = map.getLayers()
.getArray()
.slice(0);
- loEach(activeLayers, function (mapLayer) {
+ lodashEach(activeLayers, function (mapLayer) {
if (mapLayer.wv) {
map.removeLayer(mapLayer);
}
@@ -235,7 +235,7 @@ export function mapui(models, config) {
var defs = models.layers.get({
reverse: true
});
- loEach(defs, function (def) {
+ lodashEach(defs, function (def) {
if (isGraticule(def)) {
addGraticule();
} else {
@@ -262,7 +262,7 @@ export function mapui(models, config) {
}
});
var defs = models.layers.get();
- loEach(defs, function (def) {
+ lodashEach(defs, function (def) {
if (isGraticule(def)) {
var renderable = models.layers.isRenderable(def.id);
if (renderable) {
@@ -302,7 +302,7 @@ export function mapui(models, config) {
*/
var addLayer = function (def) {
- var mapIndex = loFindIndex(models.layers.get({
+ var mapIndex = lodashFindIndex(models.layers.get({
reverse: true
}), {
id: def.id
@@ -360,7 +360,7 @@ export function mapui(models, config) {
*/
var updateDate = function () {
var defs = models.layers.get();
- loEach(defs, function (def) {
+ lodashEach(defs, function (def) {
if (def.period !== 'daily') {
return;
}
@@ -407,7 +407,7 @@ export function mapui(models, config) {
var findLayer = function (def) {
var layers = self.selected.getLayers()
.getArray();
- var layer = loFind(layers, {
+ var layer = lodashFind(layers, {
wv: {
id: def.id
}
@@ -429,7 +429,7 @@ export function mapui(models, config) {
var findLayerIndex = function (def) {
var layers = self.selected.getLayers()
.getArray();
- var layer = loFindIndex(layers, {
+ var layer = lodashFindIndex(layers, {
wv: {
id: def.id
}
@@ -496,7 +496,7 @@ export function mapui(models, config) {
self.selected.graticule = null;
};
- var triggerExtent = loThrottle(function () {
+ var triggerExtent = lodashThrottle(function () {
self.events.trigger('extent');
}, 500, {
trailing: true
@@ -619,7 +619,7 @@ export function mapui(models, config) {
map.getView()
.on('change:resolution', updateExtent);
map.getView()
- .on('change:rotation', loThrottle(onRotate, 300));
+ .on('change:rotation', lodashThrottle(onRotate, 300));
map.on('pointerdrag', function () {
self.mapIsbeingDragged = true;
self.events.trigger('drag');
@@ -911,7 +911,7 @@ export function mapui(models, config) {
hoverThrottle.cancel();
dataRunner.clearAll();
})
- .mousemove(hoverThrottle = loThrottle(onMouseMove, 300));
+ .mousemove(hoverThrottle = lodashThrottle(onMouseMove, 300));
};
/*
diff --git a/web/js/notifications/ui.js b/web/js/notifications/ui.js
index 13242f9fa..c9010e651 100644
--- a/web/js/notifications/ui.js
+++ b/web/js/notifications/ui.js
@@ -1,6 +1,6 @@
import $ from 'jquery';
import util from '../util/util';
-import loIsEmpty from 'lodash/isempty';
+import lodashIsEmpty from 'lodash/isempty';
import wvui from '../ui/ui';
/*
* @Class
@@ -297,7 +297,7 @@ export function notificationsUi(models, config) {
self.getAlert = function () {
var $notifyMenuItem, alertsNumber, outageNumber, count, hide;
- if (!loIsEmpty(activeNotifications)) {
+ if (!lodashIsEmpty(activeNotifications)) {
alertsNumber = getNumberOfTypeNotseen('alert', sortedNotifications.alerts);
outageNumber = getNumberOfTypeNotseen('outage', sortedNotifications.outages);
count = outageNumber + alertsNumber;
diff --git a/web/js/palettes/legend.js b/web/js/palettes/legend.js
index d273f9c2e..542c52cad 100644
--- a/web/js/palettes/legend.js
+++ b/web/js/palettes/legend.js
@@ -1,7 +1,7 @@
import $ from 'jquery';
-import loEach from 'lodash/each';
-import loFirst from 'lodash/first';
-import loLast from 'lodash/last';
+import lodashEach from 'lodash/each';
+import lodashFirst from 'lodash/first';
+import lodashLast from 'lodash/last';
import util from '../util/util';
import palettes from './palettes';
@@ -46,7 +46,7 @@ export function palettesLegend(spec) {
.attr('data-layer', layer.id);
$parent.append($legendPanel);
var legends = model.getLegends(layer.id);
- loEach(legends, function (legend, index) {
+ lodashEach(legends, function (legend, index) {
if ((legend.type === 'continuous') ||
(legend.type === 'discrete')) {
renderScale($legendPanel, legend, index, layer.id);
@@ -118,7 +118,7 @@ export function palettesLegend(spec) {
var updateClasses = function (legend, index) {
var $panel = $(selector + ' [data-index=\'' + index + '\']');
$panel.empty();
- loEach(legend.colors, function (color, classIndex) {
+ lodashEach(legend.colors, function (color, classIndex) {
var $runningDataPointLabel = $('<span></span>')
.addClass('wv-running-category-label');
var $colorBox = $('<span></span>')
@@ -137,7 +137,7 @@ export function palettesLegend(spec) {
});
// TODO: Review this each loop. It can probably be removed.
var $detailPanel = $('<div></div>');
- loEach(legend.colors, function (color, classIndex) {
+ lodashEach(legend.colors, function (color, classIndex) {
var label = legend.tooltips[classIndex];
label = (legend.units) ? label + ' ' + legend.units : label;
var $row = $('<div></div>')
@@ -166,7 +166,7 @@ export function palettesLegend(spec) {
return;
}
var legends = model.getLegends(layer.id);
- loEach(legends, function (legend, index) {
+ lodashEach(legends, function (legend, index) {
if ((legend.type === 'continuous') ||
(legend.type === 'discrete')) {
palettes.colorbar(selector + ' ' +
@@ -185,9 +185,9 @@ export function palettesLegend(spec) {
var legends = model.getLegends(layer.id, index);
var entries = model.get(layer.id, index)
.entries;
- loEach(legends, function (legend, index) {
- var min = legend.minLabel || loFirst(legend.tooltips);
- var max = legend.maxLabel || loLast(legend.tooltips);
+ lodashEach(legends, function (legend, index) {
+ var min = legend.minLabel || lodashFirst(legend.tooltips);
+ var max = legend.maxLabel || lodashLast(legend.tooltips);
min = (legend.units) ? min + ' ' + legend.units : min;
max = (legend.units) ? max + ' ' + legend.units : max;
$(selector + ' [data-index=\'' + index + '\'] .wv-palettes-min')
diff --git a/web/js/palettes/model.js b/web/js/palettes/model.js
index ef430d3b9..ecefee4c1 100644
--- a/web/js/palettes/model.js
+++ b/web/js/palettes/model.js
@@ -1,9 +1,9 @@
-import loEach from 'lodash/each';
-import loFind from 'lodash/find';
-import loCloneDeep from 'lodash/cloneDeep';
-import loIsNaN from 'lodash/isNaN';
-import loIsUndefined from 'lodash/isUndefined';
-import loParseInt from 'lodash/parseInt';
+import lodashEach from 'lodash/each';
+import lodashFind from 'lodash/find';
+import lodashCloneDeep from 'lodash/cloneDeep';
+import lodashIsNaN from 'lodash/isNaN';
+import lodashIsUndefined from 'lodash/isUndefined';
+import lodashParseInt from 'lodash/parseInt';
import util from '../util/util';
import palettes from './palettes';
@@ -20,7 +20,7 @@ export function palettesModel(models, config) {
self.getRendered = function (layerId, index) {
var name = config.layers[layerId].palette.id;
var palette = config.palettes.rendered[name];
- if (!loIsUndefined(index)) {
+ if (!lodashIsUndefined(index)) {
palette = palette.maps[index];
}
return palette;
@@ -38,11 +38,11 @@ export function palettesModel(models, config) {
self.active[layerId] = self.active[layerId] || {};
var active = self.active[layerId];
active.maps = active.maps || [];
- loEach(self.getRendered(layerId)
+ lodashEach(self.getRendered(layerId)
.maps,
function (palette, index) {
if (!active.maps[index]) {
- active.maps[index] = loCloneDeep(palette);
+ active.maps[index] = lodashCloneDeep(palette);
}
});
};
@@ -59,7 +59,7 @@ export function palettesModel(models, config) {
throw new Error('Invalid layer: ' + layerId);
}
prepare(layerId);
- index = (loIsUndefined(index)) ? 0 : index;
+ index = (lodashIsUndefined(index)) ? 0 : index;
var active = self.active[layerId];
var palette = active.maps[index];
if (palette.custom === paletteId) {
@@ -72,7 +72,7 @@ export function palettesModel(models, config) {
};
self.clearCustom = function (layerId, index) {
- index = (loIsUndefined(index)) ? 0 : index;
+ index = (lodashIsUndefined(index)) ? 0 : index;
var active = self.active[layerId];
if (!active) {
return;
@@ -89,7 +89,7 @@ export function palettesModel(models, config) {
self.setRange = function (layerId, min, max, squash, index) {
prepare(layerId);
- index = (loIsUndefined(index)) ? 0 : index;
+ index = (lodashIsUndefined(index)) ? 0 : index;
var palette = self.active[layerId].maps[index];
if (min === 0) {
min = undefined;
@@ -122,7 +122,7 @@ export function palettesModel(models, config) {
* @return {object} object including the entries and legend
*/
self.get = function (layerId, index) {
- index = (loIsUndefined(index)) ? 0 : index;
+ index = (lodashIsUndefined(index)) ? 0 : index;
if (self.active[layerId]) {
return self.active[layerId].maps[index];
}
@@ -200,8 +200,8 @@ export function palettesModel(models, config) {
if (self.inUse() && !state.l) {
throw new Error('No layers in state');
}
- loEach(self.active, function (def, layerId) {
- if (!loFind(models.layers.get(), {
+ lodashEach(self.active, function (def, layerId) {
+ if (!lodashFind(models.layers.get(), {
id: layerId
})) {
return;
@@ -215,7 +215,7 @@ export function palettesModel(models, config) {
};
self.saveSingle = function (state, layerId) {
- var attr = loFind(state.l, {
+ var attr = lodashFind(state.l, {
id: layerId
})
.attributes;
@@ -288,7 +288,7 @@ export function palettesModel(models, config) {
}
}
- var attr = loFind(state.l, {
+ var attr = lodashFind(state.l, {
id: layerId
})
.attributes;
@@ -344,19 +344,19 @@ export function palettesModel(models, config) {
return;
}
- loEach(state.l, function (layerDef) {
+ lodashEach(state.l, function (layerDef) {
var layerId = layerDef.id;
var minValue, maxValue;
var min = [],
max = [];
var squash = [];
var count = 0;
- loEach(layerDef.attributes, function (attr) {
+ lodashEach(layerDef.attributes, function (attr) {
var values;
if (attr.id === 'palette') {
count = self.getCount(layerId);
values = util.toArray(attr.value.split(';'));
- loEach(values, function (value, index) {
+ lodashEach(values, function (value, index) {
try {
self.setCustom(layerId, value, index);
} catch (error) {
@@ -367,13 +367,13 @@ export function palettesModel(models, config) {
if (attr.id === 'min') {
count = self.getCount(layerId);
values = util.toArray(attr.value.split(';'));
- loEach(values, function (value, index) {
+ lodashEach(values, function (value, index) {
if (value === '') {
min.push(undefined);
return;
}
minValue = parseFloat(value);
- if (loIsNaN(minValue)) {
+ if (lodashIsNaN(minValue)) {
errors.push('Invalid min value: ' + value);
} else {
min.push(findIndex(layerId, 'min', minValue, index));
@@ -383,13 +383,13 @@ export function palettesModel(models, config) {
if (attr.id === 'max') {
count = self.getCount(layerId);
values = util.toArray(attr.value.split(';'));
- loEach(values, function (value, index) {
+ lodashEach(values, function (value, index) {
if (value === '') {
max.push(undefined);
return;
}
maxValue = parseFloat(value);
- if (loIsNaN(maxValue)) {
+ if (lodashIsNaN(maxValue)) {
errors.push('Invalid max value: ' + value);
} else {
max.push(findIndex(layerId, 'max', maxValue, index));
@@ -402,7 +402,7 @@ export function palettesModel(models, config) {
squash[0] = true;
} else {
values = util.toArray(attr.value.split(';'));
- loEach(values, function (value) {
+ lodashEach(values, function (value) {
squash.push(value === 'true');
});
}
@@ -424,7 +424,7 @@ export function palettesModel(models, config) {
var values = self.get(layerId, index)
.entries.values;
var result;
- loEach(values, function (check, index) {
+ lodashEach(values, function (check, index) {
var min = getMinValue(check);
var max = getMaxValue(check);
if (type === 'min' && value === min) {
@@ -444,7 +444,7 @@ export function palettesModel(models, config) {
self.inUse = function () {
var layers = models.layers.get();
var found = false;
- loEach(layers, function (layer) {
+ lodashEach(layers, function (layer) {
if (self.active[layer.id]) {
found = true;
return false;
@@ -457,7 +457,7 @@ export function palettesModel(models, config) {
var use = false;
var active = self.active[layerId].maps;
- loEach(active, function (palette, index) {
+ lodashEach(active, function (palette, index) {
if (palette.custom) {
use = true;
return false;
@@ -470,7 +470,7 @@ export function palettesModel(models, config) {
if (palette.max >= rendered.entries.values.length) {
delete palette.max;
}
- if (!loIsUndefined(palette.min) || !loIsUndefined(palette.max)) {
+ if (!lodashIsUndefined(palette.min) || !lodashIsUndefined(palette.max)) {
use = true;
return false;
}
@@ -486,7 +486,7 @@ export function palettesModel(models, config) {
}
var lookup = {};
var active = self.active[layerId].maps;
- loEach(active, function (palette, index) {
+ lodashEach(active, function (palette, index) {
var oldLegend = palette.legend;
var entries = palette.entries;
var legend = {
@@ -510,7 +510,7 @@ export function palettesModel(models, config) {
var sourceCount = source.length;
var targetCount = target.length;
- loEach(source, function (color, index) {
+ lodashEach(source, function (color, index) {
var targetColor;
if (index < min || index > max) {
targetColor = '00000000';
@@ -533,15 +533,15 @@ export function palettesModel(models, config) {
}
legend.colors.push(targetColor);
var lookupSource =
- loParseInt(color.substring(0, 2), 16) + ',' +
- loParseInt(color.substring(2, 4), 16) + ',' +
- loParseInt(color.substring(4, 6), 16) + ',' +
- loParseInt(color.substring(6, 8), 16);
+ lodashParseInt(color.substring(0, 2), 16) + ',' +
+ lodashParseInt(color.substring(2, 4), 16) + ',' +
+ lodashParseInt(color.substring(4, 6), 16) + ',' +
+ lodashParseInt(color.substring(6, 8), 16);
var lookupTarget = {
- r: loParseInt(targetColor.substring(0, 2), 16),
- g: loParseInt(targetColor.substring(2, 4), 16),
- b: loParseInt(targetColor.substring(4, 6), 16),
- a: loParseInt(targetColor.substring(6, 8), 16)
+ r: lodashParseInt(targetColor.substring(0, 2), 16),
+ g: lodashParseInt(targetColor.substring(2, 4), 16),
+ b: lodashParseInt(targetColor.substring(4, 6), 16),
+ a: lodashParseInt(targetColor.substring(6, 8), 16)
};
lookup[lookupSource] = lookupTarget;
});
diff --git a/web/js/palettes/palettes.js b/web/js/palettes/palettes.js
index 779506942..a29a394bd 100644
--- a/web/js/palettes/palettes.js
+++ b/web/js/palettes/palettes.js
@@ -1,6 +1,6 @@
import $ from 'jquery';
-import loEach from 'lodash/each';
-import loFind from 'lodash/find';
+import lodashEach from 'lodash/each';
+import lodashFind from 'lodash/find';
import util from '../util/util';
import wvui from '../ui/ui';
@@ -37,7 +37,7 @@ export default (function (self) {
var bins = colors.length;
var binWidth = canvas.width / bins;
var drawWidth = Math.ceil(binWidth);
- loEach(colors, function (color, i) {
+ lodashEach(colors, function (color, i) {
g.fillStyle = util.hexToRGBA(color);
g.fillRect(Math.floor(binWidth * i), 0, drawWidth,
canvas.height);
@@ -69,7 +69,7 @@ export default (function (self) {
self.translate = function (source, target) {
var translation = [];
- loEach(source, function (color, index) {
+ lodashEach(source, function (color, index) {
var sourcePercent = index / source.length;
var targetIndex = Math.floor(sourcePercent * target.length);
translation.push(target[targetIndex]);
@@ -79,7 +79,7 @@ export default (function (self) {
self.lookup = function (sourcePalette, targetPalette) {
var lookup = {};
- loEach(sourcePalette.colors, function (sourceColor, index) {
+ lodashEach(sourcePalette.colors, function (sourceColor, index) {
var source =
parseInt(sourceColor.substring(0, 2), 16) + ',' +
parseInt(sourceColor.substring(2, 4), 16) + ',' +
@@ -114,12 +114,12 @@ export default (function (self) {
rendered: {},
custom: {}
};
- loEach(state.l, function (qsLayer) {
+ lodashEach(state.l, function (qsLayer) {
var layerId = qsLayer.id;
if (config.layers[layerId] && config.layers[layerId].palette) {
promises.push(self.loadRendered(config, layerId));
}
- var custom = loFind(qsLayer.attributes, {
+ var custom = lodashFind(qsLayer.attributes, {
id: 'palette'
});
if (custom) {
@@ -147,7 +147,7 @@ export default (function (self) {
return;
}
var parts = state.palettes.split('~');
- loEach(parts, function (part) {
+ lodashEach(parts, function (part) {
var items = part.split(',');
var layerId = items[0];
var paletteId = items[1];
@@ -162,7 +162,7 @@ export default (function (self) {
'support palettes'
});
} else {
- var layer = loFind(state.l, {
+ var layer = lodashFind(state.l, {
id: layerId
});
if (layer) {
diff --git a/web/js/projection/model.js b/web/js/projection/model.js
index 7bb1f376d..25fce56f6 100644
--- a/web/js/projection/model.js
+++ b/web/js/projection/model.js
@@ -1,4 +1,4 @@
-import loEach from 'lodash/each';
+import lodashEach from 'lodash/each';
import olProj from 'ol/proj';
import proj4 from 'proj4';
import util from '../util/util';
@@ -11,7 +11,7 @@ export function projectionModel(config) {
var init = function () {
self.selectDefault();
olProj.setProj4(proj4);
- loEach(config.projections, function (proj) {
+ lodashEach(config.projections, function (proj) {
if (proj.crs && proj.proj4) {
self.register(proj.crs, proj.proj4);
olProj.get(proj.crs)
diff --git a/web/js/projection/ui.js b/web/js/projection/ui.js
index e68713cf4..6b31924b1 100644
--- a/web/js/projection/ui.js
+++ b/web/js/projection/ui.js
@@ -2,7 +2,7 @@ import $ from 'jquery';
import 'jquery-ui/effect-slide';
import 'jquery-ui/button';
import 'jquery-ui/menu';
-import loEach from 'lodash/each';
+import lodashEach from 'lodash/each';
import wvui from '../ui/ui';
export function projectionUi(models, config) {
@@ -58,7 +58,7 @@ export function projectionUi(models, config) {
.attr('id', 'wv-proj-menu');
$menuItems = $('<ul></ul>');
- loEach(config.ui.projections, function (ui) {
+ lodashEach(config.ui.projections, function (ui) {
var $item = $(
'<li data-proj=\'' + ui.id + '\'>' +
'<a data-proj=\'' + ui.id + '\'>' +
diff --git a/web/js/ui/indicator.js b/web/js/ui/indicator.js
index e9e39a794..d1b86b951 100644
--- a/web/js/ui/indicator.js
+++ b/web/js/ui/indicator.js
@@ -1,10 +1,10 @@
import $ from 'jquery';
-import loUniqueId from 'lodash/uniqueId';
-import loIsString from 'lodash/isString';
-import loEach from 'lodash/each';
-import loRemove from 'lodash/remove';
-import loIsEmpty from 'lodash/isEmpty';
-import loLast from 'lodash/last';
+import lodashUniqueId from 'lodash/uniqueId';
+import lodashIsString from 'lodash/isString';
+import lodashEach from 'lodash/each';
+import lodashRemove from 'lodash/remove';
+import lodashIsEmpty from 'lodash/isEmpty';
+import lodashLast from 'lodash/last';
export default (function () {
var self = {};
@@ -30,7 +30,7 @@ export default (function () {
self.show = function (message, icon) {
self._show(message, icon);
- var id = loUniqueId();
+ var id = lodashUniqueId();
self.active.push({
id: id,
message: message,
@@ -40,18 +40,18 @@ export default (function () {
};
self.hide = function (hides) {
- if (loIsString(hides)) {
+ if (lodashIsString(hides)) {
hides = [hides];
}
- loEach(hides, function (id) {
- loRemove(self.active, {
+ lodashEach(hides, function (id) {
+ lodashRemove(self.active, {
id: id
});
});
- if (loIsEmpty(self.active)) {
+ if (lodashIsEmpty(self.active)) {
self._hide();
} else {
- var def = loLast(self.active);
+ var def = lodashLast(self.active);
self._show(def.message, def.icon);
}
};
diff --git a/web/js/util/events.js b/web/js/util/events.js
index b5c8de113..aec2b6aa2 100644
--- a/web/js/util/events.js
+++ b/web/js/util/events.js
@@ -1,5 +1,5 @@
-import loEach from 'lodash/each';
-import loPull from 'lodash/pull';
+import lodashEach from 'lodash/each';
+import lodashPull from 'lodash/pull';
export function events () {
var self = {};
@@ -24,7 +24,7 @@ export function events () {
self.off = function (event, callback) {
var listeners = events[event];
if (listeners) {
- loPull(listeners, callback);
+ lodashPull(listeners, callback);
}
return self;
};
@@ -42,10 +42,10 @@ export function events () {
return;
}
var eventArguments = Array.prototype.slice.call(arguments, 1);
- loEach(events[event], function (listener) {
+ lodashEach(events[event], function (listener) {
listener.apply(self, eventArguments);
});
- loEach(allListeners, function (listener) {
+ lodashEach(allListeners, function (listener) {
listener.apply(self, eventArguments);
});
return self;
diff --git a/web/js/util/load.js b/web/js/util/load.js
index 5d54665d6..7cd830357 100644
--- a/web/js/util/load.js
+++ b/web/js/util/load.js
@@ -1,5 +1,5 @@
import $ from 'jquery';
-import loSize from 'lodash/size';
+import lodashSize from 'lodash/size';
import wvui from '../ui/ui';
import brand from '../brand';
@@ -18,7 +18,7 @@ export default (function () {
.fail(promise.reject);
return promise;
}
- if (root[attr] && loSize(root[attr]) > 0) {
+ if (root[attr] && lodashSize(root[attr]) > 0) {
promise.resolve(root[attr]);
} else {
loading += 1;
diff --git a/web/js/util/util.js b/web/js/util/util.js
index d11d077a6..6765a6d17 100644
--- a/web/js/util/util.js
+++ b/web/js/util/util.js
@@ -6,8 +6,8 @@
*/
import $ from 'jquery';
-import loEach from 'lodash/each';
-import loIsNull from 'lodash/isNull';
+import lodashEach from 'lodash/each';
+import lodashIsNull from 'lodash/isNull';
import wvui from '../ui/ui';
import browser from './browser';
import {events} from './events';
@@ -115,9 +115,9 @@ export default (function (self) {
self.toQueryString = function (kvps, exceptions) {
exceptions = exceptions || {};
var parts = [];
- loEach(kvps, function (value, key) {
+ lodashEach(kvps, function (value, key) {
var part = key + '=' + encodeURIComponent(value);
- loEach(exceptions, function (exception) {
+ lodashEach(exceptions, function (exception) {
var regexp = new RegExp(exception, 'ig');
var decoded = decodeURIComponent(exception);
part = part.replace(regexp, decoded);
@@ -486,7 +486,7 @@ export default (function (self) {
*/
self.fromCompactTimestamp = function (str) {
var v = str.match(/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})(\d{3})/);
- if (loIsNull(v)) {
+ if (lodashIsNull(v)) {
throw new Error('Invalid timestamp:' + str);
}
return new Date(Date.UTC(