taraskevizer 1.5.3 → 1.6.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.
- package/README.md +10 -7
- package/dist/index.cjs +3 -6
- package/dist/index.d.cts +2 -5
- package/dist/index.d.ts +2 -5
- package/dist/index.js +2 -4
- package/package.json +1 -2
package/README.md
CHANGED
|
@@ -7,21 +7,24 @@ $ npm i taraskevizer
|
|
|
7
7
|
## Usage
|
|
8
8
|
|
|
9
9
|
```js
|
|
10
|
-
import {
|
|
10
|
+
import { tarask, ALPHABET } from 'taraskevizer';
|
|
11
11
|
|
|
12
|
-
const result =
|
|
12
|
+
const result = tarask(text);
|
|
13
13
|
// or
|
|
14
|
-
const result =
|
|
14
|
+
const result = tarask(text, {
|
|
15
|
+
html: {
|
|
16
|
+
abc: ALPHABET.ARABIC,
|
|
17
|
+
g: false,
|
|
18
|
+
// ...
|
|
19
|
+
},
|
|
20
|
+
nonHtml: false,
|
|
21
|
+
});
|
|
15
22
|
```
|
|
16
23
|
|
|
17
24
|
## API
|
|
18
25
|
|
|
19
26
|
### tarask(text, options?)
|
|
20
27
|
|
|
21
|
-
Returns a `Promise<string>`
|
|
22
|
-
|
|
23
|
-
### taraskSync(text, options?)
|
|
24
|
-
|
|
25
28
|
Returns a `string`
|
|
26
29
|
|
|
27
30
|
#### text
|
package/dist/index.cjs
CHANGED
|
@@ -24,8 +24,7 @@ __export(src_exports, {
|
|
|
24
24
|
J: () => J,
|
|
25
25
|
VARIATION: () => VARIATION,
|
|
26
26
|
gobj: () => gobj,
|
|
27
|
-
tarask: () => tarask
|
|
28
|
-
taraskSync: () => taraskSync
|
|
27
|
+
tarask: () => tarask
|
|
29
28
|
});
|
|
30
29
|
module.exports = __toCommonJS(src_exports);
|
|
31
30
|
|
|
@@ -2162,7 +2161,7 @@ var afterTarask = [
|
|
|
2162
2161
|
($0, $1, $2) => /([ая]ў|ну)$/.test($2) ? $1 + "ь і" + $2 : $0
|
|
2163
2162
|
]
|
|
2164
2163
|
];
|
|
2165
|
-
var
|
|
2164
|
+
var tarask = (text, options = {}) => {
|
|
2166
2165
|
const { abc = 0, j = 0, html = false, nonHtml = false } = options;
|
|
2167
2166
|
const isHtmlObject = isObject(html);
|
|
2168
2167
|
const isNonHtmlObject = isObject(nonHtml);
|
|
@@ -2228,7 +2227,6 @@ var taraskSync = (text, options = {}) => {
|
|
|
2228
2227
|
text = text.replace(NOFIX_REGEX, () => noFix.shift());
|
|
2229
2228
|
return (html ? finalizer.html(text) : finalizer.nonHtml(text, nonHtml)).trim();
|
|
2230
2229
|
};
|
|
2231
|
-
var tarask = (...args) => new Promise((res) => res(taraskSync(...args)));
|
|
2232
2230
|
var restoreCase = (text, orig) => {
|
|
2233
2231
|
for (let i = 0; i < text.length; i++) {
|
|
2234
2232
|
const word = text[i];
|
|
@@ -2357,6 +2355,5 @@ var finalizer = {
|
|
|
2357
2355
|
J,
|
|
2358
2356
|
VARIATION,
|
|
2359
2357
|
gobj,
|
|
2360
|
-
tarask
|
|
2361
|
-
taraskSync
|
|
2358
|
+
tarask
|
|
2362
2359
|
});
|
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
type Promisify<T> = T extends (...args: infer TArgs) => infer TReturn ? (...args: TArgs) => Promise<TReturn> : never;
|
|
2
1
|
type AnyFn = (...args: any[]) => any;
|
|
3
2
|
type DeepPartial<T> = T extends object ? T extends AnyFn ? T : {
|
|
4
3
|
[P in keyof T]?: DeepPartial<T[P]>;
|
|
@@ -25,7 +24,6 @@ type TaraskOptionsStrict = {
|
|
|
25
24
|
};
|
|
26
25
|
type TaraskOptions = DeepPartial<TaraskOptionsStrict>;
|
|
27
26
|
type Tarask = (text: string, options?: TaraskOptions) => string;
|
|
28
|
-
type TaraskAsync = Promisify<Tarask>;
|
|
29
27
|
type Dict<T = RegExp> = [T, string][];
|
|
30
28
|
type ExtendedDict = [
|
|
31
29
|
RegExp,
|
|
@@ -51,8 +49,7 @@ declare const VARIATION: {
|
|
|
51
49
|
readonly FIRST: 1;
|
|
52
50
|
readonly ALL: 2;
|
|
53
51
|
};
|
|
54
|
-
declare const
|
|
55
|
-
declare const tarask: TaraskAsync;
|
|
52
|
+
declare const tarask: Tarask;
|
|
56
53
|
|
|
57
54
|
declare const gobj: {
|
|
58
55
|
readonly г: "ґ";
|
|
@@ -61,4 +58,4 @@ declare const gobj: {
|
|
|
61
58
|
readonly Ґ: "Г";
|
|
62
59
|
};
|
|
63
60
|
|
|
64
|
-
export { ALPHABET, AlphabetDependentDict, Dict, ExtendedDict, HtmlOptions, J, NonHtmlOptions, ReplaceWithDict, Tarask,
|
|
61
|
+
export { ALPHABET, AlphabetDependentDict, Dict, ExtendedDict, HtmlOptions, J, NonHtmlOptions, ReplaceWithDict, Tarask, TaraskOptions, TaraskOptionsStrict, ToTarask, VARIATION, gobj, tarask };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
type Promisify<T> = T extends (...args: infer TArgs) => infer TReturn ? (...args: TArgs) => Promise<TReturn> : never;
|
|
2
1
|
type AnyFn = (...args: any[]) => any;
|
|
3
2
|
type DeepPartial<T> = T extends object ? T extends AnyFn ? T : {
|
|
4
3
|
[P in keyof T]?: DeepPartial<T[P]>;
|
|
@@ -25,7 +24,6 @@ type TaraskOptionsStrict = {
|
|
|
25
24
|
};
|
|
26
25
|
type TaraskOptions = DeepPartial<TaraskOptionsStrict>;
|
|
27
26
|
type Tarask = (text: string, options?: TaraskOptions) => string;
|
|
28
|
-
type TaraskAsync = Promisify<Tarask>;
|
|
29
27
|
type Dict<T = RegExp> = [T, string][];
|
|
30
28
|
type ExtendedDict = [
|
|
31
29
|
RegExp,
|
|
@@ -51,8 +49,7 @@ declare const VARIATION: {
|
|
|
51
49
|
readonly FIRST: 1;
|
|
52
50
|
readonly ALL: 2;
|
|
53
51
|
};
|
|
54
|
-
declare const
|
|
55
|
-
declare const tarask: TaraskAsync;
|
|
52
|
+
declare const tarask: Tarask;
|
|
56
53
|
|
|
57
54
|
declare const gobj: {
|
|
58
55
|
readonly г: "ґ";
|
|
@@ -61,4 +58,4 @@ declare const gobj: {
|
|
|
61
58
|
readonly Ґ: "Г";
|
|
62
59
|
};
|
|
63
60
|
|
|
64
|
-
export { ALPHABET, AlphabetDependentDict, Dict, ExtendedDict, HtmlOptions, J, NonHtmlOptions, ReplaceWithDict, Tarask,
|
|
61
|
+
export { ALPHABET, AlphabetDependentDict, Dict, ExtendedDict, HtmlOptions, J, NonHtmlOptions, ReplaceWithDict, Tarask, TaraskOptions, TaraskOptionsStrict, ToTarask, VARIATION, gobj, tarask };
|
package/dist/index.js
CHANGED
|
@@ -2131,7 +2131,7 @@ var afterTarask = [
|
|
|
2131
2131
|
($0, $1, $2) => /([ая]ў|ну)$/.test($2) ? $1 + "ь і" + $2 : $0
|
|
2132
2132
|
]
|
|
2133
2133
|
];
|
|
2134
|
-
var
|
|
2134
|
+
var tarask = (text, options = {}) => {
|
|
2135
2135
|
const { abc = 0, j = 0, html = false, nonHtml = false } = options;
|
|
2136
2136
|
const isHtmlObject = isObject(html);
|
|
2137
2137
|
const isNonHtmlObject = isObject(nonHtml);
|
|
@@ -2197,7 +2197,6 @@ var taraskSync = (text, options = {}) => {
|
|
|
2197
2197
|
text = text.replace(NOFIX_REGEX, () => noFix.shift());
|
|
2198
2198
|
return (html ? finalizer.html(text) : finalizer.nonHtml(text, nonHtml)).trim();
|
|
2199
2199
|
};
|
|
2200
|
-
var tarask = (...args) => new Promise((res) => res(taraskSync(...args)));
|
|
2201
2200
|
var restoreCase = (text, orig) => {
|
|
2202
2201
|
for (let i = 0; i < text.length; i++) {
|
|
2203
2202
|
const word = text[i];
|
|
@@ -2325,6 +2324,5 @@ export {
|
|
|
2325
2324
|
J,
|
|
2326
2325
|
VARIATION,
|
|
2327
2326
|
gobj,
|
|
2328
|
-
tarask
|
|
2329
|
-
taraskSync
|
|
2327
|
+
tarask
|
|
2330
2328
|
};
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "taraskevizer",
|
|
3
3
|
"author": "GooseOb",
|
|
4
4
|
"license": "MIT",
|
|
5
|
-
"version": "1.
|
|
5
|
+
"version": "1.6.0",
|
|
6
6
|
"private": false,
|
|
7
7
|
"homepage": "https://gooseob.github.io/taraskevizatar/",
|
|
8
8
|
"main": "dist/index.js",
|
|
@@ -23,7 +23,6 @@
|
|
|
23
23
|
"dev": "esrun --watch=src/*,test/* --send-code-mode=temporaryFile test",
|
|
24
24
|
"dev:bun": "bun test --watch",
|
|
25
25
|
"test": "esrun --send-code-mode=temporaryFile test",
|
|
26
|
-
"test:bun": "bun test",
|
|
27
26
|
"prepare": "husky install"
|
|
28
27
|
},
|
|
29
28
|
"repository": {
|