1
0
mirror of https://github.com/garraflavatra/alphabets.git synced 2024-11-22 10:27:36 +01:00
alphabets/README.md

83 lines
2.8 KiB
Markdown
Raw Normal View History

2021-05-24 12:32:23 +02:00
# Alphabets
2023-08-07 20:43:05 +02:00
A tiny JS package that exports many different alphabets for many different use cases.
2021-05-24 17:31:20 +02: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 19:25:45 +02:00
## Why
2021-05-24 13:42:06 +02:00
2023-08-07 19:07:12 +02:00
I have seen [code like this]:
2021-05-24 12:32:23 +02:00
```js
const alphabet = 'abcdefghijklmnopqrstuvwxyz'.split('');
```
2023-08-07 19:07:12 +02:00
Or [worse]:
2021-05-24 12:32:23 +02:00
```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"];
```
My opinion about this: it's ugly, and it pollutes your code. Instead, why not [do it like this](#how-to-use):
2021-05-24 12:32:23 +02:00
```js
import { latin } from 'alphabets';
2023-05-04 19:25:45 +02:00
doSomethingWithTheAlphabet(latin);
2021-05-24 12:32:23 +02:00
```
2023-05-04 19:25:45 +02:00
Much cleaner, right?
2021-05-24 12:32:23 +02:00
## Installation
2023-08-07 18:54:13 +02:00
Install the [alphabets npm module](https://www.npmjs.com/package/alphabets) using your preferred package manager:
* npm: `npm install alphabets`
* Yarn: `yarn add alphabets`
* pnpm: `pnpm add alphabets`
2021-05-24 12:32:23 +02:00
2023-05-04 19:25:45 +02:00
## Supported alphabets
2021-05-24 12:32:23 +02:00
2023-08-07 18:54:13 +02:00
See below for [usage instructions](#how-to-use).
2021-05-24 12:32:23 +02:00
2023-08-07 19:07:12 +02:00
| Alphabet | Export name |
|---------------------------|------------------|
| Danish | `danish` |
| Faroese | `faroese` |
| Greek (modern) | `greek` |
2023-05-04 19:25:45 +02:00
| Greek (ancient/polytonic) | `greekPolytonic` |
2023-08-07 19:07:12 +02:00
| Icelandic | `icelandic` |
| Latin (abcdefg etc.) | `latin` |
| [NATO phonetic alphabet] | `nato` |
| Norwegian | `norwegian` |
| Russian | `russian` |
| Swedish | `swedish` |
| Ukrainian | `ukrainian` |
2021-05-24 12:32:23 +02:00
2023-05-04 19:25:45 +02:00
## How to use
2021-05-24 12:32:23 +02:00
2023-05-04 19:25:45 +02:00
Replace `<alphabetYouWantToUse>` with an alphabet identifier this package supports:
2021-05-24 12:32:23 +02:00
```js
import { <alphabetYouWantToUse> } from 'alphabets';
```
or:
```js
const alphabets = require('alphabets');
console.log(alphabets.<alphabetYouWantToUse>);
```
2023-05-04 19:25:45 +02:00
## Copyright
2021-05-24 12:32:23 +02:00
2023-05-04 19:25:45 +02:00
(c) 2021-2023 Romein van Buren. Licensed under the MIT license.
2021-05-24 12:32:23 +02:00
2023-05-05 12:42:59 +02:00
For the full copyright and license information, please view the [`LICENSE.md`](./LICENSE.md) file that was distributed with this source code.
2023-08-07 19:07:12 +02:00
[code like this]: https://github.com/search?q=%27abcdefghijklmnopqrstuvwxyz%27.split%28%27%27%29+language%3AJavaScript&type=code&l=JavaScript
[worse]: https://github.com/search?q=%5B%22a%22%2C+%22b%22%2C+%22c%22%2C+%22d%22%2C+%22e%22%2C+%22f%22%2C+%22g%22%2C+%22h%22%2C+%22i%22%2C+%22j%22%2C+%22k%22%2C+%22l%22%2C+%22m%22%2C+%22n%22%2C+%22o%22%2C+%22p%22%2C+%22q%22%2C+%22r%22%2C+%22s%22%2C+%22t%22%2C+%22u%22%2C+%22v%22%2C+%22w%22%2C+%22x%22%2C+%22y%22%2C+%22z%22%5D+language%3AJavaScript&type=code&l=JavaScript
[NATO phonetic alphabet]: https://en.wikipedia.org/wiki/NATO_phonetic_alphabet