Skip to content

Latest commit

 

History

History
77 lines (38 loc) · 1.21 KB

tough-cookie.permutedomain.md

File metadata and controls

77 lines (38 loc) · 1.21 KB

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:

export 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 localhost should be allowed

**Returns:**

string[] | undefined

Example

permuteDomain('foo.bar.example.com')
// ['example.com', 'bar.example.com', 'foo.bar.example.com']