From 1593bdcccb6e6dccd0ad3370eea0b16c9d11fb5e Mon Sep 17 00:00:00 2001 From: "pabs@pablotron.org" Date: Thu, 18 Dec 2014 01:11:32 -0500 Subject: make all string functions null safe --- luigi-template.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'luigi-template.js') diff --git a/luigi-template.js b/luigi-template.js index cb62c71..55ecf25 100644 --- a/luigi-template.js +++ b/luigi-template.js @@ -77,11 +77,11 @@ LuigiTemplate = (function() { // list of built-in filters var FILTERS = { uc: function(v) { - return v.toUpperCase(); + return (v || '').toUpperCase(); }, lc: function(v) { - return v.toLowerCase(); + return (v || '').toLowerCase(); }, pluralize: function(v) { @@ -89,7 +89,7 @@ LuigiTemplate = (function() { }, length: function(v) { - return v.length; + return (v || '').length; }, trim: function(v) { -- cgit v1.2.3