mirror of
https://github.com/garraflavatra/alphabets.git
synced 2025-04-20 03:01:02 +00:00
Compare commits
No commits in common. "main" and "v2.0.1" have entirely different histories.
57
CHANGELOG.md
57
CHANGELOG.md
@ -1,57 +0,0 @@
|
|||||||
## [v2.0.5]
|
|
||||||
|
|
||||||
Added Polish alphabet, plus support for Deno!
|
|
||||||
|
|
||||||
## [v2.0.4]
|
|
||||||
|
|
||||||
Fixed the X-ray entry in the NATO alphabet.
|
|
||||||
|
|
||||||
## [v2.0.3]
|
|
||||||
|
|
||||||
Added the [NATO phonetic alphabet](https://en.wikipedia.org/wiki/NATO_phonetic_alphabet).
|
|
||||||
|
|
||||||
## [v2.0.2]
|
|
||||||
|
|
||||||
Fixed a double typo in package.json and package-lock.json (see 237fb6a).
|
|
||||||
|
|
||||||
## [v2.0.1]
|
|
||||||
|
|
||||||
Added Ukrainian alphabet.
|
|
||||||
|
|
||||||
## [v2.0.0]
|
|
||||||
|
|
||||||
Huge improvements...
|
|
||||||
|
|
||||||
## [v1.2.0]
|
|
||||||
|
|
||||||
Added Russian alphabet! It is exported as `russian`.
|
|
||||||
|
|
||||||
## [v1.1.0]
|
|
||||||
|
|
||||||
Added Scandinavian alphabets. This package now exports the following alphabets:
|
|
||||||
|
|
||||||
| Name | Export name |
|
|
||||||
|---------------------------|------------------|
|
|
||||||
| Danish | `danish` |
|
|
||||||
| Faroese | `faroese` |
|
|
||||||
| Greek (modern) | `greek` |
|
|
||||||
| Greek (ancient/polytonic) | `greekPolytonic` |
|
|
||||||
| Icelandic | `icelandic` |
|
|
||||||
| Latin | `latin` |
|
|
||||||
| Norwegian | `norwegian` |
|
|
||||||
| Swedish | `swedish` |
|
|
||||||
|
|
||||||
## [v1.0.0]
|
|
||||||
|
|
||||||
Initial release.
|
|
||||||
|
|
||||||
[Unreleased]: https://github.com/garraflavatra/alphabets/tree/main
|
|
||||||
[v1.0.0]: https://github.com/garraflavatra/alphabets/releases/tag/1.0.0
|
|
||||||
[v1.1.0]: https://github.com/garraflavatra/alphabets/releases/tag/1.1.0
|
|
||||||
[v1.2.0]: https://github.com/garraflavatra/alphabets/releases/tag/1.2.0
|
|
||||||
[v2.0.0]: https://github.com/garraflavatra/alphabets/releases/tag/v2.0.0
|
|
||||||
[v2.0.1]: https://github.com/garraflavatra/alphabets/releases/tag/v2.0.1
|
|
||||||
[v2.0.2]: https://github.com/garraflavatra/alphabets/releases/tag/v2.0.2
|
|
||||||
[v2.0.3]: https://github.com/garraflavatra/alphabets/releases/tag/v2.0.3
|
|
||||||
[v2.0.4]: https://github.com/garraflavatra/alphabets/releases/tag/v2.0.4
|
|
||||||
[v2.0.5]: https://github.com/garraflavatra/alphabets/releases/tag/v2.0.5
|
|
@ -1,4 +1,4 @@
|
|||||||
Copyright (c) 2021-2024 Romein van Buren <<romein@vburen.nl>>
|
Copyright (c) 2021-2023 Romein van Buren
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
129
README.md
129
README.md
@ -1,59 +1,65 @@
|
|||||||
# Alphabets
|
# Alphabets
|
||||||
|
|
||||||
Alphabets contains many different alphabets for many different use cases.
|
A tiny JS dependency which exports many alphabets for many use cases.
|
||||||
|
|
||||||
[](https://www.npmjs.com/package/alphabets)
|
[](https://www.npmjs.com/package/alphabets)
|
||||||
|
[](https://stand-with-ukraine.pp.ua)
|
||||||
|
|
||||||
- [Included alphabets](#included-alphabets)
|
## Why
|
||||||
- [How to use](#how-to-use)
|
|
||||||
- [JS module](#js-module)
|
|
||||||
- [JSON file](#json-file)
|
|
||||||
- [Motivation](#motivation)
|
|
||||||
- [Questions and bugs](#questions-and-bugs)
|
|
||||||
- [Copyright](#copyright)
|
|
||||||
|
|
||||||
## Included alphabets
|
I have seen code like this:
|
||||||
|
|
||||||
See below for [usage instructions](#how-to-use).
|
```js
|
||||||
|
const alphabet = 'abcdefghijklmnopqrstuvwxyz'.split('');
|
||||||
|
```
|
||||||
|
|
||||||
| Export name | Alphabet |
|
Or worse:
|
||||||
|------------------|------------------|
|
|
||||||
| `danish` | [Danish](https://en.wikipedia.org/wiki/Danish_orthography), same as Norwegian |
|
```js
|
||||||
| `faroese` | [Faroese](https://en.wikipedia.org/wiki/Faroese_orthography) |
|
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"];
|
||||||
| `greek` | [Greek](https://en.wikipedia.org/wiki/Greek_alphabet) |
|
```
|
||||||
| `icelandic` | [Icelandic](https://en.wikipedia.org/wiki/Icelandic_orthography) |
|
|
||||||
| `latin` | [Latin](https://en.wikipedia.org/wiki/Latin_alphabet) (abcdefg etc.) |
|
My opinion about this: it's ugly, and it pollutes your code. Instead, you should do it like so:
|
||||||
| `nato` | [NATO phonetic alphabet](https://en.wikipedia.org/wiki/NATO_phonetic_alphabet) |
|
|
||||||
| `norwegian` | [Norwegian](https://en.wikipedia.org/wiki/Danish_and_Norwegian_alphabet), same as Danish |
|
```js
|
||||||
| `polish` | [Polish](https://en.wikipedia.org/wiki/Polish_alphabet) |
|
import { latin } from 'alphabets';
|
||||||
| `russian` | [Russian](https://en.wikipedia.org/wiki/Russian_alphabet) |
|
// or
|
||||||
| `swedish` | [Swedish](https://en.wikipedia.org/wiki/Swedish_alphabet) |
|
const alphabets = require('alphabets');
|
||||||
| `ukrainian` | [Ukrainian](https://en.wikipedia.org/wiki/Ukrainian_alphabet) |
|
|
||||||
|
doSomethingWithTheAlphabet(latin);
|
||||||
|
```
|
||||||
|
|
||||||
|
Much cleaner, right?
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
Use npm: [`npm i alphabets`](https://www.npmjs.com/package/alphabets). Or if you prefer Yarn: `yarn add alphabets`.
|
||||||
|
|
||||||
|
## Supported alphabets
|
||||||
|
|
||||||
|
See below for usage instructions.
|
||||||
|
|
||||||
|
| 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` |
|
||||||
|
| Ukrainian | `ukrainian` |
|
||||||
|
|
||||||
## How to use
|
## How to use
|
||||||
|
|
||||||
### JS module
|
Replace `<alphabetYouWantToUse>` with an alphabet identifier this package supports:
|
||||||
|
|
||||||
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`
|
|
||||||
|
|
||||||
You can also use it with [Deno](https://deno.land/) by importing `https://deno.land/x/alphabets/alphabets.mjs`.
|
|
||||||
|
|
||||||
Replace `<alphabetYouWantToUse>` with an [alphabet identifier](#included-alphabets) this package exports:
|
|
||||||
|
|
||||||
```js
|
```js
|
||||||
import { <alphabetYouWantToUse> } from 'alphabets';
|
import { <alphabetYouWantToUse> } from 'alphabets';
|
||||||
```
|
```
|
||||||
|
|
||||||
Deno:
|
|
||||||
|
|
||||||
```js
|
|
||||||
import { <alphabetYouWantToUse> } from 'https://deno.land/x/alphabets/alphabets.mjs';
|
|
||||||
```
|
|
||||||
|
|
||||||
or:
|
or:
|
||||||
|
|
||||||
```js
|
```js
|
||||||
@ -61,47 +67,8 @@ const alphabets = require('alphabets');
|
|||||||
console.log(alphabets.<alphabetYouWantToUse>);
|
console.log(alphabets.<alphabetYouWantToUse>);
|
||||||
```
|
```
|
||||||
|
|
||||||
### JSON file
|
|
||||||
|
|
||||||
Or load the JSON file with alphabets directly from a CDN:
|
|
||||||
|
|
||||||
* https://cdn.jsdelivr.net/npm/alphabets@2/alphabets.json
|
|
||||||
* https://unpkg.com/alphabets@2/alphabets.json
|
|
||||||
|
|
||||||
## Motivation
|
|
||||||
|
|
||||||
I have seen [code like this](https://github.com/search?q=%27abcdefghijklmnopqrstuvwxyz%27.split%28%27%27%29+language%3AJavaScript&type=code&l=JavaScript):
|
|
||||||
|
|
||||||
```js
|
|
||||||
const alphabet = 'abcdefghijklmnopqrstuvwxyz'.split('');
|
|
||||||
```
|
|
||||||
|
|
||||||
Or [even 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):
|
|
||||||
|
|
||||||
```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 verbose, ugly, and it pollutes your code. Instead, why not [do it like this](#how-to-use):
|
|
||||||
|
|
||||||
```js
|
|
||||||
import { latin } from 'alphabets';
|
|
||||||
|
|
||||||
for (const glyph of latin) {/* ... */}
|
|
||||||
```
|
|
||||||
|
|
||||||
This is much cleaner and more idiomatic.
|
|
||||||
|
|
||||||
## Questions and bugs
|
|
||||||
|
|
||||||
Did you find a mistake in an alphabet, or another bug? Please [report it](https://github.com/garraflavatra/alphabets/issues/new) — thank you! I'll try to fix it as soon as possible.
|
|
||||||
|
|
||||||
You may use the same issue form for questions, too.
|
|
||||||
|
|
||||||
## Copyright
|
## Copyright
|
||||||
|
|
||||||
(c) 2021-2024 [Romein van Buren](mailto:romein@vburen.nl). Licensed under the MIT license.
|
(c) 2021-2023 Romein van Buren. Licensed under the MIT license.
|
||||||
|
|
||||||
For the full copyright and license information, please see the [`LICENSE.md`](./LICENSE.md) file that was distributed with this source code.
|
For the full copyright and license information, please view the [`license.md`](./license.md) file that was distributed with this source code.
|
||||||
|
|
||||||
[](https://www.smartyellow.nl)
|
|
||||||
|
@ -8,16 +8,14 @@
|
|||||||
|
|
||||||
"greek": ["α", "β", "γ", "δ", "ε", "ζ", "η", "θ", "ι", "κ", "λ", "μ", "ν", "ξ", "ο", "π", "ρ", "σ", "τ", "υ", "φ", "χ", "ψ", "ω"],
|
"greek": ["α", "β", "γ", "δ", "ε", "ζ", "η", "θ", "ι", "κ", "λ", "μ", "ν", "ξ", "ο", "π", "ρ", "σ", "τ", "υ", "φ", "χ", "ψ", "ω"],
|
||||||
|
|
||||||
|
"greekPolytonic": ["α", "β", "γ", "δ", "ε", "ζ", "η", "θ", "ι", "κ", "λ", "μ", "ν", "ξ", "ο", "π", "ρ", "σ", "τ", "υ", "φ", "χ", "ψ", "ω"],
|
||||||
|
|
||||||
"icelandic": ["a", "á", "b", "d", "ð", "e", "é", "f", "g", "h", "i", "í", "j", "k", "l", "m", "n", "o", "ó", "p", "r", "s", "t", "u", "ú", "v", "x", "y", "ý", "þ", "æ", "ö"],
|
"icelandic": ["a", "á", "b", "d", "ð", "e", "é", "f", "g", "h", "i", "í", "j", "k", "l", "m", "n", "o", "ó", "p", "r", "s", "t", "u", "ú", "v", "x", "y", "ý", "þ", "æ", "ö"],
|
||||||
|
|
||||||
"latin": ["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"],
|
"latin": ["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"],
|
||||||
|
|
||||||
"nato": ["Alfa", "Bravo", "Charlie", "Delta", "Echo", "Foxtrot", "Golf", "Hotel", "India", "Juliett", "Kilo", "Lima", "Mike", "November", "Oscar", "Papa", "Quebec", "Romeo", "Sierra", "Tango", "Uniform", "Victor", "Whiskey", "X-ray", "Yankee", "Zulu"],
|
|
||||||
|
|
||||||
"norwegian": ["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", "æ", "ø", "å"],
|
"norwegian": ["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", "æ", "ø", "å"],
|
||||||
|
|
||||||
"polish": ["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", "ź", "ż"],
|
|
||||||
|
|
||||||
"russian": ["а", "б", "в", "г", "д", "е", "ё", "ж", "з", "и", "й", "к", "л", "м", "н", "о", "п", "р", "с", "т", "у", "ф", "х", "ц", "ч", "ш", "щ", "ъ", "ы", "ь", "э", "ю", "я"],
|
"russian": ["а", "б", "в", "г", "д", "е", "ё", "ж", "з", "и", "й", "к", "л", "м", "н", "о", "п", "р", "с", "т", "у", "ф", "х", "ц", "ч", "ш", "щ", "ъ", "ы", "ь", "э", "ю", "я"],
|
||||||
|
|
||||||
"swedish": ["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", "å", "ä", "ö"],
|
"swedish": ["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", "å", "ä", "ö"],
|
||||||
|
@ -1 +1 @@
|
|||||||
export * from './alphabets.json';
|
export * from "./alphabets.json";
|
||||||
|
3854
package-lock.json
generated
3854
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
43
package.json
43
package.json
@ -1,43 +1,24 @@
|
|||||||
{
|
{
|
||||||
"name": "alphabets",
|
"name": "alphabets",
|
||||||
"description": "A collection of many different alphabets for many different use cases. ",
|
"keywords": ["alphabet", "alphabets"],
|
||||||
"author": "Romein van Buren <romein@vburen.nl>",
|
"description": "Many different alphabets, many different use cases, zero depencencies.",
|
||||||
"version": "2.0.5",
|
|
||||||
"homepage": "https://github.com/garraflavatra/alphabets#readme",
|
"homepage": "https://github.com/garraflavatra/alphabets#readme",
|
||||||
"license": "MIT",
|
|
||||||
"keywords": [
|
|
||||||
"alphabet",
|
|
||||||
"alphabets"
|
|
||||||
],
|
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/garraflavatra/alphabets.git"
|
"url": "https://github.com/garraflavatra/alphabets.git"
|
||||||
},
|
},
|
||||||
"main": "alphabets.cjs",
|
|
||||||
|
"version": "2.0.1",
|
||||||
|
"author": "Romein van Buren <romein@vburen.eu>",
|
||||||
|
"license": "MIT",
|
||||||
|
|
||||||
|
"main": "alphabets.js",
|
||||||
"module": "alphabets.mjs",
|
"module": "alphabets.mjs",
|
||||||
|
|
||||||
"files": [
|
"files": [
|
||||||
"alphabets.cjs",
|
"alphabets.js",
|
||||||
"alphabets.mjs",
|
"alphabets.mjs",
|
||||||
"alphabets.json"
|
"alphabets.json"
|
||||||
],
|
]
|
||||||
"devDependencies": {
|
|
||||||
"@garraflavatra/yeslint": "^1.0.0",
|
|
||||||
"eslint": "^8.46.0"
|
|
||||||
},
|
|
||||||
"eslintConfig": {
|
|
||||||
"extends": "./node_modules/@garraflavatra/yeslint/configs/node.js",
|
|
||||||
"rules": {
|
|
||||||
"strict": "off"
|
|
||||||
},
|
|
||||||
"overrides": [
|
|
||||||
{
|
|
||||||
"files": [
|
|
||||||
"*.mjs"
|
|
||||||
],
|
|
||||||
"parserOptions": {
|
|
||||||
"sourceType": "module"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user