Skip to content

Commit ec2faf6

Browse files
committed
Add filter for word count
1 parent 8dc2882 commit ec2faf6

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

filter-wordcount.js

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/**
2+
* Calculates word-count for a given string
3+
* @param {string} str
4+
* @return {integer}
5+
*/
6+
PolymerExpressions.prototype.wordcount = function(input){
7+
var words = (input) ? input.match(/\w+/g) : null;
8+
return (words) ? words.length : null;
9+
}
10+

0 commit comments

Comments
 (0)