From: Mike Taylor Date: Mon, 11 May 2015 13:30:10 +0000 (+0100) Subject: Part of ACREP-30. X-Git-Url: http://git.indexdata.com/?p=mkws-moved-to-github.git;a=commitdiff_plain;h=d801f1c6dea95a19fa0cb76777448645b95a648f Part of ACREP-30. Extend the "compared" Handlebars helper to implement a "matches" operator for regular-expression matching. --- 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]) {