skrits 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/CODE_OF_CONDUCT.md +87 -0
  3. package/CONTRIBUTING.md +62 -0
  4. package/README.md +145 -0
  5. package/SECURITY.md +25 -0
  6. package/SUPPORT.md +13 -0
  7. package/dist/core/caseHelper.d.ts +5 -0
  8. package/dist/core/caseHelper.d.ts.map +1 -0
  9. package/dist/core/caseHelper.js +37 -0
  10. package/dist/core/index.d.ts +5 -0
  11. package/dist/core/index.d.ts.map +1 -0
  12. package/dist/core/index.js +21 -0
  13. package/dist/core/stringUtils.d.ts +9 -0
  14. package/dist/core/stringUtils.d.ts.map +1 -0
  15. package/dist/core/stringUtils.js +28 -0
  16. package/dist/core/tokenizer.d.ts +4 -0
  17. package/dist/core/tokenizer.d.ts.map +1 -0
  18. package/dist/core/tokenizer.js +15 -0
  19. package/dist/core/transliteration.d.ts +8 -0
  20. package/dist/core/transliteration.d.ts.map +1 -0
  21. package/dist/core/transliteration.js +85 -0
  22. package/dist/index.d.ts +10 -0
  23. package/dist/index.d.ts.map +1 -0
  24. package/dist/index.js +47 -0
  25. package/dist/leet.d.ts +25 -0
  26. package/dist/leet.d.ts.map +1 -0
  27. package/dist/leet.js +108 -0
  28. package/dist/leetrovacki.d.ts +37 -0
  29. package/dist/leetrovacki.d.ts.map +1 -0
  30. package/dist/leetrovacki.js +109 -0
  31. package/dist/satrovacki.d.ts +25 -0
  32. package/dist/satrovacki.d.ts.map +1 -0
  33. package/dist/satrovacki.js +157 -0
  34. package/dist/skrit.d.ts +28 -0
  35. package/dist/skrit.d.ts.map +1 -0
  36. package/dist/skrit.js +167 -0
  37. package/dist/utrovacki.d.ts +19 -0
  38. package/dist/utrovacki.d.ts.map +1 -0
  39. package/dist/utrovacki.js +100 -0
  40. package/package.json +32 -0
  41. package/src/core/caseHelper.ts +31 -0
  42. package/src/core/index.ts +4 -0
  43. package/src/core/stringUtils.ts +25 -0
  44. package/src/core/tokenizer.ts +12 -0
  45. package/src/core/transliteration.ts +84 -0
  46. package/src/index.ts +34 -0
  47. package/src/leet.ts +118 -0
  48. package/src/leetrovacki.ts +141 -0
  49. package/src/satrovacki.ts +176 -0
  50. package/src/skrit.ts +188 -0
  51. package/src/utrovacki.ts +111 -0
  52. package/tests/leet.test.ts +117 -0
  53. package/tests/leetrovacki.test.ts +76 -0
  54. package/tests/satrovacki.test.ts +112 -0
  55. package/tests/skrit.test.ts +80 -0
  56. package/tests/transliteration.test.ts +64 -0
  57. package/tests/utrovacki.test.ts +83 -0
  58. package/tsconfig.json +17 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,15 @@
