Improve function naming
This commit is contained in:
parent
777df6337b
commit
c63226cd26
@ -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);
|
||||
|
@ -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 = {
|
||||
|
Loading…
Reference in New Issue
Block a user