A collection of Programming Language data.
- Language name
- File extension
- Naming convention
- Logo
- Language Tag (PrismJS)
npm install get-language-data
or, if you prefer yarn
:
yarn add get-language-data
// Import the `getLanguageData` function from the `get-language-data` package.
import { getLanguageData } from 'get-language-data';
// Call the `getLanguageData` function with the language name, or, file extension.
const languageData = getLanguageData({ name: 'Python' })[0];
// Use the `languageData` object to get the language data.
console.log(languageData.name); // Python
console.log(languageData.fileExtension[0]); // py
console.log(languageData.namingConvention); // snake_case
console.log(languageData.prismTag); // python
console.log(languageData.logo); // https://user-images.githubusercontent.com/54644599/227718034-fe84d827-4f53-4466-b37a-2cdd3e817ba2.png
// Import the `getLanguageData` function from the `get-language-data` package.
import { getLanguageData } from 'get-language-data';
// Call the `getLanguageData` function with the language name, or, file extension.
const languageData = getLanguageData({
prismTag: 'csharp',
})[0];
// // Use the `languageData` object to get the language data.
console.log(languageData.name); // C#
console.log(languageData.fileExtension[0]); // cs
console.log(languageData.namingConvention); // PascalCase
console.log(languageData.prismTag); // csharp
console.log(languageData.logo); // https://user-images.githubusercontent.com/54644599/227718064-c9b9f17a-6f55-4955-85ba-19e2c0420751.png
// Import the `renameFile` function from the `get-language-data` package.
import { renameFile } from 'get-language-data';
// Call the `renameFile` function with the file name and the language name, or, file extension.
const sampleFileName = 'sample-file-name.py';
console.log(renameFile({ fileName: sampleFileName })); // sample_file_name.py
Note: Use
language name
withfile name
to rename file. Because multiple languages can have the same file extension.
import { renameFile } from 'get-language-data';
const sampleFileName = 'sample-file-name.py';
console.log(renameFile({ fileName: sampleFileName, name: 'python' })); // sample_file_name.py
We use GitHub Discussions to talk about all sorts of topics related to documentation and this site. For example: if you'd like help troubleshooting a PR, have a great new idea, or want to share something amazing, join us in the discussions.
|
Made with π by Codinasion