Improve function naming

This commit is contained in:
Daniel García Aubert 2017-12-18 19:51:55 +01:00
parent 777df6337b
commit c63226cd26
2 changed files with 5 additions and 5 deletions

View File

@ -2,7 +2,7 @@ const MapConfig = require('windshaft').model.MapConfig;
const aggregationQuery = require('./aggregation-query');
const aggregationValidator = require('./aggregation-validator');
const {
createNumberValidator,
createPositiveNumberValidator,
createIncludesValueValidator
} = aggregationValidator;
@ -41,7 +41,7 @@ module.exports = class AggregationMapConfig extends MapConfig {
super(config, datasource);
const validate = aggregationValidator(this);
const numberValidator = createNumberValidator(this);
const numberValidator = createPositiveNumberValidator(this);
const includesValidPlacementsValidator = createIncludesValueValidator(this, AggregationMapConfig.PLACEMENTS);
validate('resolution', numberValidator);

View File

@ -30,9 +30,9 @@ module.exports.createIncludesValueValidator = function (mapconfig, validValues)
};
};
module.exports.createNumberValidator = function (mapconfig) {
return function validateNumber (prop, key, index) {
if (!Number.isFinite(prop) || prop <= 0) {
module.exports.createPositiveNumberValidator = function (mapconfig) {
return function validatePositiveNumber (prop, key, index) {
if (!Number.isFinite(prop) || prop <= 0) {
const error = new Error(`Invalid ${key}, should be a number greather than 0`);
error.type = 'layer';
error.layer = {