Tobias Bosch 8aa3fcfb63 chore(build): don’t include export var __esModule = true in every file
But do it during the build process for cjs.
Right now we only need this when we transpile from ts
directly to es5. This is only the case in our
cis build, as for our browser build we only transpile
from ts to es6 via ts and then use traceur to do
the rest.
2015-05-19 15:12:59 -07:00

54 lines
1.0 KiB
TypeScript

import {isString, StringWrapper} from 'angular2/src/facade/lang';
import {Pipe} from './pipe';
/**
* Implements lowercase transforms to text.
*
* # Example
*
* In this example we transform the user text lowercase.
*
* ```
* @Component({
* selector: "username-cmp"
* })
* @View({
* template: "Username: {{ user | lowercase }}"
* })
* class Username {
* user:string;
* }
*
* ```
*
* @exportedAs angular2/pipes
*/
export class LowerCasePipe extends Pipe {
_latestValue: string;
constructor() {
super();
this._latestValue = null;
}
supports(str): boolean { return isString(str); }
onDestroy(): void { this._latestValue = null; }
transform(value: string): string {
if (this._latestValue !== value) {
this._latestValue = value;
return StringWrapper.toLowerCase(value);
} else {
return this._latestValue;
}
}
}
/**
* @exportedAs angular2/pipes
*/
export class LowerCaseFactory {
supports(str): boolean { return isString(str); }
create(): Pipe { return new LowerCasePipe(); }
}