From d70c02ee6dc6f171f79d1a23bf54225d3a1e779f Mon Sep 17 00:00:00 2001 From: Quincy Morgan Date: Fri, 8 Feb 2019 09:33:17 -0500 Subject: [PATCH] Replace use of Set object in validator --- modules/core/validator.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/modules/core/validator.js b/modules/core/validator.js index 870c18e96..b1312969d 100644 --- a/modules/core/validator.js +++ b/modules/core/validator.js @@ -77,14 +77,16 @@ export function coreValidator(context) { function validateEntity(entity) { var issues = []; - var ranValidations = new Set([]); + var ranValidations = []; // runs validation and appends resulting issues, returning true if validation passed function runValidation(type) { - if (!ranValidations.has(type)) { + // only run each validation once + if (ranValidations.indexOf(type) === -1) { var fn = validations[type]; var typeIssues = fn(entity, context); issues = issues.concat(typeIssues); - ranValidations.add(type); + // mark this validation as having run + ranValidations.push(type); return typeIssues.length === 0; } return true; @@ -93,7 +95,7 @@ export function coreValidator(context) { if (entity.type === 'relation') { if (!runValidation('old_multipolygon')) { // don't flag missing tags if they are on the outer way - ranValidations.add('missing_tag'); + ranValidations.push('missing_tag'); } } @@ -107,7 +109,7 @@ export function coreValidator(context) { if (runValidation('almost_junction')) { runValidation('disconnected_way'); } else { - ranValidations.add('disconnected_way'); + ranValidations.push('disconnected_way'); } runValidation('tag_suggests_area');