Skip to content
This repository was archived by the owner on May 3, 2024. It is now read-only.

Commit e22539d

Browse files
committed
Added ifCond Handlebars helper.
1 parent 5cc36f6 commit e22539d

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

helpers.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
/* eslint id-length: 0 */
2+
/* eslint no-invalid-this: 0 */
3+
14
const Handlebars = require('handlebars');
25

36
const hljs = require('highlight.js');
@@ -11,6 +14,18 @@ const markdown = require('markdown-it')({
1114
'linkify': true
1215
});
1316

17+
Handlebars.registerHelper('ifCond', function ifCond (a, b, options) {
18+
19+
if (a === b) {
20+
21+
return options.fn(this);
22+
23+
}
24+
25+
return options.inverse(this);
26+
27+
});
28+
1429
Handlebars.registerHelper('highlightBlock', block => {
1530

1631
if (block) {

0 commit comments

Comments
 (0)