foundation-filters.urltargetingfilter
Home > @genesislcap/foundation-filters > urlTargetingFilter
urlTargetingFilter() function
URLTargeting client filter function.
Signature:
export declare function urlTargetingFilter(url: string, pattern?: RegExp, schemes?: string[], hosts?: string[], paths?: string[]): boolean;
Parameters
Parameter | Type | Description |
---|---|---|
url | string | A url. |
pattern | RegExp | (Optional) A regex. |
schemes | string[] | (Optional) Schemes/protocols to target. |
hosts | string[] | (Optional) Hosts to target. |
paths | string[] | (Optional) Paths to target. |
Returns:
boolean
Remarks
This will return true when the current URL matches on ANY of the parameters. If you wish to match on multiple parameters, consider chaining an array of urlTargeting filters together.