refactor: add hbs-helpers ifgtr, iflss

This commit is contained in:
Aetherinox 2024-04-21 03:37:07 -07:00
parent fab0b1ef79
commit cd021b5299
No known key found for this signature in database
GPG Key ID: CB5C4C30CD0D4028
3 changed files with 20 additions and 0 deletions

View File

@ -0,0 +1,9 @@
import Handlebars from 'hbs';
Handlebars.registerHelper('ifgtr', function (lvalue, rvalue, options) {
return lvalue > rvalue ? options.fn(this) : options.inverse(this);
});
Handlebars.registerHelper('ifgeq', function (lvalue, rvalue, options) {
return lvalue >= rvalue ? options.fn(this) : options.inverse(this);
});

View File

@ -0,0 +1,9 @@
import Handlebars from 'hbs';
Handlebars.registerHelper('iflss', function (lvalue, rvalue, options) {
return lvalue < rvalue ? options.fn(this) : options.inverse(this);
});
Handlebars.registerHelper('ifleq', function (lvalue, rvalue, options) {
return lvalue <= rvalue ? options.fn(this) : options.inverse(this);
});

View File

@ -2,5 +2,7 @@ import 'hbs-helpers/add';
import 'hbs-helpers/cmp';
import 'hbs-helpers/ifeq';
import 'hbs-helpers/ifneq';
import 'hbs-helpers/ifgtr';
import 'hbs-helpers/iflss';
import 'hbs-helpers/ifemptyoreq';
import 'hbs-helpers/res';