Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
'$inL',
'$notinL',
];
const isEmptyValue = ['isnull', 'notnull', '$isnull', '$notnull'];
const param = data.split(this._options.delim);
const field = param[0];
const operator = param[1] as ComparisonOperator;
let value = param[2] || '';
if (isArrayValue.some((name) => name === operator)) {
value = value.split(this._options.delimStr) as any;
}
value = this.parseValues(value);
if (!isEmptyValue.some((name) => name === operator) && !hasValue(value)) {
throw new RequestQueryException(`Invalid ${cond} value`);
}
const condition: QueryFilter = { field, operator, value };
validateCondition(condition, cond);
return condition;
}
cond(
f: QueryFilter | QueryFilterArr,
cond: 'filter' | 'or' | 'search' = 'search',
): string {
const filter = Array.isArray(f) ? { field: f[0], operator: f[1], value: f[2] } : f;
validateCondition(filter, cond);
const d = this.options.delim;
return (
filter.field +
d +
filter.operator +
(hasValue(filter.value) ? d + filter.value : '')
);
}