Skip to content

Commit

Permalink
feat: rebrand as @interslavic/utils (#3)
Browse files Browse the repository at this point in the history
Expose all the actually useful functions for verbs conjugation, nouns declination, etc. Remove too
database-specific helpers.

BREAKING CHANGE: All the exported members has been changed.
  • Loading branch information
noomorph authored Jun 4, 2023
1 parent f022425 commit b69d4df
Show file tree
Hide file tree
Showing 87 changed files with 903,225 additions and 2,673 deletions.
5 changes: 3 additions & 2 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@
"extends": [
"eslint:recommended",
"plugin:prettier/recommended",
"plugin:@typescript-eslint/recommended"
"plugin:@typescript-eslint/recommended",
"plugin:ecmascript-compat/recommended"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 11,
"ecmaVersion": "latest",
"project": "tsconfig.json",
"sourceType": "module"
},
Expand Down
57 changes: 51 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,58 @@
# @interslavic/steen-utils
# @interslavic/utils

[![npm version](https://badge.fury.io/js/%40interslavic%2Fsteen-utils.svg)](https://badge.fury.io/js/%40interslavic%2Fsteen-utils)
[![Build Status](https://github.com/medzuslovjansky/steen-utils/actions/workflows/ci.yml/badge.svg)](https://github.com/medzuslovjansky/steen-utils/actions/workflows/ci.yml)
[![Coverage Status](https://coveralls.io/repos/github/medzuslovjansky/steen-utils/badge.svg?branch=main)](https://coveralls.io/github/medzuslovjansky/steen-utils?branch=main)
[![npm version](https://badge.fury.io/js/%40interslavic%2Futils.svg)](https://badge.fury.io/js/%40interslavic%2Futils)
[![Build Status](https://github.com/medzuslovjansky/js-utils/actions/workflows/ci.yml/badge.svg)](https://github.com/medzuslovjansky/js-utils/actions/workflows/ci.yml)
[![Coverage Status](https://coveralls.io/repos/github/medzuslovjansky/js-utils/badge.svg?branch=main)](https://coveralls.io/github/medzuslovjansky/js-utils?branch=main)

Utilities to work with Interslavic database in Jan van Steenbergen's format
This package contains various utilities for Interslavic language to work with BCP 47 codes, transliteration, declension, conjugation, etc.

## Installation

To install in your project, use:

```
npm install @interslavic/steen-utils --save
npm install @interslavic/utils --save
```

## Overview

### Constants

* `InterslavicBCP47` - primary BCP 47 codes for Interslavic like `art-x-interslv` and its variants per used alphabets.
* `FlavorisationBCP47` - all possible BCP 47 codes for Interslavic with flavorisations applied like Northern, Southern, Slovianto, etc.
* `Glagolitic` - collection of named constants for Glagolitic letters, e.g. `Glagolitic.AZU`, `Glagolitic.BUKY`, etc.

### Functions

#### Transliteration

* `transliterate` - transliterate text from one alphabet to another using BCP 47 codes

#### Part of speech

* `parsePos` - parse tags like `f.`, `v.tr. impf.`, etc. into an object with convenient properties

#### Adjectives

* `declensionAdjective` - declension of adjectives into an object form.
* `declensionAdjectiveFlat` - declension of adjectives into an array of strings.

#### Nouns

* `declensionNoun` - declension of nouns into an object form.
* `declensionNounFlat` - declension of nouns into an array of strings.

#### Numerals

* `declensionNumeral` - declension of numerals into an object form.
* `declensionNumeralFlat` - declension of numerals into an array of strings.

#### Pronouns

* `declensionPronoun` - declension of pronouns into an object form.
* `declensionPronounFlat` - declension of pronouns into an array of strings.

#### Verbs

* `conjugationVerb` - conjugation of verbs into an object form.
* `conjugationVerbFlat` - conjugation of verbs into an array of strings.
10 changes: 0 additions & 10 deletions jest.config.ts

This file was deleted.

67 changes: 43 additions & 24 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,64 +1,83 @@
{
"name": "@interslavic/steen-utils",
"name": "@interslavic/utils",
"version": "0.0.0",
"description": "Utilities to work with Interslavic database in Jan van Steenbergen's format",
"description": "Utilities for declension, conjugation, transliteration, etc.",
"main": "dist/index.js",
"files": [
"dist",
"src",
"!**/*.json",
"!**/*.test.*"
],
"scripts": {
"clean": "rimraf dist",
"build": "tsc",
"docs": "typedoc",
"lint": "eslint src/**/*.ts",
"test": "jest",
"prepare": "husky install; npm run clean && npm run build",
"prepare": "husky install",
"precommit": "lint-staged && git add src",
"prepush": "bash scripts/prepush.sh"
},
"repository": {
"type": "git",
"url": "git+https://github.com/medzuslovjansky/steen-utils.git"
"url": "git+https://github.com/medzuslovjansky/js-utils.git"
},
"keywords": [
"interslavic",
"steenbergen"
],
"authors": [
"Jan van Steenbergen <[email protected]>",
"Yaroslav Serhieiev <[email protected]>"
],
"license": "MIT",
"bugs": {
"url": "https://github.com/medzuslovjansky/steen-utils/issues"
"url": "https://github.com/medzuslovjansky/js-utils/issues"
},
"homepage": "https://github.com/medzuslovjansky/steen-utils#readme",
"homepage": "https://github.com/medzuslovjansky/js-utils#readme",
"engines": {
"node": ">=14"
},
"devDependencies": {
"@commitlint/cli": "^11.0.0",
"@commitlint/config-conventional": "^11.0.0",
"@types/jest": "^26.0.22",
"@types/jest": "^28.1.8",
"@types/lodash": "^4.14.168",
"@typescript-eslint/eslint-plugin": "^4.22.0",
"@typescript-eslint/parser": "^4.22.0",
"@typescript-eslint/eslint-plugin": "^5.59.8",
"@typescript-eslint/parser": "^5.59.8",
"cz-conventional-changelog": "^3.3.0",
"eslint": "^7.24.0",
"eslint-config-prettier": "^8.2.0",
"eslint-plugin-jsdoc": "^32.3.0",
"eslint": "^8.42.0",
"eslint-config-prettier": "^8.8.0",
"eslint-plugin-jsdoc": "^46.2.2",
"eslint-plugin-prefer-arrow": "^1.2.3",
"eslint-plugin-prettier": "^3.4.0",
"husky": "^6.0.0",
"jest": "^26.6.3",
"jest-circus": "^26.6.3",
"lint-staged": "^10.5.4",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-ecmascript-compat": "^3.0.0",
"husky": "^8.0.3",
"jest": "^28.1.3",
"lint-staged": "^13.2.2",
"lodash": "^4.17.21",
"prettier": "^2.2.1",
"prettier": "^2.8.8",
"rimraf": "^3.0.2",
"semantic-release": "^19.0.5",
"ts-jest": "^26.5.5",
"ts-node": "^9.1.1",
"typedoc": "^0.23.15",
"typescript": "~4.6.0"
"semantic-release": "^21.0.3",
"ts-jest": "^28.0.8",
"typedoc": "^0.24.7",
"typescript": "^4.9.5"
},
"dependencies": {
"tslib": "^2.2.0"
}
},
"jest": {
"transform": {
"\\.ts$": "ts-jest"
},
"testPathIgnorePatterns": [
"/node_modules/",
"/dist/"
]
},
"browserslist": [
"node 14",
"iOS >= 14.5"
]
}
24 changes: 24 additions & 0 deletions src/adjective/declensionAdjective.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import fs from 'node:fs';
import path from 'node:path';

import { declensionAdjective } from './declensionAdjective';

const rawTestCases: any[] = JSON.parse(
fs.readFileSync(path.join(__dirname, 'testCases.json'), 'utf8'),
);

describe('adjective', () => {
const adjective = (rawTestCases as any[]).map(
({ init, expected }) => [init.word, expected] as const,
);

test.each(adjective)('%s', (word, expected) => {
const actual = declensionAdjective(word, '');

if (actual === null) {
expect(actual).toBe(expected);
} else {
expect(actual).toMatchObject(expected);
}
});
});
Loading

0 comments on commit b69d4df

Please sign in to comment.