kopia lustrzana https://github.com/OpenDroneMap/NodeODM
Support for domain validation on integer
rodzic
3c415bce58
commit
472eb84619
|
@ -177,19 +177,21 @@ module.exports = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
regex: /^(float): ([\-\+\.\d]+) <= x <= ([\-\+\.\d]+)$/,
|
regex: /^(float|integer): ([\-\+\.\d]+) <= x <= ([\-\+\.\d]+)$/,
|
||||||
validate: function(matches, value){
|
validate: function(matches, value){
|
||||||
let [str, type, lower, upper] = matches;
|
let [str, type, lower, upper] = matches;
|
||||||
lower = parseFloat(lower);
|
let parseFunc = type === 'float' ? parseFloat : parseInt;
|
||||||
upper = parseFloat(upper);
|
lower = parseFunc(lower);
|
||||||
|
upper = parseFunc(upper);
|
||||||
return value >= lower && value <= upper;
|
return value >= lower && value <= upper;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
regex: /^(float) (>=|>|<|<=) ([\-\+\.\d]+)$/,
|
regex: /^(float|integer) (>=|>|<|<=) ([\-\+\.\d]+)$/,
|
||||||
validate: function(matches, value){
|
validate: function(matches, value){
|
||||||
let [str, type, oper, bound] = matches;
|
let [str, type, oper, bound] = matches;
|
||||||
bound = parseFloat(bound);
|
let parseFunc = type === 'float' ? parseFloat : parseInt;
|
||||||
|
bound = parseFunc(bound);
|
||||||
switch(oper){
|
switch(oper){
|
||||||
case '>=':
|
case '>=':
|
||||||
return value >= bound;
|
return value >= bound;
|
||||||
|
|
Ładowanie…
Reference in New Issue