1
0
mirror of https://github.com/garraflavatra/alphabets.git synced 2024-11-21 22:59:03 +01:00
alphabets/README.md

71 lines
1.6 KiB
Markdown
Raw Normal View History

2021-05-24 12:32:23 +02:00
# Alphabets
2023-05-04 19:25:45 +02:00
A tiny JS dependency which exports many alphabets for many use cases.
2021-05-24 17:31:20 +02:00
2023-05-04 19:25:45 +02:00
## Why
2021-05-24 13:42:06 +02:00
2023-05-04 19:25:45 +02:00
I have seen code like this:
2021-05-24 12:32:23 +02: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 19:25:45 +02:00
My opinion about this: it's ugly, and it pollutes your code. Instead, you should do it like so:
2021-05-24 12:32:23 +02:00
```js
import { latin } from 'alphabets';
// or
const alphabets = require('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-05-04 19:25:45 +02:00
Use npm: [`npm i alphabets`](https://www.npmjs.com/package/alphabets). Or if you prefer Yarn: `yarn 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-05-04 19:25:45 +02:00
See below for usage instructions.
2021-05-24 12:32:23 +02:00
2023-05-04 19:25:45 +02:00
| Alphabet | Export name |
|------|-------------|
| Danish | `danish` |
| Faroese | `faroese` |
| Greek (modern) | `greek` |
| Greek (ancient/polytonic) | `greekPolytonic` |
| Icelandic | `icelandic` |
| Latin (abcdefg etc.) | `latin` |
| Norwegian | `norwegian` |
| Russian | `russian` |
| Swedish | `swedish` |
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-04 19:25:45 +02:00
For the full copyright and license information, please view the [`license.md`](./license.md) file that was distributed with this source code.