1
+ # Changelog
2
+
3
+ ## 1.0.0 - 2026-04-13
4
+
5
+ - First stable public release of `SkriTS`.
6
+ - Full TypeScript port of Skrit core modules and unified router:
7
+ - `satrovacki`
8
+ - `utrovacki`
9
+ - `leetrovacki`
10
+ - `auto` mode detection and decode/encode routing
11
+ - Full Latin/Cyrillic support with transliteration.
12
+ - Leet profiles (`basic`, `readable`, `full`), complexity and density control.
13
+ - 90 tests, 100% coverage enforced.
14
+ - Community standards: `CODE_OF_CONDUCT`, `CONTRIBUTING`, `SECURITY`, `SUPPORT`, issue/PR templates.
15
+ - CI workflow and Dependabot config included.
@@ -0,0 +1,87 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and maintainers pledge to make participation in
6
+ our community a harassment-free experience for everyone, regardless of age,
7
+ body size, visible or invisible disability, ethnicity, sex characteristics,
8
+ gender identity and expression, level of experience, education, socio-economic
9
+ status, nationality, personal appearance, race, religion, or sexual identity
10
+ and orientation.
11
+
12
+ We pledge to act and interact in ways that contribute to an open, welcoming,
13
+ diverse, inclusive, and healthy community.
14
+
15
+ ## Our Standards
16
+
17
+ Examples of behavior that contributes to a positive environment include:
18
+
19
+ - Demonstrating empathy and kindness toward other people
20
+ - Being respectful of differing opinions, viewpoints, and experiences
21
+ - Giving and gracefully accepting constructive feedback
22
+ - Accepting responsibility and apologizing to those affected by our mistakes
23
+ - Focusing on what is best for the overall community
24
+
25
+ Examples of unacceptable behavior include:
26
+
27
+ - Unwelcome advances or attention of any kind
28
+ - Trolling, insulting or derogatory comments, and personal or political attacks
29
+ - Public or private harassment
30
+ - Publishing others' private information without their explicit permission
31
+ - Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Enforcement Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying and enforcing our standards
37
+ of acceptable behavior and will take appropriate and fair corrective action in
38
+ response to any behavior they deem inappropriate, threatening, offensive, or
39
+ harmful.
40
+
41
+ ## Scope
42
+
43
+ This Code of Conduct applies within all community spaces and also applies when
44
+ an individual is officially representing the community in public spaces.
45
+
46
+ ## Enforcement
47
+
48
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
49
+ reported to the project maintainers through GitHub's private vulnerability
50
+ reporting tools where available. Reports will be reviewed and investigated
51
+ promptly and fairly.
52
+
53
+ ## Enforcement Guidelines
54
+
55
+ ### 1. Correction
56
+
57
+ **Community Impact**: Inappropriate language or unprofessional behavior.
58
+
59
+ **Consequence**: A private, written warning with an explanation of why the
60
+ behavior was inappropriate.
61
+
62
+ ### 2. Warning
63
+
64
+ **Community Impact**: A violation through a single incident or series of
65
+ actions.
66
+
67
+ **Consequence**: A warning with consequences for continued behavior. No
68
+ interaction with the people involved for a specified period of time.
69
+
70
+ ### 3. Temporary Ban
71
+
72
+ **Community Impact**: A serious violation of community standards.
73
+
74
+ **Consequence**: A temporary ban from any sort of interaction or public
75
+ communication with the community for a specified period of time.
76
+
77
+ ### 4. Permanent Ban
78
+
79
+ **Community Impact**: Demonstrating a pattern of violation of community
80
+ standards, including sustained inappropriate behavior or harassment.
81
+
82
+ **Consequence**: A permanent ban from any sort of public interaction within the
83
+ community.
84
+
85
+ ## Attribution
86
+
87
+ This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org), version 2.1.
@@ -0,0 +1,62 @@
1
+ # Contributing to SkriTS
2
+
3
+ Thanks for contributing.
4
+
5
+ ## Development Setup
6
+
7
+ 1. Use Node.js 18+.
8
+ 2. Clone the repository.
9
+ 3. Install dependencies:
10
+
11
+ ```bash
12
+ npm install
13
+ ```
14
+
15
+ 4. Run tests:
16
+
17
+ ```bash
18
+ npm test
19
+ ```
20
+
21
+ 5. Run coverage (required):
22
+
23
+ ```bash
24
+ npm run test:coverage
25
+ ```
26
+
27
+ ## Project Scope
28
+
29
+ SkriTS contains multiple text transformation modules:
30
+
31
+ - `src/satrovacki.ts`
32
+ - `src/utrovacki.ts`
33
+ - `src/leet.ts`
34
+ - `src/leetrovacki.ts`
35
+ - `src/skrit.ts` (main router API)
36
+ - `src/core/` (shared utilities)
37
+
38
+ If you add a new transformation mode, wire it through `src/skrit.ts` and `src/index.ts`, and add tests.
39
+
40
+ ## Coding Guidelines
41
+
42
+ - Keep code and comments in English.
43
+ - Preserve existing behavior unless your PR explicitly changes a rule.
44
+ - Add or update tests for every behavior change.
45
+ - Keep examples in `README.md` aligned with real output.
46
+ - Maintain parity with Python `skrit` and `SkritPHP` behavior.
47
+
48
+ ## Pull Requests
49
+
50
+ 1. Open an issue first for non-trivial changes.
51
+ 2. Create a focused branch and keep the PR small.
52
+ 3. Include:
53
+ - what changed
54
+ - why it changed
55
+ - test details
56
+ 4. Ensure all tests pass before requesting review.
57
+
58
+ ## Commit Messages
59
+
60
+ Use clear, scoped commit messages. Example:
61
+
62
+ `feat(leet): add readable profile edge-case handling`
package/README.md ADDED
@@ -0,0 +1,145 @@
1
+ # SkriTS
2
+
3
+ [![CI](https://img.shields.io/github/actions/workflow/status/r0073rr0r/SkriTS/ci.yml?branch=master&label=CI)](https://github.com/r0073rr0r/SkriTS/actions/workflows/ci.yml)
4
+ [![npm](https://img.shields.io/npm/v/skrits)](https://www.npmjs.com/package/skrits)
5
+ [![License: GPL-3.0-or-later](https://img.shields.io/badge/License-GPL--3.0--or--later-blue.svg)](LICENSE)
6
+ [![Coverage](https://img.shields.io/badge/coverage-100%25-brightgreen)](#testing)
7
+ [![GitHub Stars](https://img.shields.io/github/stars/r0073rr0r/SkriTS?style=social)](https://github.com/r0073rr0r/SkriTS/stargazers)
8
+ [![GitHub Issues](https://img.shields.io/github/issues/r0073rr0r/SkriTS)](https://github.com/r0073rr0r/SkriTS/issues)
9
+ [![Last Commit](https://img.shields.io/github/last-commit/r0073rr0r/SkriTS)](https://github.com/r0073rr0r/SkriTS/commits/master)
10
+
11
+ TypeScript port of Python [`skrit`](https://github.com/r0073rr0r/Skrit) (`v0.5.x`) for Serbian slang-style text transforms:
12
+
13
+ - `satrovacki`
14
+ - `utrovacki`
15
+ - `leetrovacki`
16
+ - unified `auto` router with encode/decode detection
17
+
18
+ Also available as:
19
+ - Python: [`r0073rr0r/Skrit`](https://github.com/r0073rr0r/Skrit)
20
+ - PHP: [`r0073rr0r/SkritPHP`](https://github.com/r0073rr0r/SkritPHP)
21
+
22
+ ## Requirements
23
+
24
+ - Node.js `>=18`
25
+ - TypeScript `^5.0` (for direct use)
26
+
27
+ ## Install
28
+
29
+ ```bash
30
+ npm install skrits
31
+ ```
32
+
33
+ ## Usage
34
+
35
+ ### Unified Router (`encodeText`)
36
+
37
+ ```typescript
38
+ import { encodeText } from 'skrits';
39
+
40
+ const result = encodeText('Zemun zakon matori', { mode: 'satro' });
41
+ // 'Munze konza torima'
42
+
43
+ const decoded = encodeText('Munze konza', { mode: 'auto' });
44
+ // 'Zemun zakon'
45
+ ```
46
+
47
+ ### Force specific mode
48
+
49
+ ```typescript
50
+ import { encodeText } from 'skrits';
51
+
52
+ encodeText('bazen', { mode: 'satro' }); // 'zenba'
53
+ encodeText('bazen', { mode: 'utro' }); // 'uzenzabanje'
54
+ encodeText('bazen', { mode: 'leet', leetBase: 'satro', leetDensity: 1.0 }); // '23nb4'
55
+ ```
56
+
57
+ ### Direct transformer classes
58
+
59
+ ```typescript
60
+ import { Satrovacki, Utrovacki, Leetrovacki } from 'skrits';
61
+
62
+ const satro = new Satrovacki();
63
+ satro.encode('Beograd'); // 'Gradbeo'
64
+ satro.decode('Gradbeo'); // 'Beograd'
65
+
66
+ const utro = new Utrovacki({ prefix: 'x', infix: 'yy', suffix: 'zz' });
67
+ utro.encode('bazen'); // 'xzenyybazz'
68
+
69
+ const leet = new Leetrovacki({ base: 'utro', leetDensity: 1.0 });
70
+ leet.encode('bazen'); // 'uzen24ban73'
71
+ ```
72
+
73
+ ### Cyrillic support
74
+
75
+ ```typescript
76
+ import { Satrovacki } from 'skrits';
77
+
78
+ const s = new Satrovacki();
79
+ s.encode('Земун закон матори'); // 'Мунзе конза матори'
80
+ s.encode('Beograd'); // 'Gradbeo'
81
+ ```
82
+
83
+ ### Leet engine
84
+
85
+ ```typescript
86
+ import { LeetEncoder, applyLeet, getLeetProfile } from 'skrits';
87
+
88
+ const enc = new LeetEncoder({ profile: 'basic', density: 1.0 });
89
+ enc.encode('bazen'); // '54z3n'
90
+
91
+ const mapping = getLeetProfile('full', undefined, 0);
92
+ applyLeet('hello', mapping, 0.9);
93
+ ```
94
+
95
+ ## Supported Options
96
+
97
+ All options for `encodeText` and transformer constructors:
98
+
99
+ | Option | Values | Default | Description |
100
+ |---|---|---|---|
101
+ | `mode` | `auto\|satro\|utro\|leet` | `auto` | Transformation mode |
102
+ | `detectFrom` | `satro\|utro\|leet\|null` | `null` | Force decode detection source |
103
+ | `minWordLength` | number | `3` | Skip words shorter than this |
104
+ | `plainCTarget` | `ц\|ч\|ћ` | `ц` | Cyrillic target for plain `c` |
105
+ | `softTjToCyrillic` | boolean | `false` | Map `tj` → `ћ` |
106
+ | `exceptions` | `Record<string, string>` | `{}` | Word-level overrides |
107
+ | `leetBase` | `auto\|satro\|utro` | `auto` | Base mode for leet |
108
+ | `leetProfile` | `basic\|readable\|full` | `basic` | Leet substitution profile |
109
+ | `leetComplexity` | number | `0` | Variant depth for full profile |
110
+ | `leetDensity` | `0.0–1.0` | `0.86` | Fraction of chars to substitute |
111
+ | `zaStyle` | `24\|z4` | `24` | Utro infix leet style |
112
+ | `njeStyle` | `n73\|nj3\|њ` | `n73` | Utro suffix leet style |
113
+ | `utroPrefix` | string | `u` | Utro prefix |
114
+ | `utroInfix` | string | `za` | Utro infix |
115
+ | `utroSuffix` | string | `nje` | Utro suffix |
116
+
117
+ ## Testing
118
+
119
+ ```bash
120
+ npm test
121
+ ```
122
+
123
+ ```bash
124
+ npm run test:coverage
125
+ ```
126
+
127
+ Tests cover:
128
+
129
+ - satrovacki encode/decode roundtrip (Latin + Cyrillic)
130
+ - utrovacki affix encoding and decode
131
+ - leet profiles, density, and detection
132
+ - leetrovacki base mode resolution and styling
133
+ - unified router auto-detection and decode routing
134
+ - transliteration edge cases
135
+
136
+ ## License
137
+
138
+ GPL-3.0-or-later
139
+
140
+ ## Community
141
+
142
+ - [Code of Conduct](CODE_OF_CONDUCT.md)
143
+ - [Contributing](CONTRIBUTING.md)
144
+ - [Security Policy](SECURITY.md)
145
+ - [Support](SUPPORT.md)
package/SECURITY.md ADDED
@@ -0,0 +1,25 @@
1
+ # Security Policy
2
+
3
+ ## Supported Versions
4
+
5
+ This project is currently maintained on the default branch only.
6
+
7
+ ## Reporting a Vulnerability
8
+
9
+ Please do **not** open public issues for security vulnerabilities.
10
+
11
+ Preferred reporting method:
12
+
13
+ - Use GitHub's private vulnerability reporting ("Report a vulnerability") if
14
+ available for this repository.
15
+
16
+ If private reporting is not available, contact the maintainer privately and
17
+ include:
18
+
19
+ - a clear description of the issue
20
+ - impact assessment
21
+ - reproduction steps or proof of concept
22
+ - affected files/modules and suggested remediation (if known)
23
+
24
+ We aim to acknowledge reports promptly and provide status updates until
25
+ resolution.
package/SUPPORT.md ADDED
@@ -0,0 +1,13 @@
1
+ # Support
2
+
3
+ ## Getting Help
4
+
5
+ - For usage questions, open a GitHub Discussion (preferred) or an issue.
6
+ - For bugs, use the bug report issue template.
7
+ - For feature requests, use the feature request issue template.
8
+
9
+ ## Before Opening an Issue
10
+
11
+ - Check `README.md` examples.
12
+ - Run the test suite locally.
13
+ - Search existing issues for duplicates.
@@ -0,0 +1,5 @@
1
+ export declare function isUpperCase(s: string): boolean;
2
+ export declare function isLowerCase(s: string): boolean;
3
+ export declare function isTitleCase(s: string): boolean;
4
+ export declare function applyCase(original: string, transformed: string): string;
5
+ //# sourceMappingURL=caseHelper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"caseHelper.d.ts","sourceRoot":"","sources":["../../src/core/caseHelper.ts"],"names":[],"mappings":"AAEA,wBAAgB,WAAW,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAE9C;AAED,wBAAgB,WAAW,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAE9C;AAED,wBAAgB,WAAW,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAM9C;AAED,wBAAgB,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM,CAYvE"}
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ // D:\Projects\SkriTS\src\core\caseHelper.ts
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.isUpperCase = isUpperCase;
5
+ exports.isLowerCase = isLowerCase;
6
+ exports.isTitleCase = isTitleCase;
7
+ exports.applyCase = applyCase;
8
+ function isUpperCase(s) {
9
+ return s === s.toUpperCase() && s !== s.toLowerCase();
10
+ }
11
+ function isLowerCase(s) {
12
+ return s === s.toLowerCase() && s !== s.toUpperCase();
13
+ }
14
+ function isTitleCase(s) {
15
+ if (s.length === 0)
16
+ return false;
17
+ const chars = [...s];
18
+ return chars[0] === chars[0].toUpperCase() &&
19
+ chars.slice(1).join('') === chars.slice(1).join('').toLowerCase() &&
20
+ chars[0] !== chars[0].toLowerCase();
21
+ }
22
+ function applyCase(original, transformed) {
23
+ if (original.length === 0)
24
+ return transformed;
25
+ if (isUpperCase(original)) {
26
+ return transformed.toUpperCase();
27
+ }
28
+ if (isTitleCase(original)) {
29
+ const chars = [...transformed];
30
+ if (chars.length === 0)
31
+ return transformed;
32
+ return chars[0].toUpperCase() + chars.slice(1).join('').toLowerCase();
33
+ }
34
+ // default: lowercase
35
+ return transformed.toLowerCase();
36
+ }
37
+ //# sourceMappingURL=caseHelper.js.map
@@ -0,0 +1,5 @@
1
+ export * from './caseHelper';
2
+ export * from './stringUtils';
3
+ export * from './tokenizer';
4
+ export * from './transliteration';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC"}
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./caseHelper"), exports);
18
+ __exportStar(require("./stringUtils"), exports);
19
+ __exportStar(require("./tokenizer"), exports);
20
+ __exportStar(require("./transliteration"), exports);
21
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,9 @@
1
+ /** Unicode-safe string length */
2
+ export declare function strLen(s: string): number;
3
+ /** Unicode-safe substring */
4
+ export declare function strSubstr(s: string, start: number, length?: number): string;
5
+ /** Unicode-safe split into array of characters */
6
+ export declare function splitChars(s: string): string[];
7
+ export declare function startsWith(s: string, prefix: string): boolean;
8
+ export declare function endsWith(s: string, suffix: string): boolean;
9
+ //# sourceMappingURL=stringUtils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stringUtils.d.ts","sourceRoot":"","sources":["../../src/core/stringUtils.ts"],"names":[],"mappings":"AAEA,iCAAiC;AACjC,wBAAgB,MAAM,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAExC;AAED,6BAA6B;AAC7B,wBAAgB,SAAS,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAG3E;AAED,kDAAkD;AAClD,wBAAgB,UAAU,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAE9C;AAED,wBAAgB,UAAU,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAE7D;AAED,wBAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAE3D"}
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ // D:\Projects\SkriTS\src\core\stringUtils.ts
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.strLen = strLen;
5
+ exports.strSubstr = strSubstr;
6
+ exports.splitChars = splitChars;
7
+ exports.startsWith = startsWith;
8
+ exports.endsWith = endsWith;
9
+ /** Unicode-safe string length */
10
+ function strLen(s) {
11
+ return [...s].length;
12
+ }
13
+ /** Unicode-safe substring */
14
+ function strSubstr(s, start, length) {
15
+ const chars = [...s];
16
+ return chars.slice(start, length !== undefined ? start + length : undefined).join('');
17
+ }
18
+ /** Unicode-safe split into array of characters */
19
+ function splitChars(s) {
20
+ return [...s];
21
+ }
22
+ function startsWith(s, prefix) {
23
+ return s.startsWith(prefix);
24
+ }
25
+ function endsWith(s, suffix) {
26
+ return s.endsWith(suffix);
27
+ }
28
+ //# sourceMappingURL=stringUtils.js.map
@@ -0,0 +1,4 @@
1
+ /** Splits text into word tokens and non-word tokens (spaces, punctuation, digits) */
2
+ export declare function tokenize(text: string): string[];
3
+ export declare function isAlpha(token: string): boolean;
4
+ //# sourceMappingURL=tokenizer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tokenizer.d.ts","sourceRoot":"","sources":["../../src/core/tokenizer.ts"],"names":[],"mappings":"AAEA,qFAAqF;AACrF,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAI/C;AAED,wBAAgB,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAE9C"}
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ // D:\Projects\SkriTS\src\core\tokenizer.ts
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.tokenize = tokenize;
5
+ exports.isAlpha = isAlpha;
6
+ /** Splits text into word tokens and non-word tokens (spaces, punctuation, digits) */
7
+ function tokenize(text) {
8
+ // Match: word chars (letters), digits, whitespace, or any single char
9
+ const matches = text.match(/[^\W\d_]+|\d+|\s+|./gsu);
10
+ return matches ?? [];
11
+ }
12
+ function isAlpha(token) {
13
+ return /^[^\W\d_]+$/u.test(token);
14
+ }
15
+ //# sourceMappingURL=tokenizer.js.map
@@ -0,0 +1,8 @@
1
+ export declare const CYR_TO_LAT: Record<string, string>;
2
+ export declare const LAT_TO_CYR_DIGRAPHS: Record<string, string>;
3
+ export declare const LAT_TO_CYR_SINGLE: Record<string, string>;
4
+ export declare const OPTIONAL_TJ_TO_CYR: Record<string, string>;
5
+ export declare function cyrillicToLatin(text: string): string;
6
+ export declare function latinToCyrillic(text: string, softTjToCyrillic?: boolean, plainCTarget?: string): string;
7
+ export declare function containsCyrillic(text: string): boolean;
8
+ //# sourceMappingURL=transliteration.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transliteration.d.ts","sourceRoot":"","sources":["../../src/core/transliteration.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAW7C,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAItD,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAWpD,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAErD,CAAC;AAEF,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAOpD;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,gBAAgB,UAAQ,EAAE,YAAY,SAAM,GAAG,MAAM,CAgClG;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEtD"}
@@ -0,0 +1,85 @@
1
+ "use strict";
2
+ // D:\Projects\SkriTS\src\core\transliteration.ts
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.OPTIONAL_TJ_TO_CYR = exports.LAT_TO_CYR_SINGLE = exports.LAT_TO_CYR_DIGRAPHS = exports.CYR_TO_LAT = void 0;
5
+ exports.cyrillicToLatin = cyrillicToLatin;
6
+ exports.latinToCyrillic = latinToCyrillic;
7
+ exports.containsCyrillic = containsCyrillic;
8
+ exports.CYR_TO_LAT = {
9
+ 'а': 'a', 'б': 'b', 'в': 'v', 'г': 'g', 'д': 'd', 'ђ': 'đ',
10
+ 'е': 'e', 'ж': 'ž', 'з': 'z', 'и': 'i', 'ј': 'j', 'к': 'k',
11
+ 'л': 'l', 'љ': 'lj', 'м': 'm', 'н': 'n', 'њ': 'nj', 'о': 'o',
12
+ 'п': 'p', 'р': 'r', 'с': 's', 'т': 't', 'ћ': 'ć', 'у': 'u',
13
+ 'ф': 'f', 'х': 'h', 'ц': 'c', 'ч': 'č', 'џ': 'dž', 'ш': 'š',
14
+ 'А': 'A', 'Б': 'B', 'В': 'V', 'Г': 'G', 'Д': 'D', 'Ђ': 'Đ',
15
+ 'Е': 'E', 'Ж': 'Ž', 'З': 'Z', 'И': 'I', 'Ј': 'J', 'К': 'K',
16
+ 'Л': 'L', 'Љ': 'Lj', 'М': 'M', 'Н': 'N', 'Њ': 'Nj', 'О': 'O',
17
+ 'П': 'P', 'Р': 'R', 'С': 'S', 'Т': 'T', 'Ћ': 'Ć', 'У': 'U',
18
+ 'Ф': 'F', 'Х': 'H', 'Ц': 'C', 'Ч': 'Č', 'Џ': 'Dž', 'Ш': 'Š',
19
+ };
20
+ exports.LAT_TO_CYR_DIGRAPHS = {
21
+ 'lj': 'љ', 'nj': 'њ', 'dž': 'џ',
22
+ 'Lj': 'Љ', 'Nj': 'Њ', 'Dž': 'Џ',
23
+ 'LJ': 'Љ', 'NJ': 'Њ', 'DŽ': 'Џ',
24
+ };
25
+ exports.LAT_TO_CYR_SINGLE = {
26
+ 'a': 'а', 'b': 'б', 'v': 'в', 'g': 'г', 'd': 'д', 'đ': 'ђ',
27
+ 'e': 'е', 'ž': 'ж', 'z': 'з', 'i': 'и', 'j': 'ј', 'k': 'к',
28
+ 'l': 'л', 'm': 'м', 'n': 'н', 'o': 'о', 'p': 'п', 'r': 'р',
29
+ 's': 'с', 't': 'т', 'ć': 'ћ', 'u': 'у', 'f': 'ф', 'h': 'х',
30
+ 'c': 'ц', 'č': 'ч', 'š': 'ш',
31
+ 'A': 'А', 'B': 'Б', 'V': 'В', 'G': 'Г', 'D': 'Д', 'Đ': 'Ђ',
32
+ 'E': 'Е', 'Ž': 'Ж', 'Z': 'З', 'I': 'И', 'J': 'Ј', 'K': 'К',
33
+ 'L': 'Л', 'M': 'М', 'N': 'Н', 'O': 'О', 'P': 'П', 'R': 'Р',
34
+ 'S': 'С', 'T': 'Т', 'Ć': 'Ћ', 'U': 'У', 'F': 'Ф', 'H': 'Х',
35
+ 'C': 'Ц', 'Č': 'Ч', 'Š': 'Ш',
36
+ };
37
+ exports.OPTIONAL_TJ_TO_CYR = {
38
+ 'tj': 'ћ', 'Tj': 'Ћ', 'TJ': 'Ћ',
39
+ };
40
+ function cyrillicToLatin(text) {
41
+ let result = '';
42
+ const chars = [...text]; // unicode-safe split
43
+ for (const ch of chars) {
44
+ result += exports.CYR_TO_LAT[ch] ?? ch;
45
+ }
46
+ return result;
47
+ }
48
+ function latinToCyrillic(text, softTjToCyrillic = false, plainCTarget = 'ц') {
49
+ let result = '';
50
+ const chars = [...text];
51
+ let i = 0;
52
+ while (i < chars.length) {
53
+ // Try digraphs (2-char)
54
+ const two = chars[i] + (chars[i + 1] ?? '');
55
+ if (exports.LAT_TO_CYR_DIGRAPHS[two] !== undefined) {
56
+ result += exports.LAT_TO_CYR_DIGRAPHS[two];
57
+ i += 2;
58
+ continue;
59
+ }
60
+ // Try optional tj
61
+ if (softTjToCyrillic && exports.OPTIONAL_TJ_TO_CYR[two] !== undefined) {
62
+ result += exports.OPTIONAL_TJ_TO_CYR[two];
63
+ i += 2;
64
+ continue;
65
+ }
66
+ // Single char
67
+ const ch = chars[i];
68
+ if (ch === 'c' || ch === 'C') {
69
+ // plain_c_target: 'ц' (default), 'ч', 'ћ'
70
+ const target = plainCTarget === 'ч' ? (ch === 'C' ? 'Ч' : 'ч')
71
+ : plainCTarget === 'ћ' ? (ch === 'C' ? 'Ћ' : 'ћ')
72
+ : (ch === 'C' ? 'Ц' : 'ц');
73
+ result += target;
74
+ }
75
+ else {
76
+ result += exports.LAT_TO_CYR_SINGLE[ch] ?? ch;
77
+ }
78
+ i++;
79
+ }
80
+ return result;
81
+ }
82
+ function containsCyrillic(text) {
83
+ return /[а-яёА-ЯЁа-щА-ЩЮЯЁа-щА-ЩЮЯЁжйхцчшщъыьэюяЖЙХЦЧШЩЪЫЬЭЮЯ\u0400-\u04FF]/u.test(text);
84
+ }
85
+ //# sourceMappingURL=transliteration.js.map
@@ -0,0 +1,10 @@
1
+ export { Satrovacki, SatrovackiOptions } from './satrovacki';
2
+ export { Utrovacki, UtrovackiOptions } from './utrovacki';
3
+ export { Leetrovacki, LeetrovackiOptions, LeetBase, ZaStyle, NjeStyle } from './leetrovacki';
4
+ export { LEET_TABLE, BASIC_LEET_PROFILE, READABLE_FULL_PROFILE, DEFAULT_LEET_DENSITY, LEET_SIGNAL_CHARS, LeetProfile, LeetEncoder, LeetEncoderOptions, availableProfiles, getLeetProfile, buildFullLeetProfile, applyLeet, looksLikeLeet, } from './leet';
5
+ export { encodeText, detectMode, detectLeetBase, _deleetTextBasic, _looksLikeSatroEncoded, SkritOptions, Mode, DetectFrom, } from './skrit';
6
+ export * from './core/transliteration';
7
+ export * from './core/caseHelper';
8
+ export * from './core/stringUtils';
9
+ export * from './core/tokenizer';
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAC7D,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC7F,OAAO,EACL,UAAU,EACV,kBAAkB,EAClB,qBAAqB,EACrB,oBAAoB,EACpB,iBAAiB,EACjB,WAAW,EACX,WAAW,EACX,kBAAkB,EAClB,iBAAiB,EACjB,cAAc,EACd,oBAAoB,EACpB,SAAS,EACT,aAAa,GACd,MAAM,QAAQ,CAAC;AAChB,OAAO,EACL,UAAU,EACV,UAAU,EACV,cAAc,EACd,gBAAgB,EAChB,sBAAsB,EACtB,YAAY,EACZ,IAAI,EACJ,UAAU,GACX,MAAM,SAAS,CAAC;AACjB,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC"}