0.0.7 • Published 1 year ago
get-language-data v0.0.7
get-language-data
A collection of Programming Language data.
Features
- Language name
- File extension
- Naming convention
- Logo
- Language Tag (PrismJS)
Getting Started
npm install get-language-data
or, if you prefer yarn
:
yarn add get-language-data
How to Use
getLanguageData
// 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
renameFile
// 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
Available Languages Data
Language | File Extension | Naming Convention | Tag | Logo |
---|---|---|---|---|
C | c cats h idc w | PascalCase | c | |
C# | cs cake cshtml csx | PascalCase | csharp | |
C++ | cpp c++ cc cp cxx h h++ hh hpp hxx inc inl ipp tcc tpp | PascalCase | cpp | |
Dart | dart | PascalCase | dart | |
F# | fs fsi fsx | PascalCase | fsharp | |
GO | go | snake_case | go | |
Haskell | hs hsc | snake_case | haskell | |
Java | java | PascalCase | java | |
JavaScript | js _js bones es es6 frag gs jake jsb jscad jsfl jsm jss njs pac sjs ssjs sublime-build sublime-commands sublime-completions sublime-keymap sublime-macro sublime-menu sublime-mousemap sublime-project sublime-settings sublime-theme sublime-workspace sublime_metrics sublime_session xsjs xsjslib | PascalCase | javascript | |
Julia | jl | snake_case | julia | |
Kotlin | kt ktm kts | PascalCase | kotlin | |
Perl | pl al cgi fcgi perl ph plx pm pod psgi t | snake_case | perl | |
PHP | php aw ctp fcgi inc php3 php4 php5 phps phpt | snake_case | php | |
Python | py bzl cgi fcgi gyp lmi pyde pyp pyt pyw rpy tac wsgi xpy | snake_case | python | |
R | r rd rsx | snake_case | r | |
Ruby | rb builder fcgi gemspec god irbrc jbuilder mspec pluginspec podspec rabl rake rbuild rbw rbx ru ruby thor watchr | PascalCase | ruby | |
Rust | rs rs.in | snake_case | rust | |
Scala | scala sbt sc | camelCase | scala | |
Swift | swift | PascalCase | swift | |
TypeScript | ts tsx | PascalCase | typescript |
Join us in discussions
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.