https://github.com/ulivz/program-language-detector
A cross-platform lightweight programming language detector.
https://github.com/ulivz/program-language-detector
Last synced: 6 months ago
JSON representation
A cross-platform lightweight programming language detector.
- Host: GitHub
- URL: https://github.com/ulivz/program-language-detector
- Owner: ulivz
- License: mit
- Created: 2018-01-26T15:58:28.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2021-05-12T01:27:14.000Z (over 4 years ago)
- Last Synced: 2025-03-28T18:51:53.642Z (6 months ago)
- Language: JavaScript
- Homepage: http://v2js.com/program-language-detector
- Size: 352 KB
- Stars: 5
- Watchers: 1
- Forks: 0
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# program-language-detector
[](https://npmjs.com/package/program-language-detector) [](https://npmjs.com/package/program-language-detector) [](https://circleci.com/gh/ULIVZ/program-language-detector/tree/master) [](https://codecov.io/gh/ULIVZ/program-language-detector)
[](https://github.com/ULIVZ/donate)__*A cross-platform lightweight programming language detector.*__ (๐ Gzip < 2KB ๐)
## Install
```bash
npm i program-language-detector
# or
yarn add program-language-detector
```## Usage
```js
const { detect, languages, LANG } = require('program-language-detector')detect('const egoist = new Object();') // => 'JavaScript'
') // => 'Html'
detect('#app { font-size: 20px; }') // => 'CSS'
detect('
detect('List 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](https://github.com/ULIVZ), Released under the [MIT](./LICENSE) License.
Authored and maintained by ulivz with help from contributors ([list](https://github.com/ULIVZ/program-language-detector/contributors)).> [github.com/ulivz](https://github.com/ulivz) ยท GitHub [@ulivz](https://github.com/ULIVZ)