0.0.7 • Published 1 year ago

get-language-data v0.0.7

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

get-language-data

A collection of Programming Language data.

CodeFactor Code Size version MIT

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 with file 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

LanguageFile ExtensionNaming ConventionTagLogo
Cc cats h idc wPascalCasec
C#cs cake cshtml csxPascalCasecsharp
C++cpp c++ cc cp cxx h h++ hh hpp hxx inc inl ipp tcc tppPascalCasecpp
DartdartPascalCasedart
F#fs fsi fsxPascalCasefsharp
GOgosnake_casego
Haskellhs hscsnake_casehaskell
JavajavaPascalCasejava
JavaScriptjs _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 xsjslibPascalCasejavascript
Juliajlsnake_casejulia
Kotlinkt ktm ktsPascalCasekotlin
Perlpl al cgi fcgi perl ph plx pm pod psgi tsnake_caseperl
PHPphp aw ctp fcgi inc php3 php4 php5 phps phptsnake_casephp
Pythonpy bzl cgi fcgi gyp lmi pyde pyp pyt pyw rpy tac wsgi xpysnake_casepython
Rr rd rsxsnake_caser
Rubyrb builder fcgi gemspec god irbrc jbuilder mspec pluginspec podspec rabl rake rbuild rbw rbx ru ruby thor watchrPascalCaseruby
Rustrs rs.insnake_caserust
Scalascala sbt sccamelCasescala
SwiftswiftPascalCaseswift
TypeScriptts tsxPascalCasetypescript

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.