Skip to content

Commit b43920c

Browse files
author
Benjamin A. Petersen
committedNov 17, 2014
Add check to ensure trim does not error
- checks that input exists before attempting regex - silences a thrown error - seems to keep with spirit of template filters, if value is not provided no need to throw an error
1 parent 1382447 commit b43920c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed
 

‎filter-trim.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@
44
* @return {string} trimmed string
55
*/
66
PolymerExpressions.prototype.trim = function(input){
7-
return input.replace(/^\s*|\s*$/g, '');
8-
}
7+
return input && input.replace(/^\s*|\s*$/g, '');
8+
}

0 commit comments

Comments
 (0)
Please sign in to comment.