File tree 3 files changed +18
-0
lines changed
3 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -70,6 +70,9 @@ <h3>last</h3>
70
70
< h3 > random</ h3 >
71
71
{{ colors | random }}
72
72
73
+ < h3 > trim</ h3 >
74
+ {{' I was a string with leading and trailing whitespace ' | trim}}
75
+
73
76
</ template >
74
77
< script >
75
78
var template = document . getElementById ( 'view' ) ;
Original file line number Diff line number Diff line change
1
+ /**
2
+ * Trim a string, removing leading and trailing whitespace
3
+ * @param {string } input
4
+ * @return {string } trimmed string
5
+ */
6
+ PolymerExpressions . prototype . trim = function ( input ) {
7
+ return input . replace ( / ^ \s * | \s * $ / g, '' ) ;
8
+ }
Original file line number Diff line number Diff line change 11
11
< script src ="filter-wordcount.js "> </ script >
12
12
< script src ="filter-random.js "> </ script >
13
13
< script src ="filter-round.js "> </ script >
14
+ < script src ="filter-trim.js "> </ script >
14
15
15
16
<!--
16
17
A collection of filters for formatting values of [Polymer expressions](www.polymer-project.org/docs/polymer/expressions.html) for display to users.
41
42
42
43
> Hello Peeps
43
44
45
+ ####Trim
46
+
47
+ {{' I was a string with leading and trailing whitespace ' | trim}}
48
+
49
+ > I was a string with leading and trailing whitespace
50
+
44
51
####Date
45
52
46
53
{{1288323623006 | date('yyyy-MM-dd HH:mm:ss Z')}}
You can’t perform that action at this time.
0 commit comments