export const helpers = {
    'if_eq': function (a: any, b: any, opts: any) {
        if (a === b) {
            return opts.fn(this);
        } else {
            return opts.inverse();
        }
    },
    'difficultyLookup': function(value: number) {
        return "⭐️ ".repeat(value);
    },
    'sortOrderLookup': function (order: number) {
        return (order > 0) ? "↑" : "↓";
    },
    'relativeDate': function (date: any) {
        const realDate = new Date(date);
        const deltaDays = (realDate.getTime() - Date.now()) / (1000 * 3600 * 24);
        const formatter = new Intl.RelativeTimeFormat('en-UK');
        //console.log(formatter.format(Math.round(deltaDays), 'days'));
        return formatter.format(Math.round(deltaDays), 'days');
    }
}
