UNPKG

@tableau/taco-toolkit

Version:
26 lines (25 loc) 675 B
import { NetworkProtocol } from './types'; type RuleResult = { success: true; } | { success: false; reason: string; }; export interface NetworkRule { test: (url: URL) => RuleResult; } interface HostnameRuleConfig { allowLocalhost: boolean; } export declare class HostnameRule implements NetworkRule { private readonly allowLocalhost; constructor(config: HostnameRuleConfig); test(url: URL): RuleResult; } export declare class ProtocolRule implements NetworkRule { private protocols; constructor(protocols: NetworkProtocol[]); test(url: URL): RuleResult; } export declare function isLocalhost(hostname: string): boolean; export {};