projects
/
mkws-moved-to-github.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
685ffcf
)
Part of ACREP-30.
author
Mike Taylor
<mike@indexdata.com>
Mon, 11 May 2015 13:30:10 +0000
(14:30 +0100)
committer
Mike Taylor
<mike@indexdata.com>
Mon, 11 May 2015 13:33:42 +0000
(14:33 +0100)
Extend the "compared" Handlebars helper to implement a "matches"
operator for regular-expression matching.
src/mkws-handlebars.js
patch
|
blob
|
history
diff --git
a/src/mkws-handlebars.js
b/src/mkws-handlebars.js
index
606dc10
..
2aaba2c
100644
(file)
--- 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]) {