# chapter-numbering

> accepts a number and a format and returns a string in the specified format.

Latest version **1.1.3** (published 2016-10-15) · MIT license · 0 weekly downloads

## Install

```sh
npm install chapter-numbering
pnpm add chapter-numbering
yarn add chapter-numbering
bun add chapter-numbering
```

## 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.1.3 |
| Published | 2016-10-15 |
| First published | 2016-09-21 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Rafael Kennedy |
| Maintainers | rafael-kennedy |
| Keywords | javascript |

## Links

- npm: https://www.npmjs.com/package/chapter-numbering
- Repository: https://github.com/rafael-kennedy/chapter-numbering
- Homepage: https://github.com/rafael-kennedy/chapter-numbering#readme
- Issues: https://github.com/rafael-kennedy/chapter-numbering/issues
- npm.io page: https://npm.io/package/chapter-numbering

## Recent versions

- 1.1.3 (latest) — 2016-10-15
- 1.1.2 — 2016-10-03
- 1.1.1 — 2016-09-23
- 1.1.0 — 2016-09-22
- 1.0.1 — 2016-09-21
- 1.0.0 — 2016-09-21

## README

# chapter-numbering

[![JavaScript Style Guide](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com/)

A package for chapter and section numbering.
Handles roman numerals (_Chapter IV_) or consecutive lettering (_Exhibit A_).

## Install
Available as [npm package](https://www.npmjs.com/package/chapter-numbering)

```bash
$ npm install chapter-numbering
```
``` JavaScript
const numbering = require("chapter-numbering")
```
## Usage
### Convert Number to String

The main function accepts a number or array of numbers, and a string describing the output format.

This string can include ruby style interpolation keys #{} with I, i, A, a, #, 1.

You can also pass in a string without keys, and it will simply replace the above characters with the converted number (but watch out with that since it will catch the 'a' in chapter and the 'i' in section.)

``` JavaScript
numbering([4, 5, 6], "Book #{I} - Section #{A}: page #{#}")
// 'Book IV - Section E: page 6'

numbering([4, 5, 6], "i - a - #")
// 'iv - e - 6'
```

You can also use the roman or alpha methods by directly passing them a number:

``` JavaScript
numbering.roman(28)
// 'XXVIII'

numbering.alpha(28)
// 'AB'
```

### Convert String to number
Use the parse object's roman or alpha methods to convert Roman or Alpha to numerals:

``` JavaScript
> numbering.parse.roman('III')
// 3
> numbering.parse.alpha('A')
// 1```

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