UNPKG

701 BTypeScriptView Raw
1/**
2 * Generates the permutation of all possible values that {@link domainMatch} the given `domain` parameter. The
3 * array is in shortest-to-longest order. Useful when building custom {@link Store} implementations.
4 *
5 * @example
6 * ```
7 * permuteDomain('foo.bar.example.com')
8 * // ['example.com', 'bar.example.com', 'foo.bar.example.com']
9 * ```
10 *
11 * @public
12 * @param domain - the domain to generate permutations for
13 * @param allowSpecialUseDomain - flag to control if {@link https://www.rfc-editor.org/rfc/rfc6761.html | Special Use Domains} such as `localhost` should be allowed
14 */
15export declare function permuteDomain(domain: string, allowSpecialUseDomain?: boolean): string[] | undefined;