# deckardcain

> Identifies (media) type of API description files

Latest version **1.0.0** (published 2019-06-24) · MIT license · 0 weekly downloads

## Install

```sh
npm install deckardcain
pnpm add deckardcain
yarn add deckardcain
bun add deckardcain
```

## 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 | 2019-06-24 |
| First published | 2015-08-26 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 9.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 6 |
| Author | Apiary Inc |
| Maintainers | apiary, apiary-sre, freaz, honzajavorek, jackub, kubakubula |
| Keywords | Apiary, API Blueprint |

## Links

- npm: https://www.npmjs.com/package/deckardcain
- Repository: https://github.com/apiaryio/deckardcain
- Issues: https://github.com/apiaryio/deckardcain/issues
- npm.io page: https://npm.io/package/deckardcain

## Recent versions

- 1.0.0 (latest) — 2019-06-24
- 0.4.1 — 2019-01-30
- 0.4.0 — 2018-11-27
- 0.3.5 — 2018-10-31
- 0.3.4 — 2018-02-20
- 0.3.3 — 2016-12-19
- 0.3.2 — 2015-12-02
- 0.3.1 — 2015-12-01
- 0.3.0 — 2015-11-20
- 0.2.1 — 2015-11-19
- 0.2.0 — 2015-11-16
- 0.1.6 — 2015-09-11
- 0.1.5 — 2015-09-11
- 0.1.4 — 2015-09-02
- 0.1.3 — 2015-08-26

## README

# Deckard Cain

[![Build Status](https://travis-ci.org/apiaryio/deckardcain.svg?branch=master)](https://travis-ci.org/apiaryio/deckardcain)

[*"As a token of my gratitude, I will identify items for you at no charge."*](https://www.youtube.com/watch?v=TEMCYmIYouE)

## Introduction

Deckard Cain library identifies (media) type of API description files.

### Supported API description formats

- [API Blueprint](https://apiblueprint.org/) - `text/vnd.apiblueprint`
- Legacy Apiary Blueprint (predecessor of API Blueprint) - `text/vnd.legacyblueprint`
- Swagger - `application/swagger+json` (according to [swagger-api/swagger-spec#110](https://github.com/swagger-api/swagger-spec/issues/110)) and `application/swagger+yaml`
- [API Description Namespace](https://github.com/refractproject/refract-spec/blob/master/namespaces/api-description-namespace.md) - `application/vnd.refract.api-description+json` and `application/vnd.refract.api-description+yaml`

## Install

```
npm install deckardcain
```

## Usage

```javascript
import {identify} from 'deckardcain';

identify(`
HOST: http://example.com

--- API Name ---

All Messages
GET /messages
< 200
`) // 'text/vnd.legacyblueprint'

identify(`
FORMAT: 1A
HOST: http://example.com

# API Name

## Group Messages

### All Messages [/messages]

#### Read [GET]

+ Response 200 (text/plain)
`) // 'text/vnd.apiblueprint'
```

## Contribute

Please mind the library is written in ECMAScript 6.

### Installation

```
git clone https://github.com/apiaryio/deckardcain
cd deckardcain
npm install
```

### Testing

```
npm test
```

See also the `.travis.yml` file.

### Workflow

Source code is located in the `./src` folder and gets automatically transpiled into `./lib` folder when `npm install` or `npm publish` is invoked. However, should you need to transpile it manually, use `npm run compile`.

## Name

Deckard Cain library pays tribute to a fictional character from [Diablo video game series](https://en.wikipedia.org/wiki/Diablo_%28series%29). In Diablo II, [Deckard Cain](https://en.wikipedia.org/wiki/Characters_of_Diablo#Deckard_Cain) provides his wisdom and **identifies items for free** after being rescued by the player.

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