Home > tough-cookie > permuteDomain
Generates the permutation of all possible values that domainMatch() the given domain
parameter. The array is in shortest-to-longest order. Useful when building custom Store implementations.
Signature:
export declare function permuteDomain(domain: string, allowSpecialUseDomain?: boolean): string[] | undefined;
Parameter |
Type |
Description |
---|---|---|
domain |
string |
the domain to generate permutations for |
allowSpecialUseDomain |
boolean |
(Optional) flag to control if Special Use Domains such as |
string[] | undefined
permuteDomain('foo.bar.example.com')
// ['example.com', 'bar.example.com', 'foo.bar.example.com']