Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

adjusted lodash naming in ui & util folders

Benjamin Kingdaaec80cea52
diff --git a/web/js/ui/indicator.js b/web/js/ui/indicator.js
index 78f6d12cc..ad50b70e1 100644
--- a/web/js/ui/indicator.js
+++ b/web/js/ui/indicator.js
@@ -1,10 +1,10 @@
import $ from 'jquery';
-import uniqueId from 'lodash/uniqueId';
-import isString from 'lodash/isString';
-import each from 'lodash/each';
-import remove from 'lodash/remove';
-import isEmpty from 'lodash/isEmpty';
-import last from 'lodash/last';
+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';
export const loadingIndicator = (function () {
var self = {};
@@ -30,7 +30,7 @@ export const loadingIndicator = (function () {
self.show = function (message, icon) {
self._show(message, icon);
- var id = uniqueId();
+ var id = loUniqueId();
self.active.push({
id: id,
message: message,
@@ -40,18 +40,18 @@ export const loadingIndicator = (function () {
};
self.hide = function (hides) {
- if (isString(hides)) {
+ if (loIsString(hides)) {
hides = [hides];
}
- each(hides, function (id) {
- remove(self.active, {
+ loEach(hides, function (id) {
+ loRemove(self.active, {
id: id
});
});
- if (isEmpty(self.active)) {
+ if (loIsEmpty(self.active)) {
self._hide();
} else {
- var def = last(self.active);
+ var def = loLast(self.active);
self._show(def.message, def.icon);
}
};
diff --git a/web/js/util/events.js b/web/js/util/events.js
index a70ed8c8d..b5c8de113 100644
--- a/web/js/util/events.js
+++ b/web/js/util/events.js
@@ -1,5 +1,5 @@
-import each from 'lodash/each';
-import pull from 'lodash/pull';
+import loEach from 'lodash/each';
+import loPull 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) {
- pull(listeners, callback);
+ loPull(listeners, callback);
}
return self;
};
@@ -42,10 +42,10 @@ export function events () {
return;
}
var eventArguments = Array.prototype.slice.call(arguments, 1);
- each(events[event], function (listener) {
+ loEach(events[event], function (listener) {
listener.apply(self, eventArguments);
});
- each(allListeners, function (listener) {
+ loEach(allListeners, function (listener) {
listener.apply(self, eventArguments);
});
return self;
diff --git a/web/js/util/load.js b/web/js/util/load.js
index c346f4075..3e7124284 100644
--- a/web/js/util/load.js
+++ b/web/js/util/load.js
@@ -1,5 +1,5 @@
import $ from 'jquery';
-import size from 'lodash/size';
+import loSize from 'lodash/size';
import wvui from '../ui/ui';
import brand from '../brand';
@@ -18,7 +18,7 @@ export const load = (function () {
.fail(promise.reject);
return promise;
}
- if (root[attr] && size(root[attr]) > 0) {
+ if (root[attr] && loSize(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 fdb2068aa..df719914a 100644
--- a/web/js/util/util.js
+++ b/web/js/util/util.js
@@ -6,8 +6,8 @@
*/
import $ from 'jquery';
-import each from 'lodash/each';
-import isNull from 'lodash/isNull';
+import loEach from 'lodash/each';
+import loIsNull from 'lodash/isNull';
import wvui from '../ui/ui';
import browser from './browser';
import events from './events';
@@ -115,9 +115,9 @@ export const util = (function () {
self.toQueryString = function (kvps, exceptions) {
exceptions = exceptions || {};
var parts = [];
- each(kvps, function (value, key) {
+ loEach(kvps, function (value, key) {
var part = key + '=' + encodeURIComponent(value);
- each(exceptions, function (exception) {
+ loEach(exceptions, function (exception) {
var regexp = new RegExp(exception, 'ig');
var decoded = decodeURIComponent(exception);
part = part.replace(regexp, decoded);
@@ -486,7 +486,7 @@ export const util = (function () {
*/
self.fromCompactTimestamp = function (str) {
var v = str.match(/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})(\d{3})/);
- if (isNull(v)) {
+ if (loIsNull(v)) {
throw new Error('Invalid timestamp:' + str);
}
return new Date(Date.UTC(