<commit_before>// Load modules

var Utils = require('./utils');
var Types = require('./types');


// Declare internals

var internals = {};


exports.Types = exports.types = Types;
exports.Utils = exports.utils = Utils;


exports.settings = {
    skipFunctions: false,
    saveConversions: false
};


exports.validate = function (object, config, next) {

    var self = this;

    var skipFunctions = this.settings.skipFunctions;
    var errors  = new internals.Errors();

    var processConfig = function () {

        var unprocessedObject = Utils.clone(object || {});
        var keys =  Object.keys(config || {});
        for (var i = 0, il = keys.length; i < il; ++ i) {

            var key = keys[i];
            var keyConfig = config[key];
            var value = object ? object[key] : object;
            delete unprocessedObject[key];

            validateKeyConfig(keyConfig, key, value);
        }

        Object.keys(unprocessedObject).forEach(function (unprocessedKey) {

            if (!skipFunctions || typeof unprocessedObject[unprocessedKey] !== 'function') {
                errors.add('the key ' + unprocessedKey + ' is not allowed');
            }
        });<commit_msg>Renaming error message to be the same as previous<commit_after>// Load modules

var Utils = require('./utils');
var Types = require('./types');


// Declare internals

var internals = {};


exports.Types = exports.types = Types;
exports.Utils = exports.utils = Utils;


exports.settings = {
    skipFunctions: false,
    saveConversions: false
};


exports.validate = function (object, config, next) {

    var self = this;

    var skipFunctions = this.settings.skipFunctions;
    var errors  = new internals.Errors();

    var processConfig = function () {

        var unprocessedObject = Utils.clone(object || {});
        var keys =  Object.keys(config || {});
        for (var i = 0, il = keys.length; i < il; ++ i) {

            var key = keys[i];
            var keyConfig = config[key];
            var value = object ? object[key] : object;
            delete unprocessedObject[key];

            validateKeyConfig(keyConfig, key, value);
        }

        Object.keys(unprocessedObject).forEach(function (unprocessedKey) {

            if (!skipFunctions || typeof unprocessedObject[unprocessedKey] !== 'function') {
                errors.add('the key (' + unprocessedKey + ') is not allowed');
            }
        });
{'fraction_non_alphanumeric': 0.12839506172839507, 'fraction_numerical': 0.0008230452674897119, 'mean_word_length': 2.458036984352774, 'pattern_counts': {'":': 0, '<': 5, '<?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': '6044844', 'n_tokens_mistral': 697, 'n_tokens_neox': 653, 'n_words': 180}