mirror of
https://github.com/cita-777/metapi.git
synced 2026-11-02 21:38:32 +08:00
14 lines
539 B
TypeScript
14 lines
539 B
TypeScript
export type RouteRoutingStrategy = 'weighted' | 'round_robin';
|
|
|
|
export const DEFAULT_ROUTE_ROUTING_STRATEGY: RouteRoutingStrategy = 'weighted';
|
|
|
|
export function normalizeRouteRoutingStrategy(value: unknown): RouteRoutingStrategy {
|
|
const normalized = String(value || '').trim().toLowerCase();
|
|
if (normalized === 'round_robin') return 'round_robin';
|
|
return DEFAULT_ROUTE_ROUTING_STRATEGY;
|
|
}
|
|
|
|
export function isRoundRobinRouteRoutingStrategy(value: unknown): boolean {
|
|
return normalizeRouteRoutingStrategy(value) === 'round_robin';
|
|
}
|