summaryrefslogtreecommitdiffstats
path: root/catalog-ui/src/app/filters/trim-filter.ts
blob: f174034748fb2804f84eb0ab4ef0ad2255f60f14 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
export class TrimFilter {

    constructor() {
        let filter = <TrimFilter>( (text:string) => {
            if (!angular.isString(text)) {
                return text;
            }

            return text.replace(/^\s+|\s+$/g, ''); // you could use .trim, but it's not going to work in IE<9
        });

        return filter;
    }
}