@ima/core
Version:
IMA.js framework for isomorphic javascript application
37 lines • 1.18 kB
TypeScript
import { StringParameters } from '../types';
/**
* Utility for transforming URLs according to the configured replacement rules.
*/
export declare class UrlTransformer {
protected _rules: StringParameters;
static get $dependencies(): never[];
/**
* Initializes the URL transformer.
*/
constructor();
/**
* Adds the provided replacement rule to the rules used by this URL
* transformer.
*
* @param pattern Regexp patter to look for (must be escaped as if
* for use in the {@link Regexp} constructor).
* @param replacement The replacement of the matched patter in any
* matched URL.
* @return This transformer.
*/
addRule(pattern: string, replacement: string): this;
/**
* Clears all rules.
*/
clear(): this;
/**
* 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.
*
* @param url The URL for transformation.
* @return Transformed URL.
*/
transform(url: string): string;
}
//# sourceMappingURL=UrlTransformer.d.ts.map