diff --git a/.github/workflows/lint-test.yaml b/.github/workflows/lint-test.yaml new file mode 100644 index 0000000..d3a37c9 --- /dev/null +++ b/.github/workflows/lint-test.yaml @@ -0,0 +1,27 @@ +name: Lint and Test + +on: + push: + branches: [ "main", "version/*" ] + pull_request: + +jobs: + lint-test: + name: Lint & Test + runs-on: ubuntu-latest + strategy: + fail-fast: true + matrix: + node-version: [ 20.x, 18.x, 16.x] + + steps: + - uses: actions/checkout@v4 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + cache: 'yarn' + - run: yarn + - run: yarn lint + - run: yarn build + - run: yarn test diff --git a/.github/workflows/publish-latest.yaml b/.github/workflows/publish-latest.yaml new file mode 100644 index 0000000..2fa0223 --- /dev/null +++ b/.github/workflows/publish-latest.yaml @@ -0,0 +1,62 @@ +name: Publish Latest +on: + release: + types: [ released ] + +env: + TAG_NAME: ${{ github.event.release.tag_name }} + PACKAGE_VERSION: "" # to be filled later after checkout + +jobs: + publish: + name: Publish to npm + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: fill package version + run: | + PACKAGE_VERSION=$(jq -r '.version' packages/abjad-convert/package.json) + echo "🔢 Package version: $PACKAGE_VERSION" + echo "PACKAGE_VERSION=$PACKAGE_VERSION" >> $GITHUB_ENV + + - name: validate tag name + run: | + if [[ ! $TAG_NAME =~ ^v([0-9]|[1-9][0-9]*)\.([0-9]|[1-9][0-9]*)\.([0-9]|[1-9][0-9]*)$ ]]; then + echo "❌ Invalid tag name: $TAG_NAME not suitable for latest release" + exit 1 + else + echo "✅ Valid tag name: $TAG_NAME" + fi + + - name: validate version in package.json + run: | + if [[ ! $PACKAGE_VERSION =~ ^([0-9]|[1-9][0-9]*)\.([0-9]|[1-9][0-9]*)\.([0-9]|[1-9][0-9]*)$ ]]; then + echo "❌ Invalid version name: $PACKAGE_VERSION not suitable for latest release" + exit 1 + else + echo "✅ Valid version: $PACKAGE_VERSION" + fi + + - name: check if version in package.json is matching tag name + run: | + if [[ "v$PACKAGE_VERSION" != $TAG_NAME ]]; then + echo "❌ Version in package.json of abjad-convert: $PACKAGE_VERSION is not matching with tag name: $TAG_NAME" + exit 1 + else + echo "✅ Version in package.json of abjad-convert is matching with tag name" + fi + + - uses: actions/setup-node@v4 + with: + node-version: 20.x + registry-url: https://registry.npmjs.org + always-auth: true + cache: yarn + + - run: yarn workspace abjad-convert install --frozen-lockfile + + - name: publish abjad-convert to npm + run: yarn workspace abjad-convert publish --access public --no-git-tag-version --new-version $PACKAGE_VERSION --tag latest + env: + NODE_AUTH_TOKEN: ${{ secrets.ABJAD_CONVERT_PUBLISH_AUTH_TOKEN }} diff --git a/.github/workflows/publish-next.yaml b/.github/workflows/publish-next.yaml new file mode 100644 index 0000000..8f8aa2d --- /dev/null +++ b/.github/workflows/publish-next.yaml @@ -0,0 +1,60 @@ +name: Publish Next +on: + release: + types: [ prereleased ] + +env: + TAG_NAME: ${{ github.event.release.tag_name }} + PACKAGE_VERSION: "" # to be filled later after checkout + +jobs: + publish: + name: Publish next to npm + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: fill package version + run: | + PACKAGE_VERSION=$(jq -r '.version' packages/abjad-convert/package.json) + echo "🔢 Package version: $PACKAGE_VERSION" + echo "PACKAGE_VERSION=$PACKAGE_VERSION" >> $GITHUB_ENV + + - name: validate tag name + run: | + if [[ ! $TAG_NAME =~ ^v([0-9]|[1-9][0-9]*)\.([0-9]|[1-9][0-9]*)\.([0-9]|[1-9][0-9]*)-next\.([0-9]|[1-9][0-9]*)$ ]]; then + echo "❌ Invalid tag name: $TAG_NAME not suitable for next tag publish" + exit 1 + else + echo "✅ Valid tag name: $TAG_NAME" + fi + - name: validate version in package.json + run: | + if [[ ! $PACKAGE_VERSION =~ ^([0-9]|[1-9][0-9]*)\.([0-9]|[1-9][0-9]*)\.([0-9]|[1-9][0-9]*)-next\.([0-9]|[1-9][0-9]*)$ ]]; then + echo "❌ Invalid version name: $PACKAGE_VERSION not suitable for next tag publish" + exit 1 + else + echo "✅ Valid @next version: $PACKAGE_VERSION" + fi + - name: check if version in package.json is matching tag name + run: | + if [[ "v$PACKAGE_VERSION" != $TAG_NAME ]]; then + echo "❌ Version in package.json of $PACKAGE_NAME: $PACKAGE_VERSION is not matching with tag name: $TAG_NAME" + exit 1 + else + echo "✅ Version: $PACKAGE_VERSION in package.json of $PACKAGE_NAME is matching with tag name: $TAG_NAME" + fi + + - uses: actions/setup-node@v4 + with: + node-version: 20.x + registry-url: https://registry.npmjs.org + always-auth: true + cache: yarn + + - run: yarn workspace abjad-convert install --frozen-lockfile + + - name: publish abjad-convert @next to npm + run: yarn workspace abjad-convert publish --access public --no-git-tag-version --new-version $PACKAGE_VERSION --tag next + env: + NODE_AUTH_TOKEN: ${{ secrets.ABJAD_CONVERT_PUBLISH_AUTH_TOKEN }} diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..d1d55f1 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,11 @@ +# Changelog + + +## [0.0.2] 2024-01-05 +### Changed +- Renaming +- Publish to npm via GitHub actions + +## [0.0.1] 2024-01-04 +### Added +- Root project structure diff --git a/README.md b/README.md index 2a22b5a..95497ab 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,10 @@ -# Abjad Convert Mono Repo +# Abjad Mono Repo This is a monorepo for the Abjad Convert project. -## Abajd Convert package -[README](https://github.com/amerharb/abjad-convert/blob/main/packages/abjad-convert/README.md) + +## Packages +### Abajd Convert +[README](https://github.com/amerharb/abjad/blob/main/packages/abjad-convert/README.md) + +### Abjad Client +example of a client for the abjad convert package diff --git a/package.json b/package.json index 1d7d2cf..cccfc82 100644 --- a/package.json +++ b/package.json @@ -1,11 +1,11 @@ { - "name": "abjad-convert-root", + "name": "abjad-root", "private": true, "workspaces": [ "packages/abjad-convert", - "packages/abjad-convert-client" + "packages/abjad-client" ], - "version": "0.0.1", + "version": "0.0.2", "author": "Amer Harb", "license": "ISC", "scripts": { diff --git a/packages/abjad-client/package.json b/packages/abjad-client/package.json new file mode 100644 index 0000000..2972d9a --- /dev/null +++ b/packages/abjad-client/package.json @@ -0,0 +1,18 @@ +{ + "name": "abjad-client", + "private": true, + "version": "0.0.2", + "main": "dist/index.js", + "scripts": { + "prebuild": "rm -rf dist", + "build": "tsc", + "start": "node dist/index.js", + "test": "echo \"Error: no test specified\" && exit 0", + "dev": "ts-node src/index.ts", + "lint": "npx eslint . --max-warnings 0", + "lint-fix": "npx eslint . --fix" + }, + "dependencies": { + "abjad-convert": "next" + } +} diff --git a/packages/abjad-client/src/index.ts b/packages/abjad-client/src/index.ts new file mode 100644 index 0000000..cec32bd --- /dev/null +++ b/packages/abjad-client/src/index.ts @@ -0,0 +1,38 @@ +import { Abjad, convert } from 'abjad-convert' + +log('Abjad Convert') + +const arabic = 'ا ب ت ج د خ' +log(`convert Arabic text ${arabic} to Ugaritic`) +log(calmConvert(arabic, Abjad.Arabic, Abjad.Ugaritic)) +log(`convert Arabic text ${arabic} to Phoenician`) +log(calmConvert(arabic, Abjad.Arabic, Abjad.Phoenician)) + +const ugaritic = '𐎀 𐎁 𐎚 𐎂 𐎄 𐎃' +log(`convert Ugaritic text ${ugaritic} to Arabic`) +log(calmConvert(ugaritic, Abjad.Ugaritic, Abjad.Arabic)) +log(`convert Ugaritic text ${ugaritic} to Phoenician`) +log(calmConvert(ugaritic, Abjad.Ugaritic, Abjad.Phoenician)) + +const phoenician = '𐤀 𐤁 𐤂 𐤃 𐤄 𐤅' +log(`convert Phoenician text ${phoenician} to Arabic`) +log(calmConvert(phoenician, Abjad.Phoenician, Abjad.Arabic)) +log(`convert Phoenician text ${phoenician} to Ugaritic`) +log(calmConvert(phoenician, Abjad.Phoenician, Abjad.Ugaritic)) + +log(calmConvert('مرحبا', Abjad.Arabic, Abjad.Phoenician)) +log(calmConvert('مرحبا', Abjad.Arabic, Abjad.Ugaritic)) +log(calmConvert('مرحبا', Abjad.Arabic, Abjad.ImperialAramaic)) + +function calmConvert(source: string, from: Abjad, to: Abjad): string { + try { + return convert(source, from, to) + } catch (e: any) { + return e.message + } +} + +function log(message: string): void { + // eslint-disable-next-line no-console + console.log(message) +} diff --git a/packages/abjad-convert-client/tsconfig.json b/packages/abjad-client/tsconfig.json similarity index 100% rename from packages/abjad-convert-client/tsconfig.json rename to packages/abjad-client/tsconfig.json diff --git a/packages/abjad-convert-client/package.json b/packages/abjad-convert-client/package.json deleted file mode 100644 index 09f1489..0000000 --- a/packages/abjad-convert-client/package.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "name": "abjad-convert-client", - "private": true, - "version": "0.0.1", - "main": "index.js", - "scripts": { - "build": "tsc", - "start": "node dist/index.js", - "test": "echo \"Error: no test specified\" && exit 0", - "dev": "ts-node src/index.ts" - }, - "dependencies": { - "abjad-convert": "^0.0.1" - } -} diff --git a/packages/abjad-convert-client/src/index.ts b/packages/abjad-convert-client/src/index.ts deleted file mode 100644 index 33deafb..0000000 --- a/packages/abjad-convert-client/src/index.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { Abjad, convert } from 'abjad-convert/src' - -console.log('Abjad Convert') - -const arabic = 'ا ب ت ج د خ' -console.log(`convert Arabic text ${arabic} to Ugaritic`) -console.log(calmConvert(arabic, Abjad.Arabic, Abjad.Ugaritic)) -console.log(`convert Arabic text ${arabic} to Phoenician`) -console.log(calmConvert(arabic, Abjad.Arabic, Abjad.Phoenician)) - -const ugaritic = '𐎀 𐎁 𐎚 𐎂 𐎄 𐎃' -console.log(`convert Ugaritic text ${ugaritic} to Arabic`) -console.log(calmConvert(ugaritic, Abjad.Ugaritic, Abjad.Arabic)) -console.log(`convert Ugaritic text ${ugaritic} to Phoenician`) -console.log(calmConvert(ugaritic, Abjad.Ugaritic, Abjad.Phoenician)) - -const phoenician = '𐤀 𐤁 𐤂 𐤃 𐤄 𐤅' -console.log(`convert Phoenician text ${phoenician} to Arabic`) -console.log(calmConvert(phoenician, Abjad.Phoenician, Abjad.Arabic)) -console.log(`convert Phoenician text ${phoenician} to Ugaritic`) -console.log(calmConvert(phoenician, Abjad.Phoenician, Abjad.Ugaritic)) - -console.log(calmConvert('مرحبا', Abjad.Arabic, Abjad.Phoenician)) -console.log(calmConvert('مرحبا', Abjad.Arabic, Abjad.Ugaritic)) - -function calmConvert(source: string, from: Abjad, to: Abjad): string { - try { - return convert(source, from, to) - } catch (e: any) { - return e.message - } -} diff --git a/packages/abjad-convert/CHANGELOG.md b/packages/abjad-convert/CHANGELOG.md index b2077bb..d05dd00 100644 --- a/packages/abjad-convert/CHANGELOG.md +++ b/packages/abjad-convert/CHANGELOG.md @@ -1,6 +1,12 @@ # Changelog +## [0.0.2] 2024-01-05 +### Added +- Test in GitHub actions +- Publish to npm via GitHub actions +- Support Imperial Aramaic + ## [0.0.1] 2024-01-04 ### Added - Initial project covert between 3 languages Arabic, Phoenician and Ugaritic diff --git a/packages/abjad-convert/README.md b/packages/abjad-convert/README.md index 369fe63..c3dae0c 100644 --- a/packages/abjad-convert/README.md +++ b/packages/abjad-convert/README.md @@ -1,11 +1,12 @@ # Abjad Convert -Abjad Convert is a package for converting Abjad alphabets phonetic word. +**abjad-convert** is a package for converting Abjad alphabets phonetically. -currently supported alphabets: +current supported alphabets: - Arabic - Uguritic - Phoenician +- Imperial Aramaic ## How to use npm: @@ -22,8 +23,13 @@ Java Script: import { convert, Abjad } from 'abjad-convert'; const arabicWord = 'مرحبا'; + const phoenicianWord = convert(arabicWord, Abjad.Arabic, Abjad.Phoenician); console.log(phoenicianWord); // 𐤌𐤓𐤇𐤁𐤀 + const ugariticWord = convert(arabicWord, Abjad.Arabic, Abjad.Ugaritic); console.log(ugariticWord); // 𐎎𐎗𐎈𐎁𐎀 + +const imperialAramaicWord = convert(arabicWord, Abjad.Arabic, Abjad.ImperialAramaic); +console.log(imperialAramaicWord); // 𐡌𐡓𐡇𐡁𐡀 ``` diff --git a/packages/abjad-convert/package.json b/packages/abjad-convert/package.json index 903c106..ae59fc4 100644 --- a/packages/abjad-convert/package.json +++ b/packages/abjad-convert/package.json @@ -1,6 +1,6 @@ { "name": "abjad-convert", - "version": "0.0.1", + "version": "0.0.2", "main": "dist/src/index.js", "types": "dist/src/index.d.ts", "files": [ @@ -9,7 +9,7 @@ "LICENSE", "README.md" ], - "repository": "git@github.com:amerharb/abjad-convert.git", + "repository": "git@github.com:amerharb/abjad.git", "author": "Amer Harb", "email": "abjad@amerharb.com", "keywords": [ @@ -21,6 +21,7 @@ ], "license": "ISC", "scripts": { + "prebuild": "rm -rf dist", "build": "tsc", "start": "node dist/index.js", "test": "jest", diff --git a/packages/abjad-convert/src/ConverterFactory.ts b/packages/abjad-convert/src/ConverterFactory.ts index e2251bd..7c70b10 100644 --- a/packages/abjad-convert/src/ConverterFactory.ts +++ b/packages/abjad-convert/src/ConverterFactory.ts @@ -1,20 +1,28 @@ import { Abjad } from './types' import { IConvert } from './IConvert' +import { ArabicToImperialAramaicConverter } from './arabic/toImperialAramaic' +import { ArabicToPhoenicianConverter } from './arabic/toPhoenician' import { ArabicToUgariticConverter } from './arabic/toUgaritic' -import { UgariticToArabicConverter } from './ugaritic/toArabic' +import { ImperialAramaicToArabicConverter } from './imperialAramaic/toArabic' +import { ImperialAramaicToPhoenicianConverter } from './imperialAramaic/toPhoenician' +import { ImperialAramaicToUgariticConverter } from './imperialAramaic/toUgaritic' import { PhoenicianToArabicConverter } from './phoenician/toArabic' -import { ArabicToPhoenicianConverter } from './arabic/toPhoenician' +import { PhoenicianToImperialAramaicConverter } from './phoenician/toImperialAramaic' import { PhoenicianToUgariticConverter } from './phoenician/toUgaritic' +import { UgariticToArabicConverter } from './ugaritic/toArabic' +import { UgariticToImperialAramaicConverter } from './ugaritic/toImperialAramaic' import { UgariticToPhoenicianConverter } from './ugaritic/toPhoenician' export function getConverter(from: Abjad, to: Abjad): IConvert { switch (from) { case Abjad.Arabic: switch (to) { - case Abjad.Ugaritic: - return new ArabicToUgariticConverter() + case Abjad.ImperialAramaic: + return new ArabicToImperialAramaicConverter() case Abjad.Phoenician: return new ArabicToPhoenicianConverter() + case Abjad.Ugaritic: + return new ArabicToUgariticConverter() default: throw new Error(`No converter exists from ${Abjad[from]} to ${Abjad[to]}`) } @@ -22,6 +30,8 @@ export function getConverter(from: Abjad, to: Abjad): IConvert { switch (to) { case Abjad.Arabic: return new UgariticToArabicConverter() + case Abjad.ImperialAramaic: + return new UgariticToImperialAramaicConverter() case Abjad.Phoenician: return new UgariticToPhoenicianConverter() default: @@ -31,11 +41,25 @@ export function getConverter(from: Abjad, to: Abjad): IConvert { switch (to) { case Abjad.Arabic: return new PhoenicianToArabicConverter() + case Abjad.ImperialAramaic: + return new PhoenicianToImperialAramaicConverter() case Abjad.Ugaritic: return new PhoenicianToUgariticConverter() default: throw new Error(`No converter exists from ${Abjad[from]} to ${Abjad[to]}`) } + case Abjad.ImperialAramaic: { + switch (to) { + case Abjad.Arabic: + return new ImperialAramaicToArabicConverter() + case Abjad.Phoenician: + return new ImperialAramaicToPhoenicianConverter() + case Abjad.Ugaritic: + return new ImperialAramaicToUgariticConverter() + default: + throw new Error(`No converter exists from ${Abjad[from]} to ${Abjad[to]}`) + } + } default: throw new Error(`No converter exists from ${Abjad[from]} to ${Abjad[to]}`) } diff --git a/packages/abjad-convert/src/arabic/U0600.pdf b/packages/abjad-convert/src/arabic/U0600.pdf new file mode 100644 index 0000000..f1885f2 Binary files /dev/null and b/packages/abjad-convert/src/arabic/U0600.pdf differ diff --git a/packages/abjad-convert/src/arabic/toImperialAramaic.ts b/packages/abjad-convert/src/arabic/toImperialAramaic.ts new file mode 100644 index 0000000..55a2865 --- /dev/null +++ b/packages/abjad-convert/src/arabic/toImperialAramaic.ts @@ -0,0 +1,59 @@ +import { Ar } from './letters' +import { Ia } from '../imperialAramaic/letters' +import { IConvert } from '../IConvert' +import { Abjad } from '../types' + +export class ArabicToImperialAramaicConverter implements IConvert { + public readonly from = Abjad.Arabic + public readonly to = Abjad.Phoenician + + private map = new Map( + [ + [' ', ' '], + [Ar.Hamza, ''], + [Ar.AlefMadda, Ia.Aleph], + [Ar.AlefHamza, Ia.Aleph], + [Ar.WawHamza, Ia.Waw], + [Ar.AlefHamzaMaksura, Ia.Yod], + [Ar.Alef, Ia.Aleph], + [Ar.Ba, Ia.Bet], + [Ar.TaMarbuta, Ia.Taw], + [Ar.Ta, Ia.Taw], + [Ar.Tha, Ia.Taw], + [Ar.Jeem, Ia.Gimel], + [Ar.H7aa, Ia.Heth], + [Ar.Khaa, Ia.Heth], + [Ar.Dal, Ia.Daleth], + [Ar.Thal, Ia.Daleth], + [Ar.Ra, Ia.Resh], + [Ar.Zay, Ia.Zayin], + [Ar.Seen, Ia.Samekh], + [Ar.Sheen, Ia.Shin], + [Ar.Sad, Ia.Sadhe], + [Ar.Dad, Ia.Daleth], + [Ar.TTa, Ia.Teth], + [Ar.THa, Ia.Taw], + [Ar.Ayn, Ia.Ayin], + [Ar.Ghayn, Ia.Ayin], + [Ar.Fa, Ia.Pe], + [Ar.Qaf, Ia.Qoph], + [Ar.Kaf, Ia.Kaph], + [Ar.Lam, Ia.Lamedh], + [Ar.Meem, Ia.Mem], + [Ar.Noon, Ia.Nun], + [Ar.Ha, Ia.He], + [Ar.Waw, Ia.Waw], + [Ar.Yaa, Ia.Yod], + [Ar.AlefMaksura, Ia.Aleph], + ] + ) + + public convert(text: string): string { + let result = '' + for (const letter of text) { + const u = this.map.get(letter) ?? '' + result += u + } + return result + } +} diff --git a/packages/abjad-convert/src/imperialAramaic/U10840.pdf b/packages/abjad-convert/src/imperialAramaic/U10840.pdf new file mode 100644 index 0000000..30927b9 Binary files /dev/null and b/packages/abjad-convert/src/imperialAramaic/U10840.pdf differ diff --git a/packages/abjad-convert/src/imperialAramaic/letters.ts b/packages/abjad-convert/src/imperialAramaic/letters.ts new file mode 100644 index 0000000..9992396 --- /dev/null +++ b/packages/abjad-convert/src/imperialAramaic/letters.ts @@ -0,0 +1,70 @@ +/** + * Imperial Aramaic letters + */ +const letters = [ + '\uD802\uDC40', /** #0 𐡀 U+10840 IMPERIAL ARAMAIC LETTER Aleph */ + '\uD802\uDC41', /** #1 𐡁 U+10841 IMPERIAL ARAMAIC LETTER Beth */ + '\uD802\uDC42', /** #2 𐡂 U+10842 IMPERIAL ARAMAIC LETTER Gimel */ + '\uD802\uDC43', /** #3 𐡃 U+10843 IMPERIAL ARAMAIC LETTER Daleth */ + '\uD802\uDC44', /** #4 𐡄 U+10844 IMPERIAL ARAMAIC LETTER He */ + '\uD802\uDC45', /** #5 𐡅 U+10845 IMPERIAL ARAMAIC LETTER Waw */ + '\uD802\uDC46', /** #6 𐡆 U+10846 IMPERIAL ARAMAIC LETTER Zayin */ + '\uD802\uDC47', /** #7 𐡇 U+10847 IMPERIAL ARAMAIC LETTER Heth */ + '\uD802\uDC48', /** #8 𐡈 U+10848 IMPERIAL ARAMAIC LETTER Teth */ + '\uD802\uDC49', /** #9 𐡉 U+10849 IMPERIAL ARAMAIC LETTER Yod */ + '\uD802\uDC4A', /** #10 𐡊 U+1084A IMPERIAL ARAMAIC LETTER Kaph */ + '\uD802\uDC4B', /** #11 𐡋 U+1084B IMPERIAL ARAMAIC LETTER Lamedh */ + '\uD802\uDC4C', /** #12 𐡌 U+1084C IMPERIAL ARAMAIC LETTER Mem */ + '\uD802\uDC4D', /** #13 𐡍 U+1084D IMPERIAL ARAMAIC LETTER Nun */ + '\uD802\uDC4E', /** #14 𐡎 U+1084E IMPERIAL ARAMAIC LETTER Samekh */ + '\uD802\uDC4F', /** #15 𐡏 U+1084F IMPERIAL ARAMAIC LETTER Ayin */ + '\uD802\uDC50', /** #16 𐡐 U+10850 IMPERIAL ARAMAIC LETTER Pe */ + '\uD802\uDC51', /** #17 𐡑 U+10851 IMPERIAL ARAMAIC LETTER Sadhe */ + '\uD802\uDC52', /** #18 𐡒 U+10852 IMPERIAL ARAMAIC LETTER Qoph */ + '\uD802\uDC53', /** #19 𐡓 U+10853 IMPERIAL ARAMAIC LETTER Resh */ + '\uD802\uDC54', /** #20 𐡔 U+10854 IMPERIAL ARAMAIC LETTER Shin */ + '\uD802\uDC55', /** #21 𐡕 U+10855 IMPERIAL ARAMAIC LETTER Taw */ + + '\uD802\uDC58', /** #22 𐡘 U+10858 IMPERIAL ARAMAIC NUMBER ONE */ + '\uD802\uDC59', /** #23 𐡙 U+10859 IMPERIAL ARAMAIC NUMBER TWO */ + '\uD802\uDC5A', /** #24 𐡚 U+1085A IMPERIAL ARAMAIC NUMBER THREE */ + '\uD802\uDC5B', /** #25 𐡛 U+1085B IMPERIAL ARAMAIC NUMBER TEN */ + '\uD802\uDC5C', /** #26 𐡜 U+1085C IMPERIAL ARAMAIC NUMBER TWENTY */ + '\uD802\uDC5D', /** #27 𐡝 U+1085D IMPERIAL ARAMAIC NUMBER ONE HUNDRED */ + '\uD802\uDC5E', /** #28 𐡞 U+1085E IMPERIAL ARAMAIC NUMBER ONE THOUSAND */ + '\uD802\uDC5F', /** #29 𐡟 U+1085F IMPERIAL ARAMAIC NUMBER TEN THOUSAND */ +] + +export const Ia = { + Aleph: letters[0], // 𐡀 + Bet: letters[1], // 𐡁 + Gimel: letters[2], // 𐡂 + Daleth: letters[3], // 𐡃 + He: letters[4], // 𐡄 + Waw: letters[5], // 𐡅 + Zayin: letters[6], // 𐡆 + Heth: letters[7], // 𐡇 + Teth: letters[8], // 𐡈 + Yod: letters[9], // 𐡉 + Kaph: letters[10], // 𐡊 + Lamedh: letters[11], // 𐡋 + Mem: letters[12], // 𐡌 + Nun: letters[13], // 𐡍 + Samekh: letters[14], // 𐡎 + Ayin: letters[15], // 𐡏 + Pe: letters[16], // 𐡐 + Sadhe: letters[17], // 𐡑 + Qoph: letters[18], // 𐡒 + Resh: letters[19], // 𐡓 + Shin: letters[20], // 𐡔 + Taw: letters[21], // 𐡕 + + One: letters[22], // 𐡘 + Two: letters[23], // 𐡙 + Three: letters[24], // 𐡚 + Ten: letters[25], // 𐡛 + Twenty: letters[26], // 𐡜 + Hundred: letters[27], // 𐡝 + Thousand: letters[28], // 𐡞 + TenThousand: letters[29], // 𐡟 +} diff --git a/packages/abjad-convert/src/imperialAramaic/toArabic.ts b/packages/abjad-convert/src/imperialAramaic/toArabic.ts new file mode 100644 index 0000000..cb3d2ab --- /dev/null +++ b/packages/abjad-convert/src/imperialAramaic/toArabic.ts @@ -0,0 +1,45 @@ +import { Ia } from './letters' +import { Ar } from '../arabic/letters' +import { IConvert } from '../IConvert' +import { Abjad } from '../types' + +export class ImperialAramaicToArabicConverter implements IConvert { + public readonly from = Abjad.ImperialAramaic + public readonly to = Abjad.Arabic + + private map = new Map( + [ + [' ', ' '], + [Ia.Aleph, Ar.Alef], // 𐡀 -> ا + [Ia.Bet, Ar.Ba], // 𐡁 -> ب + [Ia.Gimel, Ar.Jeem], // 𐡂 -> ج + [Ia.Daleth, Ar.Dal], // 𐡃 -> د + [Ia.He, Ar.Ha], // 𐡄 -> ه + [Ia.Waw, Ar.Waw], // 𐡅 -> و + [Ia.Zayin, Ar.Zay], // 𐡆 -> ز + [Ia.Heth, Ar.Ha], // 𐡇 -> ح + [Ia.Teth, Ar.Ta], // 𐡈 -> ط + [Ia.Yod, Ar.Yaa], // 𐡉 -> ي + [Ia.Kaph, Ar.Kaf], // 𐡊 -> ك + [Ia.Lamedh, Ar.Lam], // 𐡋 -> ل + [Ia.Mem, Ar.Meem], // 𐡌 -> م + [Ia.Nun, Ar.Noon], // 𐡍 -> ن + [Ia.Samekh, Ar.Seen], // 𐡎 -> س + [Ia.Ayin, Ar.Ayn], // 𐡏 -> ع + [Ia.Pe, Ar.Fa], // 𐡐 -> ف + [Ia.Sadhe, Ar.Sad], // 𐡑 -> ص + [Ia.Qoph, Ar.Qaf], // 𐡒 -> ق + [Ia.Resh, Ar.Ra], // 𐡓 -> ر + [Ia.Shin, Ar.Sheen], // 𐡔 -> ش + [Ia.Taw, Ar.Ta], // 𐡕 -> ت + ] + ) + + public convert(text: string): string { + let result = '' + for (const letter of text) { + result += this.map.get(letter) ?? '' + } + return result + } +} diff --git a/packages/abjad-convert/src/imperialAramaic/toPhoenician.ts b/packages/abjad-convert/src/imperialAramaic/toPhoenician.ts new file mode 100644 index 0000000..bb5a357 --- /dev/null +++ b/packages/abjad-convert/src/imperialAramaic/toPhoenician.ts @@ -0,0 +1,16 @@ +import { IConvert } from '../IConvert' +import { Abjad } from '../types' +import { ImperialAramaicToArabicConverter } from './toArabic' +import { ArabicToPhoenicianConverter } from '../arabic/toPhoenician' + +export class ImperialAramaicToPhoenicianConverter implements IConvert { + public readonly from = Abjad.ImperialAramaic + public readonly to = Abjad.Phoenician + + public convert(text: string): string { + const IaToAr = new ImperialAramaicToArabicConverter() + const ar = IaToAr.convert(text) + const ArToPh = new ArabicToPhoenicianConverter() + return ArToPh.convert(ar) + } +} diff --git a/packages/abjad-convert/src/imperialAramaic/toUgaritic.ts b/packages/abjad-convert/src/imperialAramaic/toUgaritic.ts new file mode 100644 index 0000000..f91e984 --- /dev/null +++ b/packages/abjad-convert/src/imperialAramaic/toUgaritic.ts @@ -0,0 +1,16 @@ +import { IConvert } from '../IConvert' +import { Abjad } from '../types' +import { ImperialAramaicToArabicConverter } from './toArabic' +import { ArabicToUgariticConverter } from '../arabic/toUgaritic' + +export class ImperialAramaicToUgariticConverter implements IConvert { + public readonly from = Abjad.ImperialAramaic + public readonly to = Abjad.Ugaritic + + public convert(text: string): string { + const IaToAr = new ImperialAramaicToArabicConverter() + const ar = IaToAr.convert(text) + const ArToUg = new ArabicToUgariticConverter() + return ArToUg.convert(ar) + } +} diff --git a/packages/abjad-convert/src/phoenician/toImperialAramaic.ts b/packages/abjad-convert/src/phoenician/toImperialAramaic.ts new file mode 100644 index 0000000..317f594 --- /dev/null +++ b/packages/abjad-convert/src/phoenician/toImperialAramaic.ts @@ -0,0 +1,16 @@ +import { IConvert } from '../IConvert' +import { Abjad } from '../types' +import { PhoenicianToArabicConverter } from './toArabic' +import { ArabicToImperialAramaicConverter } from '../arabic/toImperialAramaic' + +export class PhoenicianToImperialAramaicConverter implements IConvert { + public readonly from = Abjad.Phoenician + public readonly to = Abjad.Ugaritic + + public convert(text: string): string { + const PhToAr = new PhoenicianToArabicConverter() + const ar = PhToAr.convert(text) + const ArToIa = new ArabicToImperialAramaicConverter() + return ArToIa.convert(ar) + } +} diff --git a/packages/abjad-convert/src/phoenician/toUgaritic.ts b/packages/abjad-convert/src/phoenician/toUgaritic.ts index 60d3aa0..7ddfca5 100644 --- a/packages/abjad-convert/src/phoenician/toUgaritic.ts +++ b/packages/abjad-convert/src/phoenician/toUgaritic.ts @@ -9,12 +9,8 @@ export class PhoenicianToUgariticConverter implements IConvert { public convert(text: string): string { const PhToAr = new PhoenicianToArabicConverter() + const ar = PhToAr.convert(text) const ArToUg = new ArabicToUgariticConverter() - let result = '' - for (const letter of text) { - const ar = PhToAr.convert(letter) - result += ArToUg.convert(ar) - } - return result + return ArToUg.convert(ar) } } diff --git a/packages/abjad-convert/src/types.ts b/packages/abjad-convert/src/types.ts index 2fcf6a8..7b540c1 100644 --- a/packages/abjad-convert/src/types.ts +++ b/packages/abjad-convert/src/types.ts @@ -2,4 +2,5 @@ export enum Abjad { Arabic, Ugaritic, Phoenician, + ImperialAramaic, } diff --git a/packages/abjad-convert/src/ugaritic/U10380.pdf b/packages/abjad-convert/src/ugaritic/U10380.pdf new file mode 100644 index 0000000..c505b30 Binary files /dev/null and b/packages/abjad-convert/src/ugaritic/U10380.pdf differ diff --git a/packages/abjad-convert/src/ugaritic/toImperialAramaic.ts b/packages/abjad-convert/src/ugaritic/toImperialAramaic.ts new file mode 100644 index 0000000..520b01d --- /dev/null +++ b/packages/abjad-convert/src/ugaritic/toImperialAramaic.ts @@ -0,0 +1,16 @@ +import { IConvert } from '../IConvert' +import { Abjad } from '../types' +import { UgariticToArabicConverter } from './toArabic' +import { ArabicToImperialAramaicConverter } from '../arabic/toImperialAramaic' + +export class UgariticToImperialAramaicConverter implements IConvert { + public readonly from = Abjad.Ugaritic + public readonly to = Abjad.Phoenician + + public convert(text: string): string { + const UgToAr = new UgariticToArabicConverter() + const ar = UgToAr.convert(text) + const ArToIa = new ArabicToImperialAramaicConverter() + return ArToIa.convert(ar) + } +} diff --git a/packages/abjad-convert/src/ugaritic/toPhoenician.ts b/packages/abjad-convert/src/ugaritic/toPhoenician.ts index 414b6bb..d1d0fc0 100644 --- a/packages/abjad-convert/src/ugaritic/toPhoenician.ts +++ b/packages/abjad-convert/src/ugaritic/toPhoenician.ts @@ -9,12 +9,8 @@ export class UgariticToPhoenicianConverter implements IConvert { public convert(text: string): string { const UgToAr = new UgariticToArabicConverter() + const ar = UgToAr.convert(text) const ArToPh = new ArabicToPhoenicianConverter() - let result = '' - for (const letter of text) { - const ar = UgToAr.convert(letter) - result += ArToPh.convert(ar) - } - return result + return ArToPh.convert(ar) } } diff --git a/yarn.lock b/yarn.lock index 6a01bfc..255ff9b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -852,6 +852,11 @@ resolved "https://registry.yarnpkg.com/@ungap/structured-clone/-/structured-clone-1.2.0.tgz#756641adb587851b5ccb3e095daf27ae581c8406" integrity sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ== +abjad-convert@next: + version "0.0.2-next.3" + resolved "https://registry.yarnpkg.com/abjad-convert/-/abjad-convert-0.0.2-next.3.tgz#84ebeba250da979f3edea02a3d66c630e47ed34e" + integrity sha512-yrA4f9jFjNsoRgYBimLW7OIMzdXajRKF76H/66giD8xDRvGWE3sGWsyelLoXROjIAdhM6Pgo2CwCelnjlNz8Vg== + acorn-jsx@^5.3.2: version "5.3.2" resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.3.2.tgz#7ed5bb55908b3b2f1bc55c6af1653bada7f07937"