tough-cookie.permutepath.md

August 1, 2025 ยท View on GitHub

Home > tough-cookie > permutePath

permutePath() function

Generates the permutation of all possible values that pathMatch() the path parameter. The array is in longest-to-shortest order. Useful when building custom Store implementations.

Signature:

declare function permutePath(path: string): string[];

Parameters

Parameter

Type

Description

path

string

the path to generate permutations for

Returns:

string[]

Example

permutePath('/foo/bar/')
// ['/foo/bar/', '/foo/bar', '/foo', '/']