@devlander/utils
Version:
Comprehensive JavaScript and TypeScript utilities for seamless development. Includes object manipulation, data validation, and more.
21 lines (20 loc) • 797 B
TypeScript
export declare enum ProtocolPrefixEnum {
HTTPS = "https://",
HTTP = "http://",
NONE = ""
}
export type ProtocolPrefix = `${ProtocolPrefixEnum}` | ProtocolPrefixEnum;
interface GenerateAllowedOriginsOptions {
includeWww?: boolean;
validateDomains?: boolean;
}
/**
* Generates an array of allowed origin URLs based on the provided domains and prefixes.
* Automatically excludes `www.` for localhost domains.
* @param domains - An array of domain strings.
* @param prefixes - An array of URL prefixes.
* @param options - Options to customize the generation.
* @returns An array of unique, fully qualified URLs.
*/
export declare const generateAllowedOrigins: (domains: string[], prefixes?: ProtocolPrefix[], options?: GenerateAllowedOriginsOptions) => string[];
export {};