# guess-programming-language

> Naive programming language guessing built on top of highlight.js

Latest version **1.0.0** (published 2018-08-08) · MIT license · 0 weekly downloads

## Install

```sh
npm install guess-programming-language
pnpm add guess-programming-language
yarn add guess-programming-language
bun add guess-programming-language
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2018-08-08 |
| First published | 2018-08-08 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=8.6 |
| Dependencies | 1 |
| Unpacked size | 2.7 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 3 |
| Maintainers | rafaelrinaldi |
| Keywords | guess, programming, language |

## Links

- npm: https://www.npmjs.com/package/guess-programming-language
- Repository: https://github.com/rafaelrinaldi/guess-programming-language
- Homepage: https://github.com/rafaelrinaldi/guess-programming-language#readme
- Issues: https://github.com/rafaelrinaldi/guess-programming-language/issues
- npm.io page: https://npm.io/package/guess-programming-language

## Dependencies (1)

- [highlight.js](https://npm.io/package/highlight.js.md) ^9.12.0

## Recent versions

- 1.0.0 (latest) — 2018-08-08

## README

# guess-programming-language [![Build Status](https://semaphoreci.com/api/v1/rafaelrinaldi/guess-programming-language/branches/master/badge.svg)](https://semaphoreci.com/rafaelrinaldi/guess-programming-language)

> Naive programming language guessing built on top of [highlight.js][highlight.js]

[highlight.js]: https://github.com/highlightjs/highlight.js

## Install

```sh
npm i guess-programming-language
```

## Usage

```js
import guessProgrammingLanguage from 'guess-programming-language'

async function run() {
  console.log(
    await guessProgrammingLanguage('const foo = "bar";')
  ) //=> javascript
}

run()
```

## API

### `guessProgrammingLanguage(value)`

Returns a `Promise` instance that resolves to the programming language name (lower case) if a match is found or `null` if no match is found.

#### `value`

Type: `String`

Value for the programming language to guess.


## Why

- [highlight.js][highlight.js] is great and its guessing mechanism is good enough for most cases I needed it for
- Most libraries I've tried either have confusing APIs or require Node.js C bindings that fails to build when npm installing it

## Gotchas

- If you're looking for something super precise this is not it
- This library currently only works in Node.js, feel free to send a PR if you want to add browser support

## License

MIT © [Rafael Rinaldi](https://rinaldi.io)

---

<p align="center">
  <a href="https://buymeacoff.ee/rinaldi" title="Buy me a coffee">Buy me a ☕</a>
</p>

---
_Source: https://npm.io/package/guess-programming-language · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
