1
0
mirror of https://github.com/garraflavatra/alphabets.git synced 2025-07-03 03:05:10 +00:00

39 Commits
1.0.0 ... 1.2.0

Author SHA1 Message Date
eacc0b86ae Version 1.2.0 2021-07-15 11:08:38 +02:00
b9169aabe2 Update API docs 2021-07-15 11:07:54 +02:00
7c8b42f067 Update docs base URL 2021-07-15 11:04:46 +02:00
ab50d7301e Sort alphabets alphabetically 2021-07-15 10:59:54 +02:00
b58eba1417 Use double quotes 2021-07-15 10:58:36 +02:00
2a329830d0 Add Russian alphabet 2021-07-15 10:57:45 +02:00
c789449393 Bump rollup from 2.53.1 to 2.53.2
Bumps [rollup](https://github.com/rollup/rollup) from 2.53.1 to 2.53.2.
- [Release notes](https://github.com/rollup/rollup/releases)
- [Changelog](https://github.com/rollup/rollup/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rollup/rollup/compare/v2.53.1...v2.53.2)

---
updated-dependencies:
- dependency-name: rollup
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-07-15 10:06:23 +02:00
3364636f73 Update alternatives.md 2021-07-13 11:50:45 +02:00
01b5679f9d Delete CNAME 2021-07-13 11:48:57 +02:00
3a58eccea7 Update README.md 2021-07-13 11:48:39 +02:00
ffda23bd62 Bump addressable from 2.7.0 to 2.8.0 in /docs
Bumps [addressable](https://github.com/sporkmonger/addressable) from 2.7.0 to 2.8.0.
- [Release notes](https://github.com/sporkmonger/addressable/releases)
- [Changelog](https://github.com/sporkmonger/addressable/blob/main/CHANGELOG.md)
- [Commits](https://github.com/sporkmonger/addressable/compare/addressable-2.7.0...addressable-2.8.0)

---
updated-dependencies:
- dependency-name: addressable
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-07-12 22:36:10 +02:00
aecc3b475a Bump rollup from 2.53.0 to 2.53.1
Bumps [rollup](https://github.com/rollup/rollup) from 2.53.0 to 2.53.1.
- [Release notes](https://github.com/rollup/rollup/releases)
- [Changelog](https://github.com/rollup/rollup/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rollup/rollup/compare/v2.53.0...v2.53.1)

---
updated-dependencies:
- dependency-name: rollup
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-07-12 22:34:27 +02:00
2fe7b89fe6 Bump jest from 27.0.5 to 27.0.6
Bumps [jest](https://github.com/facebook/jest) from 27.0.5 to 27.0.6.
- [Release notes](https://github.com/facebook/jest/releases)
- [Changelog](https://github.com/facebook/jest/blob/master/CHANGELOG.md)
- [Commits](https://github.com/facebook/jest/compare/v27.0.5...v27.0.6)

---
updated-dependencies:
- dependency-name: jest
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-07-11 18:36:27 +02:00
2eab0d55f0 Bump rollup from 2.52.8 to 2.53.0
Bumps [rollup](https://github.com/rollup/rollup) from 2.52.8 to 2.53.0.
- [Release notes](https://github.com/rollup/rollup/releases)
- [Changelog](https://github.com/rollup/rollup/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rollup/rollup/compare/v2.52.8...v2.53.0)

---
updated-dependencies:
- dependency-name: rollup
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-07-11 18:36:18 +02:00
267cd04246 Bump rollup from 2.52.2 to 2.52.8
Bumps [rollup](https://github.com/rollup/rollup) from 2.52.2 to 2.52.8.
- [Release notes](https://github.com/rollup/rollup/releases)
- [Changelog](https://github.com/rollup/rollup/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rollup/rollup/compare/v2.52.2...v2.52.8)

---
updated-dependencies:
- dependency-name: rollup
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-07-08 18:25:20 +02:00
4ccd2860bd Bump husky from 6.0.0 to 7.0.1
Bumps [husky](https://github.com/typicode/husky) from 6.0.0 to 7.0.1.
- [Release notes](https://github.com/typicode/husky/releases)
- [Commits](https://github.com/typicode/husky/compare/v6.0.0...v7.0.1)

---
updated-dependencies:
- dependency-name: husky
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-07-08 18:25:07 +02:00
2eb73e84ff Bump rollup from 2.50.5 to 2.52.2 (#16)
Bumps [rollup](https://github.com/rollup/rollup) from 2.50.5 to 2.52.2.
- [Release notes](https://github.com/rollup/rollup/releases)
- [Changelog](https://github.com/rollup/rollup/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rollup/rollup/compare/v2.50.5...v2.52.2)

---
updated-dependencies:
- dependency-name: rollup
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-06-26 13:18:37 +02:00
65b8f98669 Bump jest from 27.0.3 to 27.0.5 (#17)
Bumps [jest](https://github.com/facebook/jest) from 27.0.3 to 27.0.5.
- [Release notes](https://github.com/facebook/jest/releases)
- [Changelog](https://github.com/facebook/jest/blob/master/CHANGELOG.md)
- [Commits](https://github.com/facebook/jest/compare/v27.0.3...v27.0.5)

---
updated-dependencies:
- dependency-name: jest
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-06-26 13:17:53 +02:00
16f6c530fe Create issue templates 2021-06-01 16:19:52 +02:00
0c0a4b472e Bump jest from 27.0.1 to 27.0.3 (#8)
Bumps [jest](https://github.com/facebook/jest) from 27.0.1 to 27.0.3.
- [Release notes](https://github.com/facebook/jest/releases)
- [Changelog](https://github.com/facebook/jest/blob/master/CHANGELOG.md)
- [Commits](https://github.com/facebook/jest/compare/v27.0.1...v27.0.3)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-06-01 16:18:09 +02:00
29f8b7c00a Bump rollup from 2.50.2 to 2.50.5 (#7)
Bumps [rollup](https://github.com/rollup/rollup) from 2.50.2 to 2.50.5.
- [Release notes](https://github.com/rollup/rollup/releases)
- [Changelog](https://github.com/rollup/rollup/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rollup/rollup/compare/v2.50.2...v2.50.5)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-06-01 16:17:59 +02:00
7594ec384a Bump rollup from 2.50.1 to 2.50.2 (#6)
Bumps [rollup](https://github.com/rollup/rollup) from 2.50.1 to 2.50.2.
- [Release notes](https://github.com/rollup/rollup/releases)
- [Changelog](https://github.com/rollup/rollup/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rollup/rollup/compare/v2.50.1...v2.50.2)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-05-28 13:20:45 +02:00
2b8d5b020a Bump rollup from 2.49.0 to 2.50.1 (#5)
Bumps [rollup](https://github.com/rollup/rollup) from 2.49.0 to 2.50.1.
- [Release notes](https://github.com/rollup/rollup/releases)
- [Changelog](https://github.com/rollup/rollup/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rollup/rollup/compare/v2.49.0...v2.50.1)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-05-26 14:47:42 +02:00
c0eeabca7c Bump jest from 26.6.3 to 27.0.1 (#3)
Bumps [jest](https://github.com/facebook/jest) from 26.6.3 to 27.0.1.
- [Release notes](https://github.com/facebook/jest/releases)
- [Changelog](https://github.com/facebook/jest/blob/master/CHANGELOG.md)
- [Commits](https://github.com/facebook/jest/compare/v26.6.3...v27.0.1)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-05-26 14:46:19 +02:00
3d2e84a7fb Upgrade documentation site 2021-05-24 18:05:14 +02:00
ed42e0c00b Link badges 2021-05-24 17:31:20 +02:00
adef5bd0a2 Add status badges 2021-05-24 17:03:46 +02:00
066be5ad41 Add GitHub Discussions link 2021-05-24 15:05:26 +02:00
c836490f91 Version 1.1.0
Added Scandinavian alphabets
2021-05-24 15:01:48 +02:00
2c77825857 Add Scandinavian alphabets 2021-05-24 15:01:04 +02:00
04af1db9d3 Fix docs menu link to GitHub repo 2021-05-24 14:25:31 +02:00
3eb3b169d1 Repository and website in package.json (closes #1) 2021-05-24 14:25:06 +02:00
3f693a6e5c Add code of conduct 2021-05-24 13:47:23 +02:00
b394f196aa Update status badge 2021-05-24 13:43:34 +02:00
67b30fc11f Add CI status badge 2021-05-24 13:42:06 +02:00
6c383e2781 Add test Git hook 2021-05-24 13:40:57 +02:00
d20e28657f Rename test action 2021-05-24 13:40:33 +02:00
06fee1f969 Add code testing 2021-05-24 13:39:07 +02:00
68c66bdb4f Enable Dependabot 2021-05-24 12:41:28 +02:00
22 changed files with 9777 additions and 183 deletions

38
.github/ISSUE_TEMPLATE/bug_report.md vendored Normal file
View File

@ -0,0 +1,38 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''
---
**Describe the bug**
A clear and concise description of what the bug is.
**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
**Expected behavior**
A clear and concise description of what you expected to happen.
**Screenshots**
If applicable, add screenshots to help explain your problem.
**Desktop (please complete the following information):**
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]
**Smartphone (please complete the following information):**
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]
**Additional context**
Add any other context about the problem here.

View File

@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''
---
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Additional context**
Add any other context or screenshots about the feature request here.

11
.github/dependabot.yml vendored Normal file
View File

@ -0,0 +1,11 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
version: 2
updates:
- package-ecosystem: "npm" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "daily"

30
.github/workflows/test.yml vendored Normal file
View File

@ -0,0 +1,30 @@
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
name: CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [10.x, 12.x, 14.x, 15.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- run: npm ci
- run: npm run build --if-present
- run: npm test

View File

@ -2,3 +2,4 @@
. "$(dirname "$0")/_/husky.sh"
npm run build
npm test

128
CODE_OF_CONDUCT.md Normal file
View File

@ -0,0 +1,128 @@
# Contributor Covenant Code of Conduct
## Our Pledge
We as members, contributors, and leaders pledge to make participation in our
community a harassment-free experience for everyone, regardless of age, body
size, visible or invisible disability, ethnicity, sex characteristics, gender
identity and expression, level of experience, education, socio-economic status,
nationality, personal appearance, race, religion, or sexual identity
and orientation.
We pledge to act and interact in ways that contribute to an open, welcoming,
diverse, inclusive, and healthy community.
## Our Standards
Examples of behavior that contributes to a positive environment for our
community include:
* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
* Focusing on what is best not just for us as individuals, but for the
overall community
Examples of unacceptable behavior include:
* The use of sexualized language or imagery, and sexual attention or
advances of any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or email
address, without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
## Enforcement Responsibilities
Community leaders are responsible for clarifying and enforcing our standards of
acceptable behavior and will take appropriate and fair corrective action in
response to any behavior that they deem inappropriate, threatening, offensive,
or harmful.
Community leaders have the right and responsibility to remove, edit, or reject
comments, commits, code, wiki edits, issues, and other contributions that are
not aligned to this Code of Conduct, and will communicate reasons for moderation
decisions when appropriate.
## Scope
This Code of Conduct applies within all community spaces, and also applies when
an individual is officially representing the community in public spaces.
Examples of representing our community include using an official e-mail address,
posting via an official social media account, or acting as an appointed
representative at an online or offline event.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement at
romein@vburen.eu.
All complaints will be reviewed and investigated promptly and fairly.
All community leaders are obligated to respect the privacy and security of the
reporter of any incident.
## Enforcement Guidelines
Community leaders will follow these Community Impact Guidelines in determining
the consequences for any action they deem in violation of this Code of Conduct:
### 1. Correction
**Community Impact**: Use of inappropriate language or other behavior deemed
unprofessional or unwelcome in the community.
**Consequence**: A private, written warning from community leaders, providing
clarity around the nature of the violation and an explanation of why the
behavior was inappropriate. A public apology may be requested.
### 2. Warning
**Community Impact**: A violation through a single incident or series
of actions.
**Consequence**: A warning with consequences for continued behavior. No
interaction with the people involved, including unsolicited interaction with
those enforcing the Code of Conduct, for a specified period of time. This
includes avoiding interactions in community spaces as well as external channels
like social media. Violating these terms may lead to a temporary or
permanent ban.
### 3. Temporary Ban
**Community Impact**: A serious violation of community standards, including
sustained inappropriate behavior.
**Consequence**: A temporary ban from any sort of interaction or public
communication with the community for a specified period of time. No public or
private interaction with the people involved, including unsolicited interaction
with those enforcing the Code of Conduct, is allowed during this period.
Violating these terms may lead to a permanent ban.
### 4. Permanent Ban
**Community Impact**: Demonstrating a pattern of violation of community
standards, including sustained inappropriate behavior, harassment of an
individual, or aggression toward or disparagement of classes of individuals.
**Consequence**: A permanent ban from any sort of public interaction within
the community.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 2.0, available at
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
Community Impact Guidelines were inspired by [Mozilla's code of conduct
enforcement ladder](https://github.com/mozilla/diversity).
[homepage]: https://www.contributor-covenant.org
For answers to common questions about this code of conduct, see the FAQ at
https://www.contributor-covenant.org/faq. Translations are available at
https://www.contributor-covenant.org/translations.

View File

@ -1,10 +1,17 @@
# Alphabets
A tiny JS dependency (<800 bytes!) which exports many alphabets for many use
[![CI](https://github.com/garraflavatra/alphabets/actions/workflows/test.yml/badge.svg?branch=main)](https://github.com/garraflavatra/alphabets/actions/workflows/test.yml)
[![npm](https://img.shields.io/npm/v/alphabets)](https://www.npmjs.com/package/alphabets)
[![npm bundle size](https://img.shields.io/bundlephobia/min/alphabets)](https://www.npmjs.com/package/alphabets)
[![GitHub last commit](https://img.shields.io/github/last-commit/garraflavatra/alphabets)](https://github.com/garraflavatra/alphabets)
[![Forum](https://img.shields.io/badge/-forum-blue)](https://github.com/garraflavatra/alphabets)
A tiny JS dependency (<2kb!) which exports many alphabets for many use
cases.
More information is available in the
[documentation](https://alphabets.romeinvanburen.nl).
[documentation](https://projects.romeinvanburen.nl/alphabets/).
## Why would I use this?
@ -76,6 +83,12 @@ Usage: see [Usage](#usage).
| Name | Export name |
|------|-------------|
| Latin | `latin` |
| Danish | `danish` |
| Faroese | `faroese` |
| Greek (modern) | `greek` |
| Greek (ancient/polytonic) | `greekPolytonic` |
| Icelandic | `icelandic` |
| Latin | `latin` |
| Norwegian | `norwegian` |
| Russian | `russian` |
| Swedish | `swedish` |

View File

@ -1 +0,0 @@
alphabets.romeinvanburen.nl

View File

@ -7,7 +7,7 @@ GEM
minitest (~> 5.1)
tzinfo (~> 1.1)
zeitwerk (~> 2.2, >= 2.2.2)
addressable (2.7.0)
addressable (2.8.0)
public_suffix (>= 2.0.2, < 5.0)
coffee-script (2.4.1)
coffee-script-source
@ -225,6 +225,8 @@ GEM
racc (~> 1.4)
nokogiri (1.11.5-x86_64-darwin)
racc (~> 1.4)
nokogiri (1.11.5-x86_64-linux)
racc (~> 1.4)
octokit (4.21.0)
faraday (>= 0.9)
sawyer (~> 0.8.0, >= 0.5.3)
@ -267,6 +269,7 @@ GEM
PLATFORMS
universal-darwin-20
x86_64-linux
DEPENDENCIES
github-pages

View File

@ -35,4 +35,6 @@ defaults:
values:
layout: single
toc: true
sidebar:
nav: "docs"

View File

@ -1,3 +1,25 @@
main:
- title: "Forums"
url: https://github.com/garraflavatra/alphabets/discussions
- title: "GitHub"
url: https://github.com/garraflavatra/alphabet.js
url: https://github.com/garraflavatra/alphabets
docs:
- title: About
children:
- title: Why would I use this?
url: /about/why
- title: Alternatives
url: /about/alternatives
- title: Usage
children:
- title: Installation
url: /usage/installation
- title: Usage
url: /usage/usage
- title: Advanced
url: /usage/advanced
- title: API
children:
- title: Supported alphabets
url: /api/supported-alphabets

View File

@ -0,0 +1,29 @@
---
title: Alternatives to Alphabets
---
Know more alternatives? Please open an
[issue](https://github.com/garraflavatra/alphabet.js/issues/new) or
[pull request](https://github.com/garraflavatra/alphabet.js)!
{: .notice--info}
## [alphabet](https://www.npmjs.com/package/alphabet)
(whithout trailing `s`)
I do not say this package doesn't work. I think it will work perfectly, but it
has less features:
{: .notice--warning}
Seems a good alternative, right? But:
* It only supports the Latin alphabet.
* It is larger. (The size is equal to this package's size, but this package
includes more.)
* It is only [CommonJS](https://en.wikipedia.org/wiki/CommonJS) and not
[ECMAScript](https://en.wikipedia.org/wiki/ECMAScript) etc.
* When did the author last update it? Right.
<figure>
<img src="https://projects.romeinvanburen.nl/alphabets/images/competitors/alphabet-last-publish.png" alt="Last updated: 6 years ago">
<figcaption>Hmmm...</figcaption>
</figure>

44
docs/about/why.md Normal file
View File

@ -0,0 +1,44 @@
---
title: Why would I use this?
---
I have seen developers doing this:
```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"];
```
My opinion about this? 🙄. It's ugly, it makes your code less readable
(read: ugly) and it's simply not something you should want to have in your
code! Instead, you should do it like so:
```js
import { latin } from 'alphabets';
// or
const alphabets = require('alphabets');
```
Much cleaner, right? That's why I made this package.
## Why not?
I see very few reasons not to use this package.
### But doesn't it cost me performance?
No. This package is only <800 bytes so it should not cost you any performance.
Neither via [CDN](/usage/installation/#cdn) nor if you use a bundler like
webpack, Parcel or Rollup.
### Why not making an array on my own?
It's a choice. This whole package is **opinionated**. *I* think you should not
do `const alphabet = 'abcdefghijklmnopqrstuvwxyz'.split('');` in your code. *I*
think you should use a package for that. Do you think it's OK to define your own
alphabet array? Do that!

View File

@ -0,0 +1,18 @@
---
title: Supported alphabets
toc: false
---
Usage: see [Usage](#usage).
| Name | Export name |
|------|-------------|
| Danish | `danish` |
| Faroese | `faroese` |
| Greek (modern) | `greek` |
| Greek (ancient/polytonic) | `greekPolytonic` |
| Icelandic | `icelandic` |
| Latin | `latin` |
| Norwegian | `norwegian` |
| Russian | `russian` |
| Swedish | `swedish` |

View File

@ -1,126 +1,16 @@
---
title: Alphabets
toc: false
---
A tiny JS dependency (<800 bytes!) which exports many alphabets for many use
A tiny JS dependency (<2kb!) which exports many alphabet arrays for many use
cases.
## Why would I use this?
[![CI](https://github.com/garraflavatra/alphabets/actions/workflows/test.yml/badge.svg?branch=main)](https://github.com/garraflavatra/alphabets/actions/workflows/test.yml)
[![npm](https://img.shields.io/npm/v/alphabets)](https://www.npmjs.com/package/alphabets)
[![npm bundle size](https://img.shields.io/bundlephobia/min/alphabets)](https://www.npmjs.com/package/alphabets)
[![GitHub last commit](https://img.shields.io/github/last-commit/garraflavatra/alphabets)](https://github.com/garraflavatra/alphabets)
[![Forum](https://img.shields.io/badge/-forum-blue)](https://github.com/garraflavatra/alphabets)
### Why?
I have seen developers doing this:
```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"];
```
My opinion about this? 🙄. It's ugly, it makes your code less readable
(read: ugly) and it's simply not something you should want to have in your
code! Instead, you should do it like so:
```js
import { latin } from 'alphabets';
// or
const alphabets = require('alphabets');
```
Much cleaner, right? That's why I made this package.
### Why not?
I see very few reasons not to use this package.
#### But doesn't it cost me performance?
No. This package is only <800 bytes so it should not cost you any performance.
Neither via CDN nor if you use a bundler like webpack, Parcel or Rollup.
#### Why not making an array on my own?
It's a choice. This whole package is **opinionated**. *I* think you should not
do `const alphabet = 'abcdefghijklmnopqrstuvwxyz'.split('');` in your code. *I*
think you should use a package for that. Do you think it's OK to define your own
alphabet array? Do that!
### Competitors
Know more alternatives? Please open an
[issue](https://github.com/garraflavatra/alphabet.js/issues/new) or
[pull request](https://github.com/garraflavatra/alphabet.js)!
{: .notice--info}
#### [alphabet](https://www.npmjs.com/package/alphabet)
Seems a good alternative, right? But:
* It only supports the Latin alphabet.
* It is larger. (The size is equal to this package's size, but this package
includes more.)
* It is only [CommonJS](https://en.wikipedia.org/wiki/CommonJS) and not
[ECMAScript](https://en.wikipedia.org/wiki/ECMAScript) etc.
* When did the author last update it? Right.
<figure>
<img src="/images/competitors/alphabet-last-publish.png" alt="Last updated: 6 years ago">
<figcaption>Hmmm...</figcaption>
</figure>
I do not say this package doesn't work. I think it will work perfectly, but it
has less features.
{: .notice--warning}
## Usage
### Installation
Use npm:
```bash
npm install alphabets --save
```
Or if you prefer Yarn:
```bash
yarn add alphabets
```
CDN, if that's more your style:
```html
<script src="https://unpkg.com/alphabet@1/dist/bundle.js"></script>
```
### Usage
```js
import { <alphabetYouWantToUse> } from 'alphabets';
```
or:
```js
const alphabets = require('alphabets');
console.log(alphabets.<alphabetYouWantToUse>);
```
where `<alphabetYouWantToUse>` is an alphabet this package supports.
[Here](#supported-alphabets) is a list from which you can choose.
## API
### Supported alphabets
Usage: see [Usage](#usage).
| Name | Export name |
|------|-------------|
| Latin | `latin` |
| Greek (modern) | `greek` |
| Greek (ancient/polytonic) | `greekPolytonic` |
Are you convinced [why to use this](about/why)? Get started
[here](usage/installation)!

17
docs/usage/advanced.md Normal file
View File

@ -0,0 +1,17 @@
---
title: Advanced usage
---
## Alphabet as a string
```js
alphabet.join('')[0];
//=> 'abcdefghijklmnopqrstuvwxyz'
```
## Uppercase
```js
alphabet.toUpperCase();
//=> ["Α", "Β", "Γ", "Δ", "Ε", "Ζ", "Η", "Θ", "Ι", "Κ", "Λ", "Μ", "Ν", "Ξ", "Ο", "Π", "Ρ", "Σ", "Τ", "Υ", "Φ", "Χ", "Ψ", "Ω"]
```

View File

@ -0,0 +1,21 @@
---
title: Installation
---
## npm
```bash
npm install alphabets --save
```
## Yarn
```bash
yarn add alphabets
```
## CDN
```html
<script src="https://unpkg.com/alphabet@1/dist/bundle.js"></script>
```

18
docs/usage/usage.md Normal file
View File

@ -0,0 +1,18 @@
---
title: Usage
toc: false
---
```js
import { <alphabetYouWantToUse> } from 'alphabets';
```
or:
```js
const alphabets = require('alphabets');
console.log(alphabets.<alphabetYouWantToUse>);
```
where `<alphabetYouWantToUse>` is an alphabet this package supports.
[Here](/api/supported-alphabets) is a list from which you can choose.

9342
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,17 +1,24 @@
{
"name": "alphabets",
"version": "1.0.0",
"version": "1.2.0",
"description": "Exports many alphabets for many use cases",
"main": "dist/bundle.js",
"scripts": {
"build": "rollup -c",
"prepare": "husky install"
"prepare": "husky install",
"test": "jest"
},
"keywords": [],
"author": "Romein van Buren <romein@vburen.eu>",
"license": "MIT",
"homepage": "https://projects.romeinvanburen.nl/alphabets/",
"repository": {
"type": "git",
"url": "https://github.com/garraflavatra/alphabets.git"
},
"devDependencies": {
"husky": "^6.0.0",
"husky": "^7.0.1",
"jest": "^27.0.1",
"rollup": "^2.49.0",
"rollup-plugin-clear": "^2.0.7",
"rollup-plugin-terser": "^7.0.2"

19
src/bundle.test.js Normal file
View File

@ -0,0 +1,19 @@
// These tests are just samples and not every alphabet is tested (that's boring).
const alphabets = require("../dist/bundle.js");
const greek = ["α", "β", "γ", "δ", "ε", "ζ", "η", "θ", "ι", "κ", "λ", "μ", "ν", "ξ", "ο", "π", "ρ", "σ", "τ", "υ", "φ", "χ", "ψ", "ω"];
const greekPolytonic = ["α", "β", "γ", "δ", "ε", "ζ", "η", "θ", "ι", "κ", "λ", "μ", "ν", "ξ", "ο", "π", "ρ", "σ", "τ", "υ", "φ", "χ", "ψ", "ω"];
const 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"];
test('alphabets.latin should return Latin alphabet', () => {
expect(alphabets.latin).toStrictEqual(latin);
});
test('alphabets.greek should return Greek alphabet', () => {
expect(alphabets.greek).toStrictEqual(greek);
});
test('alphabets.greekPolytonic should return Greek (Polytonic) alphabet', () => {
expect(alphabets.greekPolytonic).toStrictEqual(greekPolytonic);
});

View File

@ -1,17 +1,23 @@
export const 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"
];
export const greek = [
"α", "β", "γ", "δ", "ε", "ζ", "η", "θ", "ι", "κ", "λ", "μ", "ν", "ξ", "ο", "π", "ρ", "σ", "τ", "υ", "φ", "χ", "ψ", "ω"
]
export const greekPolytonic = [
"α", "β", "γ", "δ", "ε", "ζ", "η", "θ", "ι", "κ", "λ", "μ", "ν", "ξ", "ο", "π", "ρ", "σ", "τ", "υ", "φ", "χ", "ψ", "ω"
]
export const danish = ["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", "æ", "ø", "å"];
export const elfadian = ["a", "ą", "b", "d", "ð", "e", ", "f", "g", "h", "i", "į", "j", "k", "l", "m", "n", "o", "p", "r", "s", "t", "u", ", "v", "w", "y", "y̨", "å", "ą̊", "ä", "ö"];
export const faroese = ["a", "á", "b", "d", "ð", "e", "f", "g", "h", "i", "í", "j", "k", "l", "m", "n", "o", "ó", "p", "r", "s", "t", "u", "ú", "v", "y", "ý", "æ", "ø"];
export const greek = ["α", "β", "γ", "δ", "ε", "ζ", "η", "θ", "ι", "κ", "λ", "μ", "ν", "ξ", "ο", "π", "ρ", "σ", "τ", "υ", "φ", "χ", "ψ", "ω"];
export const greekPolytonic = ["α", "β", "γ", "δ", "ε", "ζ", "η", "θ", "ι", "κ", "λ", "μ", "ν", "ξ", "ο", "π", "ρ", "σ", "τ", "υ", "φ", "χ", "ψ", "ω"];
export const icelandic = ["a", "á", "b", "d", "ð", "e", "é", "f", "g", "h", "i", "í", "j", "k", "l", "m", "n", "o", "ó", "p", "r", "s", "t", "u", "ú", "v", "x", "y", "ý", "þ", "æ", "ö"];
export const 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"];
export const 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", "æ", "ø", "å"];
export const russian = ["а", "б", "в", "г", "д", "е", "ё", "ж", "з", "и", "й", "к", "л", "м", "н", "о", "п", "р", "с", "т", "у", "ф", "х", "ц", "ч", "ш", "щ", "ъ", "ы", "ь", "э", "ю", "я"];
export const 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", "å", "ä", "ö"];
export default [
latin,
danish,
elfadian,
faroese,
greek,
greekPolytonic,
];
icelandic,
latin,
norwegian,
russian,
swedish,
];