2021-05-24 10:32:23 +00:00
# Alphabets
2023-05-04 17:25:45 +00:00
A tiny JS dependency which exports many alphabets for many use cases.
2021-05-24 15:31:20 +00:00
2023-05-04 17:44:05 +00:00
[![npm ](https://img.shields.io/npm/v/alphabets )](https://www.npmjs.com/package/alphabets)
[![Stand With Ukraine ](https://raw.githubusercontent.com/vshymanskyy/StandWithUkraine/main/badges/StandWithUkraine.svg )](https://stand-with-ukraine.pp.ua)
2023-05-04 17:25:45 +00:00
## Why
2021-05-24 11:42:06 +00:00
2023-05-04 17:25:45 +00:00
I have seen code like this:
2021-05-24 10:32:23 +00:00
```js
const alphabet = 'abcdefghijklmnopqrstuvwxyz'.split('');
```
Or worse:
```js
const alphabet = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"];
```
2023-05-04 17:25:45 +00:00
My opinion about this: it's ugly, and it pollutes your code. Instead, you should do it like so:
2021-05-24 10:32:23 +00:00
```js
import { latin } from 'alphabets';
// or
const alphabets = require('alphabets');
2023-05-04 17:25:45 +00:00
doSomethingWithTheAlphabet(latin);
2021-05-24 10:32:23 +00:00
```
2023-05-04 17:25:45 +00:00
Much cleaner, right?
2021-05-24 10:32:23 +00:00
## Installation
2023-05-04 17:25:45 +00:00
Use npm: [`npm i alphabets` ](https://www.npmjs.com/package/alphabets ). Or if you prefer Yarn: `yarn add alphabets` .
2021-05-24 10:32:23 +00:00
2023-05-04 17:25:45 +00:00
## Supported alphabets
2021-05-24 10:32:23 +00:00
2023-05-04 17:25:45 +00:00
See below for usage instructions.
2021-05-24 10:32:23 +00:00
2023-05-04 17:25:45 +00:00
| Alphabet | Export name |
|------|-------------|
| Danish | `danish` |
| Faroese | `faroese` |
| Greek (modern) | `greek` |
| Greek (ancient/polytonic) | `greekPolytonic` |
| Icelandic | `icelandic` |
| Latin (abcdefg etc.) | `latin` |
2023-05-05 10:45:04 +00:00
| [NATO phonetic alphabet ](https://en.wikipedia.org/wiki/NATO_phonetic_alphabet ) | `nato` |
2023-05-04 17:25:45 +00:00
| Norwegian | `norwegian` |
| Russian | `russian` |
| Swedish | `swedish` |
2023-05-04 17:44:05 +00:00
| Ukrainian | `ukrainian` |
2021-05-24 10:32:23 +00:00
2023-05-04 17:25:45 +00:00
## How to use
2021-05-24 10:32:23 +00:00
2023-05-04 17:25:45 +00:00
Replace `<alphabetYouWantToUse>` with an alphabet identifier this package supports:
2021-05-24 10:32:23 +00:00
```js
import { < alphabetYouWantToUse > } from 'alphabets';
```
or:
```js
const alphabets = require('alphabets');
console.log(alphabets.< alphabetYouWantToUse > );
```
2023-05-04 17:25:45 +00:00
## Copyright
2021-05-24 10:32:23 +00:00
2023-05-04 17:25:45 +00:00
(c) 2021-2023 Romein van Buren. Licensed under the MIT license.
2021-05-24 10:32:23 +00:00
2023-05-05 10:42:59 +00:00
For the full copyright and license information, please view the [`LICENSE.md` ](./LICENSE.md ) file that was distributed with this source code.