Home > @uniformdev/redirect > getSourceVariables
getSourceVariables() function
Extract the variables and their respective values given a source URL and a path. The source URL is expected to contain wildcards in it or end with a splat. A named wildcard takes the single path segment in its position; a trailing splat takes everything left in the path, which is an empty string when the path ends at the splat's parent — a splat covers that path too.
Signature:
Parameters
|
Parameter |
Type |
Description |
|---|---|---|
|
path |
string | |
|
source |
string | |
|
isVariable |
(pathSegment: string, isLast: boolean) => boolean |
(Optional) |
Returns:
{ [variable: string]: string; }