mirror of
https://github.com/philomena-dev/philomena.git
synced 2024-11-24 20:37:59 +01:00
3590be1429
* match_query: unit test and rewrite for TypeScript * match_query: use new type for parse errors * match_query: avoid exceptional control flow in date parsing
20 lines
726 B
TypeScript
20 lines
726 B
TypeScript
import { makeDateMatcher } from './date';
|
|
import { makeLiteralMatcher } from './literal';
|
|
import { makeNumberMatcher } from './number';
|
|
import { makeUserMatcher } from './user';
|
|
|
|
import { FieldMatcher, RangeEqualQualifier } from './types';
|
|
|
|
export interface MatcherFactory {
|
|
makeDateMatcher: (dateVal: string, qual: RangeEqualQualifier) => FieldMatcher,
|
|
makeLiteralMatcher: (term: string, fuzz: number, wildcardable: boolean) => FieldMatcher,
|
|
makeNumberMatcher: (term: number, fuzz: number, qual: RangeEqualQualifier) => FieldMatcher,
|
|
makeUserMatcher: (term: string) => FieldMatcher
|
|
}
|
|
|
|
export const defaultMatcher: MatcherFactory = {
|
|
makeDateMatcher,
|
|
makeLiteralMatcher,
|
|
makeNumberMatcher,
|
|
makeUserMatcher,
|
|
};
|