From d801f1c6dea95a19fa0cb76777448645b95a648f Mon Sep 17 00:00:00 2001 From: Mike Taylor Date: Mon, 11 May 2015 14:30:10 +0100 Subject: [PATCH] Part of ACREP-30. Extend the "compared" Handlebars helper to implement a "matches" operator for regular-expression matching. --- src/mkws-handlebars.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/mkws-handlebars.js b/src/mkws-handlebars.js index 606dc10..2aaba2c 100644 --- a/src/mkws-handlebars.js +++ b/src/mkws-handlebars.js @@ -143,7 +143,8 @@ Handlebars.registerHelper('compare', function (lvalue, operator, rvalue, options '>': function (l, r) { return l > r; }, '<=': function (l, r) { return l <= r; }, '>=': function (l, r) { return l >= r; }, - 'typeof': function (l, r) { return typeof l == r; } + 'typeof': function (l, r) { return typeof l == r; }, + 'matches': function (l, r) { return l.match(r); } }; if (!operators[operator]) { -- 1.7.10.4