{"_id":"@adamlui/programming-languages","name":"@adamlui/programming-languages","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"@adamlui/programming-languages","version":"1.0.0","description":"File extensions for programming languages.","author":{"name":"Adam Lui","email":"adam@kudoai.com","url":"https://github.com/adamlui"},"homepage":"https://github.com/adamlui/js-utils/tree/main/programming-languages/#readme","license":"MIT","funding":[{"type":"github","url":"http://github.com/sponsors/adamlui"},{"type":"ko-fi","url":"https://ko-fi.com/adamlui"},{"type":"paypal","url":"https://paypal.me/adamlui"}],"main":"dist/index.js","scripts":{"build":"node utils/build","bump:patch":"bash utils/bump.sh patch","bump:minor":"bash utils/bump.sh minor","bump:feat":"npm run bump:minor","bump:major":"bash utils/bump.sh major","lint":"eslint . --cache","lint:all":"eslint .","lint:fix":"eslint . --fix --cache","lint:fix-all":"eslint . --fix"},"repository":{"type":"git","url":"git+https://github.com/adamlui/js-utils.git"},"keywords":["bash","c","c#","c++","code-languages","computer-languages","dart","extensions","file‑type-detection","file-extensions","filenames","github","go","java","javascript","kotlin","language-detection","languages","linguist","php","powershell","programming-languages","python","ruby","rust","shell","sql","swift","syntax-highlighting","typescript"],"bugs":{"url":"https://github.com/adamlui/js-utils/issues"},"devDependencies":{"@eslint/json":"^1.2.0","@eslint/markdown":"^8.0.1","@stylistic/eslint-plugin":"^5.10.0","eslint":"^9.39.4","eslint-plugin-import":"^2.32.0","eslint-plugin-regexp":"^3.1.0"},"gitHead":"77e838a4f248392d0f9a2c8bb8d144bb63179b97","_id":"@adamlui/programming-languages@1.0.0","_nodeVersion":"22.15.0","_npmVersion":"11.10.1","dist":{"integrity":"sha512-nnxZbfIfHCkbzaQ9ph+Vz/lRHd4qVqcH3esmilEY+a4Uq1SA+PiwvCpojNJujN1wrVR0F3mIO0XEf/wDYDcNog==","shasum":"063fe06ac3884d21b6b74bd7bd0cf0a0907a5772","tarball":"https://registry.npmjs.org/@adamlui/programming-languages/-/programming-languages-1.0.0.tgz","fileCount":8,"unpackedSize":68826,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQCpP+DFDleoP7P6eNrlKV1ffxtjy7hnLMk0sq7lggtHNAIgf/XY5rztBl1MZ2+z+ub1vK2yulHO2jiJ2Mp8smrbOtY="}]},"_npmUser":{"name":"adamlui","email":"adamlui@protonmail.com"},"directories":{},"maintainers":[{"name":"adamlui","email":"adamlui@protonmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/programming-languages_1.0.0_1776718596848_0.12062791205401124"},"_hasShrinkwrap":false}},"time":{"created":"2026-04-20T20:56:36.721Z","1.0.0":"2026-04-20T20:56:36.994Z","modified":"2026-04-20T20:56:37.273Z"},"maintainers":[{"name":"adamlui","email":"adamlui@protonmail.com"}],"description":"File extensions for programming languages.","homepage":"https://github.com/adamlui/js-utils/tree/main/programming-languages/#readme","keywords":["bash","c","c#","c++","code-languages","computer-languages","dart","extensions","file‑type-detection","file-extensions","filenames","github","go","java","javascript","kotlin","language-detection","languages","linguist","php","powershell","programming-languages","python","ruby","rust","shell","sql","swift","syntax-highlighting","typescript"],"repository":{"type":"git","url":"git+https://github.com/adamlui/js-utils.git"},"author":{"name":"Adam Lui","email":"adam@kudoai.com","url":"https://github.com/adamlui"},"bugs":{"url":"https://github.com/adamlui/js-utils/issues"},"license":"MIT","readme":"<a id=\"top\"></a>\n\n# 💻 programming-languages\n\n<a href=\"https://github.com/adamlui/js-utils/releases/tag/programming-languages-1.0.0\">\n    <img height=31 src=\"https://img.shields.io/badge/Latest_Build-1.0.0-32fcee.svg?logo=icinga&logoColor=white&labelColor=464646&style=for-the-badge\"></a>\n<a href=\"https://github.com/adamlui/js-utils/blob/main/programming-languages/docs/LICENSE.md\">\n    <img height=31 src=\"https://img.shields.io/badge/License-MIT-f99b27.svg?logo=internetarchive&logoColor=white&labelColor=464646&style=for-the-badge\"></a>\n<a href=\"https://www.codefactor.io/repository/github/adamlui/js-utils\">\n    <img height=31 src=\"https://img.shields.io/codefactor/grade/github/adamlui/js-utils?label=Code+Quality&logo=codefactor&logoColor=white&labelColor=464646&color=a0fc55&style=for-the-badge\"></a>\n<a href=\"https://sonarcloud.io/component_measures?metric=vulnerabilities&selected=adamlui_js-utils%3Aprogramming-languages&id=adamlui_js-utils\">\n    <img height=31 src=\"https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fsonarcloud.io%2Fapi%2Fmeasures%2Fcomponent%3Fcomponent%3Dadamlui_js-utils%3Aprogramming-languages%26metricKeys%3Dvulnerabilities&query=%24.component.measures.0.value&style=for-the-badge&logo=sonar&logoColor=white&labelColor=464646&label=Vulnerabilities&color=fafc74\"></a>\n\n> ### _File extensions for programming languages._\n\nIt's just a [JSON file](https://cdn.jsdelivr.net/npm/@adamlui/programming-languages@1.0.0/dist/programming-languages.json), so you can use it in any environment. Sourced from GitHub's [Linguist](https://github.com/github-linguist/linguist) project (defines all 700+ languages known to GitHub). Data is updated via script and released via new package version.\n\n<a href=\"#\"><img style=\"height:10px ; width:100%\" src=\"https://cdn.jsdelivr.net/gh/adamlui/js-utils@6b0d399/assets/images/separators/aqua-gradient.png\"></a>\n\n## ⚡ Installation\n\nFrom your project root:\n\n```bash\nnpm install @adamlui/programming-languages\n```\n\n<hr>\n\n## 🔌 Usage\n\n#### <a href=\"#-es-modules-esm\"><img height=13 width=\"auto\" src=\"https://cdn.jsdelivr.net/gh/adamlui/js-utils@dbdea4b/assets/images/icons/module-systems/esm/icon32.png\"></a> ES Modules (ESM):\n\n```js\nimport programmingLangs from '@adamlui/programming-languages'\n\npyLangData = programmingLangs.Python\n\nconsole.log(pyLangData.extensions) // => [ '.cgi', '.fcgi', '.gyp', ... ]\n```\n\n#### <a href=\"#-commonjs-cjs\"><img height=13 width=\"auto\" src=\"https://cdn.jsdelivr.net/gh/adamlui/js-utils@dbdea4b/assets/images/icons/module-systems/cjs/icon32.png\"></a> CommonJS (CJS):\n\n```js\nconst programmingLangs = require('@adamlui/programming-languages')\n\npyLangData = programmingLangs.Python\n\nconsole.log(pyLangData.extensions) // => [ '.cgi', '.fcgi', '.gyp', ... ]\n```\n\n<hr>\n\n## 💻 Examples\n\nGet language(s) from an extension:\n\n```js\nfunction getLang(fileExt) {\n    const langMatches = Object.entries(programmingLangs)\n        .filter(([_, data]) => data.extensions.includes(fileExt))\n        .map(([lang]) => lang)\n    return langMatches.length == 1 ? langMatches[0] : langMatches\n}\n\nconsole.log(getLang('.al')) // => [ 'AL', 'Perl' ]\n```\n\nGet language(s) from a file path:\n\n```js\nfunction getLangFromPath(filepath) {\n    const fileExt = filepath.slice(filepath.lastIndexOf('.'))\n    const langMatches = Object.entries(programmingLangs)\n        .filter(([_, data]) => data.extensions.includes(fileExt))\n        .map(([lang]) => lang)\n    return langMatches.length == 1 ? langMatches[0] : langMatches\n}\n\nconsole.log(getLangFromPath('main.rs')) // => [ 'RenderScript', 'Rust' ]\nconsole.log(getLangFromPath('script.kt'))  // => Kotlin\nconsole.log(getLangFromPath('data.avsc'))  // => [] (use data-languages pkg)\n```\n\n<hr>\n\n## MIT License\n\nCopyright © 2026 [Adam Lui](https://github.com/adamlui)\n\n<hr>\n\n## 📜 Related\n\n<!-- DATA-LANGUAGES -->\n\n<details>\n    <summary><b>🧾 data-languages</b></summary>\n    <br>\n    <a href=\"https://github.com/adamlui/js-utils/tree/main/data-languages/#readme\">\n        <img width=\"555\" height=\"auto\" src=\"https://cdn.jsdelivr.net/gh/adamlui/js-utils@latest/data-languages/assets/images/dataset-preview.png\">\n    </a>\n</details>\n\n> [<img height=14 width=\"auto\" src=\"https://cdn.jsdelivr.net/gh//adamlui/js-utils@dbdea4b/assets/images/icons/runtimes/node.js/icon25x28.png\">][data-langs-install]\n> [Install][data-langs-install] /\n> [<picture><source media=\"(prefers-color-scheme: dark)\" srcset=\"https://cdn.jsdelivr.net/gh/adamlui/userscripts@13443c3/assets/images/icons/paper-sheet/white.svg\"><img height=\"13\" src=\"https://cdn.jsdelivr.net/gh/adamlui/userscripts@13443c3/assets/images/icons/paper-sheet/black.svg\"></picture>][data-langs-readme]\n> [Readme][data-langs-readme] /\n> 🔌 [API usage][data-langs-api-usage] /\n> [<picture><source media=\"(prefers-color-scheme: dark)\" srcset=\"https://cdn.jsdelivr.net/gh/adamlui/userscripts@13443c3/assets/images/icons/speech-bubble-square/white.svg\"><img height=\"12.5\" src=\"https://cdn.jsdelivr.net/gh/adamlui/userscripts@13443c3/assets/images/icons/speech-bubble-square/black.svg\"></picture>][data-langs-discuss]\n> [Discuss][data-langs-discuss]\n\n[data-langs-install]: https://github.com/adamlui/js-utils/tree/main/data-languages/#-installation\n[data-langs-readme]: https://github.com/adamlui/js-utils/tree/main/data-languages/#readme\n[data-langs-api-usage]: https://github.com/adamlui/js-utils/tree/main/data-languages/#-usage\n[data-langs-discuss]: https://github.com/adamlui/js-utils/discussions\n\n<!-- programming-languages (PYTHON) -->\n\n<details>\n    <summary><b>💻 programming-languages (Python)</b></summary>\n    <br>\n    <a href=\"https://github.com/adamlui/python-utils/tree/main/programming-languages/#readme\">\n        <img width=\"555\" height=\"auto\" src=\"https://cdn.jsdelivr.net/gh/adamlui/python-utils@4229cfe/programming-languages/assets/images/dataset-preview.png\">\n    </a>\n</details>\n\n> [<img height=14 width=\"auto\" src=\"https://cdn.jsdelivr.net/gh/adamlui/python-utils@b110c1e/assets/images/icons/python/icon32.png\">][progrmaming-langs-py-install]\n> [Install][progrmaming-langs-py-install] /\n> [<picture><source media=\"(prefers-color-scheme: dark)\" srcset=\"https://cdn.jsdelivr.net/gh/adamlui/userscripts@13443c3/assets/images/icons/paper-sheet/white.svg\"><img height=\"13\" src=\"https://cdn.jsdelivr.net/gh/adamlui/userscripts@13443c3/assets/images/icons/paper-sheet/black.svg\"></picture>][progrmaming-langs-py-readme]\n> [Readme][progrmaming-langs-py-readme] /\n> 🔌 [API usage][progrmaming-langs-py-api-usage] /\n> [<picture><source media=\"(prefers-color-scheme: dark)\" srcset=\"https://cdn.jsdelivr.net/gh/adamlui/userscripts@13443c3/assets/images/icons/speech-bubble-square/white.svg\"><img height=\"12.5\" src=\"https://cdn.jsdelivr.net/gh/adamlui/userscripts@13443c3/assets/images/icons/speech-bubble-square/black.svg\"></picture>][progrmaming-langs-py-discuss]\n> [Discuss][progrmaming-langs-py-discuss]\n\n[progrmaming-langs-py-install]: https://github.com/adamlui/python-utils/tree/main/programming-languages/#installation\n[progrmaming-langs-py-readme]: https://github.com/adamlui/python-utils/tree/main/programming-languages/#readme\n[progrmaming-langs-py-api-usage]: https://github.com/adamlui/python-utils/tree/main/programming-languages/#usage\n[progrmaming-langs-py-discuss]: https://github.com/adamlui/python-utils/discussions\n\n\n<!-- FOOTER -->\n\n\n<a href=\"#\"><img style=\"height:10px ; width:100%\" src=\"https://cdn.jsdelivr.net/gh/adamlui/js-utils@6b0d399/assets/images/separators/aqua-gradient.png\"></a>\n\n[<picture><source media=\"(prefers-color-scheme: dark)\" srcset=\"https://cdn.jsdelivr.net/gh/adamlui/js-utils@21bf981/assets/images/icons/home/white/icon32x27.png\"><img height=13 src=\"https://cdn.jsdelivr.net/gh/adamlui/js-utils@21bf981/assets/images/icons/home/dark-gray/icon32x27.png\"></picture>][js-utils]\n[**More JavaScript utilities**][js-utils] /\n<a href=\"https://github.com/adamlui/js-utils/discussions\">Discuss</a> /\n<a href=\"https://github.com/adamlui/js-utils/issues\">Report bug</a> /\n<a href=\"mailto:security@tidelift.com\">Report vulnerability</a> /\n<a href=\"#top\">Back to top ↑</a>\n\n[js-utils]: https://github.com/adamlui/js-utils/#readme\n","readmeFilename":"README.md","_rev":"1-39eb68a4c10d8bc91e1deaeba813f450"}