<commit_before>/**
 * Message for errors when some method is not implemented
 * @type {String}
 * @private
 */
var NEED_IMPLEMENT_MESSAGE = "This method need to implement";

/**
 * BaseHash class
 * @constructor
 */
function BaseHash(options) {
    if (typeof options === 'string') {
        this.setData(options);
    } else if (typeof options === 'object' && options.data) {
        this.setData(options.data);
    } else {
        throw new Error('You need provide data');
    }
}
<commit_msg>Fix bug with array and object data<commit_after>/**
 * Message for errors when some method is not implemented
 * @type {String}
 * @private
 */
var NEED_IMPLEMENT_MESSAGE = "This method need to implement";

/**
 * BaseHash class
 * @constructor
 */
function BaseHash(options) {
    if (!options) {
        throw new Error('You must provide data');
    }

    if (Object.prototype.toString.call(options) === '[object Object]') {
        this.setData(options.data);
    } else {
        this.setData(options);
    }
}

{'fraction_non_alphanumeric': 0.13438735177865613, 'fraction_numerical': 0.0, 'mean_word_length': 3.0846774193548385, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '3548923', 'n_tokens_mistral': 296, 'n_tokens_neox': 294, 'n_words': 90}