program-language-detector
TypeScript icon, indicating that this package has built-in type declarations

0.0.12 • Public • Published

program-language-detector

NPM version NPM downloads CircleCI codecov donate

A cross-platform lightweight programming language detector. (🚀 Gzip < 2KB 🚀)

Install

npm i program-language-detector
# or 
yarn add program-language-detector

Usage

const { detect, languages, LANG } = require('program-language-detector')
 
detect('const egoist = new Object();')             // => 'JavaScript'
detect('#app { font-size: 20px; }')                // => 'CSS'
detect('<div id="app"></div>')                     // => 'Html'
detect('List<String> things = new ArrayList<>();') // => 'Java'
// ...
 
languages // => A list of detectable languages
LANG // => A map of detectable languages, whose key and value are both lang name

Detectable languages

  • JavaScript
  • C
  • C++
  • Python
  • Java
  • HTML
  • CSS
  • Ruby
  • Go
  • PHP

Contributing

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request :D

Author

program-language-detector © ulivz, Released under the MIT License.
Authored and maintained by ulivz with help from contributors (list).

github.com/ulivz · GitHub @ulivz

Readme

Keywords

none

Package Sidebar

Install

npm i program-language-detector

Weekly Downloads

17

Version

0.0.12

License

MIT

Unpacked Size

80.4 kB

Total Files

11

Last publish

Collaborators

  • toxichl