<commit_before>var R          = require('ramda');
var path       = require('path');
var lutils     = require('loader-utils');
var svgToReact = require('./index');
var titleCase  = require('./util/title-case')(/[_-]/);

function titleCaseBasename (filepath) {
    var ext = path.extname(filepath);
    var base = path.basename(filepath, ext);
    return titleCase(base);
}

function mapKeyValue (acc, cur) {
    var keyValue = cur.split(':');
    acc[keyValue[0]] = keyValue[1];
    return acc;
}

module.exports = function svgReactLoader (source) {
    var context   = this;
    var callback  = context.async();
    var ctxOpts   = context.svgReactLoader;
    var filters   = ctxOpts && ctxOpts.filters || [];
    var query     = lutils.parseQuery(context.query);
    var rsrcQuery = lutils.parseQuery(context.resourceQuery);
    var params    = R.merge(query, rsrcQuery);

    var displayName   = params.name || titleCaseBasename(context.resourcePath);
    var tagname       = params.tag;
    var tagprops      = params.props || params.attrs;
    var propsMap      = params.propsMap || {};
    var raw           = params.raw;
    var xmlnsTest     = params.xmlnsTest;
    var classIdPrefix = params.classIdPrefix || false;

    context.cacheable();

    var options = { displayName: displayName };<commit_msg>[Fix #62] Guard against undefined query or resourceQuery<commit_after>var R          = require('ramda');
var path       = require('path');
var lutils     = require('loader-utils');
var svgToReact = require('./index');
var titleCase  = require('./util/title-case')(/[_-]/);

function titleCaseBasename (filepath) {
    var ext = path.extname(filepath);
    var base = path.basename(filepath, ext);
    return titleCase(base);
}

function mapKeyValue (acc, cur) {
    var keyValue = cur.split(':');
    acc[keyValue[0]] = keyValue[1];
    return acc;
}

module.exports = function svgReactLoader (source) {
    var context   = this;
    var callback  = context.async();
    var ctxOpts   = context.svgReactLoader;
    var filters   = ctxOpts && ctxOpts.filters || [];
    var query     = context.query && lutils.parseQuery(context.query);
    var rsrcQuery = context.resourceQuery && lutils.parseQuery(context.resourceQuery);
    var params    = R.merge(query || {}, rsrcQuery || {});

    var displayName   = params.name || titleCaseBasename(context.resourcePath);
    var tagname       = params.tag;
    var tagprops      = params.props || params.attrs;
    var propsMap      = params.propsMap || {};
    var raw           = params.raw;
    var xmlnsTest     = params.xmlnsTest;
    var classIdPrefix = params.classIdPrefix || false;

    context.cacheable();

    var options = { displayName: displayName };
{'fraction_non_alphanumeric': 0.13360323886639677, 'fraction_numerical': 0.002208317997791682, 'mean_word_length': 3.068862275449102, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, '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': '3983479', 'n_tokens_mistral': 817, 'n_tokens_neox': 820, 'n_words': 197}