This JavaScript code defines a configuration object containing lists of file extensions and directory names commonly used in a software project, likely a game. This object can be used for tasks like file filtering, directory navigation, and asset management within the project.
npm run import -- "quake 3 file whitelist"
var imageTypes = [
'.png',
'.jpg',
'.jpeg',
'.tga',
'.gif',
'.pcx',
'.webp',
]
var audioTypes = [
'.opus',
'.wav',
'.mp3',
]
var sourceFiles = [
'.map',
'.scc',
]
var fileTypes = [
'.cfg',
'.qvm',
'.bot',
'.txt',
'.bsp',
'.aas',
'.md3',
'.md5',
'.shader',
'.skin',
'.pk3',
'.c',
'.h',
'.config',
'.menu'
]
var knownDirs = [
'scripts',
'botfiles',
'fonts',
'gfx',
'hud',
'icons',
'include',
'menu',
'models',
'music',
'powerups', // powerup shaders
'sprites',
'sound',
'ui',
'maps',
'textures',
]
module.exports = {
imageTypes,
audioTypes,
sourceFiles,
fileTypes,
knownDirs,
}
/**
* Module exports containing various file type classifications.
*
* @module fileType
*/
const knownDirs = [
'scripts',
'botfiles',
'fonts',
'gfx',
'hud',
'icons',
'include',
'menu',
'models',
'music',
'powerups', // Power-up shaders
'sprites',
'sound',
'ui',
'maps',
'textures',
];
const fileExtensions = {
images: ['.png', '.jpg', '.jpeg', '.tga', '.gif', '.pcx', '.webp'],
audio: ['.opus', '.wav', '.mp3'],
source: ['.map', '.scc'],
files: [
'.cfg',
'.qvm',
'.bot',
'.txt',
'.bsp',
'.aas',
'.md3',
'.md5',
'.shader',
'.skin',
'.pk3',
'.c',
'.h',
'.config',
'.menu',
],
};
/**
* Get the list of known directories.
*
* @function getKnownDirs
* @returns {string[]} List of known directories.
*/
function getKnownDirs() {
return knownDirs;
}
/**
* Get the list of file extensions.
*
* @function getFileExtensions
* @returns {Object} Object containing file extensions grouped by type.
*/
function getFileExtensions() {
return fileExtensions;
}
module.exports = {
getKnownDirs,
getFileExtensions,
};
This code defines a JavaScript object containing lists of file extensions and directory names commonly associated with a specific type of software project (likely a game or similar application).
Key Components:
imageTypes
: An array of common image file extensions (e.g., .png
, .jpg
, .gif
).audioTypes
: An array of common audio file extensions (e.g., .wav
, .mp3
).sourceFiles
: An array of file extensions typically associated with source code or build files (e.g., .map
, .scc
).fileTypes
: A broader array of file extensions potentially found in the project (e.g., configuration files, game assets, scripts).knownDirs
: An array of directory names commonly used in this type of project structure (e.g., scripts
, gfx
, models
, sound
).Purpose:
This object likely serves as a configuration or lookup table within the project. It could be used for: