[enh] add handlebars 'eq' and 'in' helpers

This commit is contained in:
Laurent Peuch 2018-06-18 03:35:57 +02:00
parent cc2e1887ea
commit df213fba3f

View file

@ -60,6 +60,21 @@
+ '</script>'); + '</script>');
}); });
// equality stuff because mustache/Handlebars is lame
// source https://stackoverflow.com/a/31632215
Handlebars.registerHelper('eq', function(a, b) {
return a === b;
});
Handlebars.registerHelper('in', function(a) {
// skip first one
for (var i = 1; i < arguments.length; ++i) {
if (arguments[i] == a)
return true;
}
return false;
});
// Look for supported type of storage to use // Look for supported type of storage to use
/** /**
* http://sammyjs.org/docs/api/0.7.4/all#Sammy.Store.LocalStorage * http://sammyjs.org/docs/api/0.7.4/all#Sammy.Store.LocalStorage