src/JSUtils/Preferences.js
function Preferences(prefs) {
        var BASE_EXCLUDED_DIRECTORIES = null, /* if the user has settings, we don't exclude anything by default */
            // exclude node_modules for performance reasons and because we don't do full hinting for those anyhow.
            DEFAULT_EXCLUDED_DIRECTORIES = /node_modules/,
            // exclude require and jquery since we have special knowledge of those
            BASE_EXCLUDED_FILES = /^require.*\.js$|^jquery.*\.js$/,
            DEFAULT_MAX_FILE_COUNT = 100,
            DEFAULT_MAX_FILE_SIZE = 512 * 1024;

        if (prefs) {
            this._excludedDirectories = settingsToRegExp(prefs["excluded-directories"],
                                                         BASE_EXCLUDED_DIRECTORIES,
                                                         DEFAULT_EXCLUDED_DIRECTORIES);
            this._excludedFiles = settingsToRegExp(prefs["excluded-files"],
                BASE_EXCLUDED_FILES);
            this._maxFileCount = prefs["max-file-count"];
            this._maxFileSize = prefs["max-file-size"];

            // sanity check values
            if (!this._maxFileCount || this._maxFileCount < 0) {
                this._maxFileCount = DEFAULT_MAX_FILE_COUNT;
            }

            if (!this._maxFileSize || this._maxFileSize < 0) {
                this._maxFileSize = DEFAULT_MAX_FILE_SIZE;
            }

        } else {
            this._excludedDirectories = DEFAULT_EXCLUDED_DIRECTORIES;
            this._excludedFiles = BASE_EXCLUDED_FILES;
            this._maxFileCount = DEFAULT_MAX_FILE_COUNT;
            this._maxFileSize = DEFAULT_MAX_FILE_SIZE;
        }
    }
function Preferences(prefs) {
        var BASE_EXCLUDED_DIRECTORIES = null, /* if the user has settings, we don't exclude anything by default */
            // exclude node_modules for performance reasons and because we don't do full hinting for those anyhow.
            DEFAULT_EXCLUDED_DIRECTORIES = /node_modules/,
            // exclude require and jquery since we have special knowledge of those
            BASE_EXCLUDED_FILES = /^require.*\.js$|^jquery.*\.js$/,
            DEFAULT_MAX_FILE_COUNT = 100,
            DEFAULT_MAX_FILE_SIZE = 512 * 1024;

        if (prefs) {
            this._excludedDirectories = settingsToRegExp(prefs["excluded-directories"],
                                                         BASE_EXCLUDED_DIRECTORIES,
                                                         DEFAULT_EXCLUDED_DIRECTORIES);
            this._excludedFiles = settingsToRegExp(prefs["excluded-files"],
                BASE_EXCLUDED_FILES);
            this._maxFileCount = prefs["max-file-count"];
            this._maxFileSize = prefs["max-file-size"];

            // sanity check values
            if (!this._maxFileCount || this._maxFileCount < 0) {
                this._maxFileCount = DEFAULT_MAX_FILE_COUNT;
            }

            if (!this._maxFileSize || this._maxFileSize < 0) {
                this._maxFileSize = DEFAULT_MAX_FILE_SIZE;
            }

        } else {
            this._excludedDirectories = DEFAULT_EXCLUDED_DIRECTORIES;
            this._excludedFiles = BASE_EXCLUDED_FILES;
            this._maxFileCount = DEFAULT_MAX_FILE_COUNT;
            this._maxFileSize = DEFAULT_MAX_FILE_SIZE;
        }
    }
function Preferences ( prefs ) { var BASE_EXCLUDED_DIRECTORIES = null , /* if the user has settings, we don't exclude anything by default */ // exclude node_modules for performance reasons and because we don't do full hinting for those anyhow. DEFAULT_EXCLUDED_DIRECTORIES = / node_modules / , // exclude require and jquery since we have special knowledge of those BASE_EXCLUDED_FILES = / ^require.*\.js$|^jquery.*\.js$ / , DEFAULT_MAX_FILE_COUNT = 100 , DEFAULT_MAX_FILE_SIZE = 512 * 1024 ; if ( prefs ) { this . _excludedDirectories = settingsToRegExp ( prefs [ "excluded-directories" ] , BASE_EXCLUDED_DIRECTORIES , DEFAULT_EXCLUDED_DIRECTORIES ) ; this . _excludedFiles = settingsToRegExp ( prefs [ "excluded-files" ] , BASE_EXCLUDED_FILES ) ; this . _maxFileCount = prefs [ "max-file-count" ] ; this . _maxFileSize = prefs [ "max-file-size" ] ; // sanity check values if ( ! this . _maxFileCount || this . _maxFileCount < 0 ) { this . _maxFileCount = DEFAULT_MAX_FILE_COUNT ; } if ( ! this . _maxFileSize || this . _maxFileSize < 0 ) { this . _maxFileSize = DEFAULT_MAX_FILE_SIZE ; } } else { this . _excludedDirectories = DEFAULT_EXCLUDED_DIRECTORIES ; this . _excludedFiles = BASE_EXCLUDED_FILES ; this . _maxFileCount = DEFAULT_MAX_FILE_COUNT ; this . _maxFileSize = DEFAULT_MAX_FILE_SIZE ; } }
Constructor to create a default preference object.

@constructor
@param {Object=} prefs - preference object
Constructor to create a default preference object .