UrlTransformer 

Utility for transforming URLs according to the configured replacement rules.

Kind: global class


new UrlTransformer() 

Initializes the URL transformer.


urlTransformer._rules : Object.<string, string> 

Kind: instance property of UrlTransformer


urlTransformer.addRule(pattern, replacement) ⇒ UrlTransformer 

Adds the provided replacement rule to the rules used by this URL transformer.

Kind: instance method of UrlTransformer
Returns: UrlTransformer - This transformer.

Param Type Description
pattern string Regexp patter to look for (must be escaped as if for use in the {@linkcode Regexp} constructor).
replacement string The replacement of the matched patter in any matched URL.

urlTransformer.clear() ⇒ UrlTransformer 

Clears all rules.

Kind: instance method of UrlTransformer
Returns: UrlTransformer - This transformer.


urlTransformer.transform(str) ⇒ 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.

Kind: instance method of UrlTransformer
Returns: string - Transformed URL.

Param Type Description
str string The URL for transformation.