UNPKG

@mutasim77/loc-counter

Version:

A powerful lines of code counter with detailed statistics

167 lines (166 loc) 4.25 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.LANGUAGES = void 0; exports.getLanguageByExtension = getLanguageByExtension; exports.LANGUAGES = [ { name: 'JavaScript', extensions: ['.js', '.mjs', '.cjs'], commentPatterns: { singleLine: ['//'], multiLine: [{ start: '/*', end: '*/' }] } }, { name: 'TypeScript', extensions: ['.ts', '.mts', '.cts'], commentPatterns: { singleLine: ['//'], multiLine: [{ start: '/*', end: '*/' }] } }, { name: 'JSX', extensions: ['.jsx'], commentPatterns: { singleLine: ['//'], multiLine: [{ start: '/*', end: '*/' }, { start: '{/*', end: '*/}' }] } }, { name: 'TSX', extensions: ['.tsx'], commentPatterns: { singleLine: ['//'], multiLine: [{ start: '/*', end: '*/' }, { start: '{/*', end: '*/}' }] } }, { name: 'Go', extensions: ['.go'], commentPatterns: { singleLine: ['//'], multiLine: [{ start: '/*', end: '*/' }] } }, { name: 'Python', extensions: ['.py', '.pyw', '.pyx', '.pxd', '.pxi'], commentPatterns: { singleLine: ['#'], multiLine: [{ start: '"""', end: '"""' }, { start: "'''", end: "'''" }] } }, { name: 'C', extensions: ['.c', '.h'], commentPatterns: { singleLine: ['//'], multiLine: [{ start: '/*', end: '*/' }] } }, { name: 'C++', extensions: ['.cpp', '.cc', '.cxx', '.hpp', '.hh', '.hxx'], commentPatterns: { singleLine: ['//'], multiLine: [{ start: '/*', end: '*/' }] } }, { name: 'C#', extensions: ['.cs'], commentPatterns: { singleLine: ['//'], multiLine: [{ start: '/*', end: '*/' }] } }, { name: 'PHP', extensions: ['.php', '.phtml', '.php3', '.php4', '.php5', '.php7', '.phps'], commentPatterns: { singleLine: ['//', '#'], multiLine: [{ start: '/*', end: '*/' }] } }, { name: 'SQL', extensions: ['.sql'], commentPatterns: { singleLine: ['--'], multiLine: [{ start: '/*', end: '*/' }] } }, { name: 'Ruby', extensions: ['.rb', '.rake', '.ru'], commentPatterns: { singleLine: ['#'], multiLine: [{ start: '=begin', end: '=end' }] } }, { name: 'HTML', extensions: ['.html', '.htm', '.xhtml'], commentPatterns: { multiLine: [{ start: '<!--', end: '-->' }] } }, { name: 'CSS', extensions: ['.css'], commentPatterns: { multiLine: [{ start: '/*', end: '*/' }] } }, { name: 'SCSS', extensions: ['.scss'], commentPatterns: { singleLine: ['//'], multiLine: [{ start: '/*', end: '*/' }] } }, { name: 'Java', extensions: ['.java'], commentPatterns: { singleLine: ['//'], multiLine: [{ start: '/*', end: '*/' }] } }, { name: 'Kotlin', extensions: ['.kt', '.kts'], commentPatterns: { singleLine: ['//'], multiLine: [{ start: '/*', end: '*/' }] } }, { name: 'Swift', extensions: ['.swift'], commentPatterns: { singleLine: ['//'], multiLine: [{ start: '/*', end: '*/' }] } }, { name: 'Rust', extensions: ['.rs'], commentPatterns: { singleLine: ['//'], multiLine: [{ start: '/*', end: '*/' }] } }, { name: 'Shell', extensions: ['.sh', '.bash', '.zsh'], commentPatterns: { singleLine: ['#'] } } ]; function getLanguageByExtension(extension) { return exports.LANGUAGES.find(lang => lang.extensions.includes(extension.toLowerCase())); }