<commit_before>import _ from 'lodash';
import Handlebars from 'handlebars';
import Swag from 'swag';

import Path from 'path';
import Util from 'util';

export default function createHandlebars() {
    let handlebars = Handlebars.create();

    Swag.registerHelpers(handlebars);
    
    handlebars.registerHelper('lowerCase', value => value ? new Handlebars.SafeString(value.toString().toLowerCase()) : '');
    handlebars.registerHelper('upperCase', value => value ? new Handlebars.SafeString(value.toString().toUpperCase()) : '');
    handlebars.registerHelper('lowerCaseFirst', value => value ? new Handlebars.SafeString(_.lowerFirst(value.toString())) : '');
    handlebars.registerHelper('upperCaseFirst', value => value ? new Handlebars.SafeString(_.upperFirst(value.toString())) : '');
    handlebars.registerHelper('camelCase', value => value ? new Handlebars.SafeString(_.camelCase(value.toString())) : '');
    handlebars.registerHelper('kebabCase', value => value ? new Handlebars.SafeString(_.kebabCase(value.toString())) : '');
    handlebars.registerHelper('snakeCase', value => value ? new Handlebars.SafeString(_.snakeCase(value.toString())) : '');
    handlebars.registerHelper('resolvePath', value => value ? new Handlebars.SafeString(Path.resolve(value.toString())) : '');
    
    handlebars.registerHelper('format', (value, ...params) => {
        params.pop();
        
        return value ? new Handlebars.SafeString(Util.format(value.toString(), ...params)) : '';
    });
    
    handlebars.registerHelper('getListType', function getListType(type, options) {
        if (_.startsWith(type.toString(), 'list:')) {
            return new Handlebars.SafeString(type.toString().slice(5));
        }
        else {
            return '';
        }
    });
    handlebars.registerHelper('getArrayType', function getArrayType(type, options) {
        if (_.startsWith(type.toString(), 'array:')) {
            return new Handlebars.SafeString(type.toString().slice(6));
        }
        else {
            return '';
        }
    });
    handlebars.registerHelper('getUnsafeType', function getUnsafeType(type, options) {
        if (_.startsWith(type.toString(), 'unsafe:')) {<commit_msg>Added isObject helper<commit_after>import _ from 'lodash';
import Handlebars from 'handlebars';
import Swag from 'swag';

import Path from 'path';
import Util from 'util';

export default function createHandlebars() {
    let handlebars = Handlebars.create();

    Swag.registerHelpers(handlebars);
    
    handlebars.registerHelper('lowerCase', value => value ? new Handlebars.SafeString(value.toString().toLowerCase()) : '');
    handlebars.registerHelper('upperCase', value => value ? new Handlebars.SafeString(value.toString().toUpperCase()) : '');
    handlebars.registerHelper('lowerCaseFirst', value => value ? new Handlebars.SafeString(_.lowerFirst(value.toString())) : '');
    handlebars.registerHelper('upperCaseFirst', value => value ? new Handlebars.SafeString(_.upperFirst(value.toString())) : '');
    handlebars.registerHelper('camelCase', value => value ? new Handlebars.SafeString(_.camelCase(value.toString())) : '');
    handlebars.registerHelper('kebabCase', value => value ? new Handlebars.SafeString(_.kebabCase(value.toString())) : '');
    handlebars.registerHelper('snakeCase', value => value ? new Handlebars.SafeString(_.snakeCase(value.toString())) : '');
    handlebars.registerHelper('resolvePath', value => value ? new Handlebars.SafeString(Path.resolve(value.toString())) : '');
    
    handlebars.registerHelper('isObject', function isType(type, options) {
        if (_.isObject(type)) {
            return options.fn(this);
        }
        else {
            return options.inverse(this);
        }
    });

    handlebars.registerHelper('format', (value, ...params) => {
        params.pop();
        
        return value ? new Handlebars.SafeString(Util.format(value.toString(), ...params)) : '';
    });
    
    handlebars.registerHelper('getListType', function getListType(type, options) {
        if (_.startsWith(type.toString(), 'list:')) {
            return new Handlebars.SafeString(type.toString().slice(5));
        }
        else {
            return '';
        }
    });
    handlebars.registerHelper('getArrayType', function getArrayType(type, options) {
        if (_.startsWith(type.toString(), 'array:')) {
            return new Handlebars.SafeString(type.toString().slice(6));
        }
        else {
            return '';
        }
    });
    handlebars.registerHelper('getUnsafeType', function getUnsafeType(type, options) {
        if (_.startsWith(type.toString(), 'unsafe:')) {
{'fraction_non_alphanumeric': 0.15607556891369687, 'fraction_numerical': 0.0008587376556462001, 'mean_word_length': 3.6730190571715147, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2858258', 'n_tokens_mistral': 1276, 'n_tokens_neox': 1275, 'n_words': 227}