<commit_before>const optionsDefaults = {
    migrate: false,
    disk: true,

    simpleReturn: false,
    sep: '/',
    allowSepDuplications: false,
    allowDriveLetter: true,
    allowGlobPatterns: false,
    allowForbiddenWindowsNames: false,
    allowFobiddenWindowsChars: false,
    allowForbiddenUnixChars: false,
};

const optionsInterface = {
    migrate: (input) => typeof input === 'boolean',
    disk: (input) => typeof input === 'boolean',

    simpleReturn: (input) => typeof input === 'boolean',
    sep: (input) => input === '/' || input === '\\',
    allowSepDuplications: (input) => typeof input === 'boolean',
    allowDriveLetter: (input) => typeof input === 'boolean',
    allowGlobPatterns: (input) => typeof input === 'boolean',
    allowForbiddenWindowsNames: (input) => typeof input === 'boolean',
    allowFobiddenWindowsChars: (input) => typeof input === 'boolean',
    allowForbiddenUnixChars: (input) => typeof input === 'boolean',
};

module.exports = function(options) {

    let checkedOptions = {};

    if (typeof options === 'object' && Array.isArray(options) === false && options !== null) {
        for (let key in options) {
            if (optionsDefaults.hasOwnProperty(key) === true) {
                switch (optionsInterface[key](options[key])) {
                    case true:
                        checkedOptions[key] = options[key];
                        break;
                    case false:
                        checkedOptions[key] = optionsDefaults[key];
                        console.warn(`[valid-path] Unexpected value type for "${key}" option.\nSet to defalut value "${optionsDefaults[key]}"`);
                        break;
                }
            } else {
                console.warn(`[valid-path] Unknown option "${key}"`);
            }
        }

        for (let key in optionsDefaults) {<commit_msg>check if provided options are in old spelling<commit_after>const optionsOld = {
    sepDuplications: 'allowSepDuplications',
    disk: 'allowDriveLetter'
};

const optionsDefaults = {
    migrate: false,

    simpleReturn: false,
    sep: '/',
    allowSepDuplications: false,
    allowDriveLetter: true,
    allowGlobPatterns: false,
    allowForbiddenWindowsNames: false,
    allowFobiddenWindowsChars: false,
    allowForbiddenUnixChars: false,
};

const optionsInterface = {
    migrate: (input) => typeof input === 'boolean',

    simpleReturn: (input) => typeof input === 'boolean',
    sep: (input) => input === '/' || input === '\\',
    allowSepDuplications: (input) => typeof input === 'boolean',
    allowDriveLetter: (input) => typeof input === 'boolean',
    allowGlobPatterns: (input) => typeof input === 'boolean',
    allowForbiddenWindowsNames: (input) => typeof input === 'boolean',
    allowFobiddenWindowsChars: (input) => typeof input === 'boolean',
    allowForbiddenUnixChars: (input) => typeof input === 'boolean',
};

module.exports = function(options) {

    let checkedOptions = {};

    if (typeof options === 'object' && Array.isArray(options) === false && options !== null) {
        for (let optionKey in options) {

            let key = optionKey;

            if (optionsOld.hasOwnProperty(key) === true && options.hasOwnProperty('migrate') === true && options.migrate === true) {
                switch (options.hasOwnProperty(optionsOld[key]) === true) {
                    case true:
                        console.warn(`[valid-path] You've used both "${key}" and "${optionsOld[key]}" options,\nbut "${optionsOld[key]}" is a new spelling of "${key}".`);

                        if (options[key] !== options[optionsOld[key]]) {
                            console.warn(`[valid-path] "${key}" and "${optionsOld[key]}" have different values but mean the same. "valid-path" has taken value of "${optionsOld[key]}" since it is the latest variant of spelling.`);
                        }

                        key = optionsOld[key];

                        break;
                    case false:

                        options[optionsOld[key]] = options[key];
                        key = optionsOld[key];
                        
                        break;
                }

                delete options[optionKey];
            }

            if (optionsDefaults.hasOwnProperty(key) === true) {
                switch (optionsInterface[key](options[key])) {
                    case true:
                        checkedOptions[key] = options[key];
                        break;
                    case false:
                        checkedOptions[key] = optionsDefaults[key];
                        console.warn(`[valid-path] Unexpected value type for "${key}" option.\nSet to defalut value "${optionsDefaults[key]}"`);
                        break;
                }
            } else {
                console.warn(`[valid-path] Unknown option "${key}"`); 
            }
        }

        for (let key in optionsDefaults) {
{'fraction_non_alphanumeric': 0.13631780600927607, 'fraction_numerical': 0.0, 'mean_word_length': 2.113622096672944, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 22, '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': '2816251', 'n_tokens_mistral': 1320, 'n_tokens_neox': 1260, 'n_words': 326}