mirror of
https://github.com/umami-software/umami.git
synced 2026-02-06 21:57:16 +01:00
Filter tag enhancements.
This commit is contained in:
parent
a4d8afe516
commit
ef11124672
12 changed files with 160 additions and 64 deletions
15
src/lib/params.ts
Normal file
15
src/lib/params.ts
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
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);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue