mirror of
https://github.com/BradNut/umami
synced 2025-09-08 17:40:29 +00:00
16 lines
456 B
TypeScript
16 lines
456 B
TypeScript
|
|
import { OPERATOR_PREFIXES, OPERATORS } from 'lib/constants';
|
||
|
|
|
||
|
|
export function parseParameterValue(param: string) {
|
||
|
|
const [, prefix, value] = param.match(/^(!~|!|~)?(.*)$/);
|
||
|
|
|
||
|
|
const operator =
|
||
|
|
Object.keys(OPERATOR_PREFIXES).find(key => OPERATOR_PREFIXES[key] === prefix) ||
|
||
|
|
OPERATORS.equals;
|
||
|
|
|
||
|
|
return { operator, value };
|
||
|
|
}
|
||
|
|
|
||
|
|
export function operatorEquals(operator: any) {
|
||
|
|
return [OPERATORS.equals, OPERATORS.notEquals].includes(operator);
|
||
|
|
}
|