Class: UrlTransformer
@ima/core.UrlTransformer
Utility for transforming URLs according to the configured replacement rules.
Constructors
constructor
• new UrlTransformer()
Initializes the URL transformer.
Defined in
packages/core/src/http/UrlTransformer.ts:16
Properties
_rules
• Protected
_rules: StringParameters
Defined in
packages/core/src/http/UrlTransformer.ts:7
Accessors
$dependencies
• Static
get
$dependencies(): never
[]
Returns
never
[]
Defined in
packages/core/src/http/UrlTransformer.ts:9
Methods
addRule
▸ addRule(pattern
, replacement
): UrlTransformer
Adds the provided replacement rule to the rules used by this URL transformer.
Parameters
Name | Type | Description |
---|---|---|
pattern | string | Regexp patter to look for (must be escaped as if for use in the Regexp constructor). |
replacement | string | The replacement of the matched patter in any matched URL. |
Returns
This transformer.
Defined in
packages/core/src/http/UrlTransformer.ts:30
clear
▸ clear(): UrlTransformer
Clears all rules.
Returns
Defined in
packages/core/src/http/UrlTransformer.ts:39
transform
▸ transform(url
): string
Applies all rules registered with this URL transformer to the provided URL and returns the result. The rules will be applied in the order they were registered.
Parameters
Name | Type | Description |
---|---|---|
url | string | The URL for transformation. |
Returns
string
Transformed URL.