Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
Util.each(fields, field => {
let value = obj[field];
if (value) {
const colDef = colDefs[field];
if (colDef.type === 'timeCat') {
const values = colDef.values;
if (Util.isNumber(values[0])) {
value = TimeUtil.toTimeStamp(value);
}
}
if ((colDef.values && colDef.values.indexOf(value) === -1)
|| (colDef.min && (value < colDef.min))
|| (colDef.max && (value > colDef.max))) {
flag = false;
}
}
});
if (flag) {
Util.each(fields, field => {
let value = obj[field];
if (value) {
const colDef = colDefs[field];
if (colDef.type === 'timeCat') {
const values = colDef.values;
if (Util.isNumber(values[0])) {
value = TimeUtil.toTimeStamp(value);
}
}
if ((colDef.values && !colDef.values.includes(value))
|| (colDef.min && (value < colDef.min))
|| (colDef.max && (value > colDef.max))) {
flag = false;
}
}
});
if (flag) {
Util.each(values, (v, i) => {
values[i] = TimeUtil.toTimeStamp(v);
});
values.sort(function(v1, v2) {
Util.each(values, (v, i) => {
values[i] = TimeUtil.toTimeStamp(v);
});
values.sort(function(v1, v2) {
Util.each(values, (v, i) => {
values[i] = TimeUtil.toTimeStamp(v);
});
values.sort((v1, v2) => v1 - v2);