Convert lodah-es and d3 to named imports for validations

This commit is contained in:
Bryan Housel
2017-09-25 23:36:28 -04:00
parent 50b7e2e2a8
commit eb5d00bcc3
6 changed files with 9 additions and 8 deletions
+3 -2
View File
@@ -1,4 +1,5 @@
import _ from 'lodash';
import _isEmpty from 'lodash-es/isEmpty';
import { t } from '../util/locale';
import { utilTagText } from '../util/index';
@@ -11,7 +12,7 @@ export function validationDeprecatedTag() {
var change = changes.created[i],
deprecatedTags = change.deprecatedTags();
if (!_.isEmpty(deprecatedTags)) {
if (!_isEmpty(deprecatedTags)) {
var tags = utilTagText({ tags: deprecatedTags });
warnings.push({
id: 'deprecated_tags',
@@ -3,7 +3,6 @@ import { t } from '../util/locale';
export function validationDisconnectedHighway() {
function isDisconnectedHighway(entity, graph) {
if (!entity.tags.highway) return false;
if (entity.geometry(graph) !== 'line') return false;
+1
View File
@@ -1,5 +1,6 @@
import { t } from '../util/locale';
export function validationManyDeletions() {
var threshold = 100;
+3 -2
View File
@@ -1,11 +1,12 @@
import _ from 'lodash';
import _without from 'lodash-es/without';
import { t } from '../util/locale';
export function validationMissingTag() {
// Slightly stricter check than Entity#isUsed (#3091)
function hasTags(entity, graph) {
return _.without(Object.keys(entity.tags), 'area', 'name').length > 0 ||
return _without(Object.keys(entity.tags), 'area', 'name').length > 0 ||
graph.parentRelations(entity).length > 0;
}
-1
View File
@@ -4,7 +4,6 @@ import { osmIsSimpleMultipolygonOuterMember } from '../osm';
export function validationOldMultipolygon() {
return function validation(changes, graph) {
var warnings = [];
for (var i = 0; i < changes.created.length; i++) {
+2 -2
View File
@@ -1,4 +1,4 @@
import _ from 'lodash';
import _isEmpty from 'lodash-es/isEmpty';
import { t } from '../util/locale';
@@ -7,7 +7,7 @@ import { t } from '../util/locale';
export function validationTagSuggestsArea() {
function tagSuggestsArea(tags) {
if (_.isEmpty(tags)) return false;
if (_isEmpty(tags)) return false;
var presence = ['landuse', 'amenities', 'tourism', 'shop'];
for (var i = 0; i < presence.length; i++) {