From 142819c3a34303356f79fb2db9f555468a02053e Mon Sep 17 00:00:00 2001 From: Vladimir Kharlampidi Date: Fri, 14 Jun 2019 22:47:47 +0300 Subject: [PATCH] bypass undefined and null escapes Fixes #60 --- src/helpers.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/helpers.js b/src/helpers.js index 4938fac..10255d4 100644 --- a/src/helpers.js +++ b/src/helpers.js @@ -17,6 +17,7 @@ const Template7Helpers = { return p.compiled(ctx, options.data, options.root); }, escape(context) { + if (typeof context === 'undefined' || context === null) return ''; if (typeof context !== 'string') { throw new Error('Template7: Passed context to "escape" helper should be a string'); }