tough-cookie.permutedomain.md
August 1, 2025 ยท View on GitHub
Home > tough-cookie > permuteDomain
permuteDomain() function
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:
declare function permuteDomain(domain: string, allowSpecialUseDomain?: boolean): string[] | undefined;
Parameters
|
Parameter |
Type |
Description |
|---|---|---|
|
domain |
string |
the domain to generate permutations for |
|
allowSpecialUseDomain |
boolean |
(Optional) flag to control if Special Use Domains such as |
Returns:
string[] | undefined
Example
permuteDomain('foo.bar.example.com')
// ['example.com', 'bar.example.com', 'foo.bar.example.com']