taraskevizer 1.6.3 → 1.7.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/dist/index.cjs +1 -4
- package/dist/index.d.cts +7 -4
- package/dist/index.d.ts +7 -4
- package/dist/index.js +1 -4
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2164,9 +2164,6 @@ var tarask = (text, options = {}) => {
|
|
|
2164
2164
|
const { abc = 0, j = 0, html = false, nonHtml = false } = options;
|
|
2165
2165
|
const isHtmlObject = isObject(html);
|
|
2166
2166
|
const isNonHtmlObject = isObject(nonHtml);
|
|
2167
|
-
if (isNonHtmlObject) {
|
|
2168
|
-
nonHtml.variations ||= 0;
|
|
2169
|
-
}
|
|
2170
2167
|
const apply = html ? tagApplications.html : tagApplications.nonHtml;
|
|
2171
2168
|
const noFix = [];
|
|
2172
2169
|
const LEFT_ANGLE_BRACKET = html ? "<" : "<";
|
|
@@ -2338,7 +2335,7 @@ var finalizer = {
|
|
|
2338
2335
|
}).replace(/ \n /g, "<br>"),
|
|
2339
2336
|
nonHtml(text, options) {
|
|
2340
2337
|
if (isObject(options) && "variations" in options && options.variations !== VARIATION.ALL) {
|
|
2341
|
-
const WORD_INDEX = options.variations;
|
|
2338
|
+
const WORD_INDEX = options.variations ?? 0;
|
|
2342
2339
|
const replacer = ($0) => $0.slice(1, -1).split("|")[WORD_INDEX];
|
|
2343
2340
|
text = text.replace(
|
|
2344
2341
|
OPTIONAL_WORDS_REGEX,
|
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
type
|
|
2
|
-
type DeepPartial<T> = T
|
|
1
|
+
type ModifyObjectType<T, TResultObj> = T extends object ? T extends (...args: any[]) => any ? T : TResultObj : T;
|
|
2
|
+
type DeepPartial<T> = ModifyObjectType<T, {
|
|
3
3
|
[P in keyof T]?: DeepPartial<T[P]>;
|
|
4
|
-
}
|
|
4
|
+
}>;
|
|
5
|
+
type DeepReadonly<T> = ModifyObjectType<T, {
|
|
6
|
+
readonly [P in keyof T]: DeepReadonly<T[P]>;
|
|
7
|
+
}>;
|
|
5
8
|
type Alphabet = 0 | 1 | 2 | 3;
|
|
6
9
|
type OptionJ = 0 | 1 | 2;
|
|
7
10
|
type Variation = 0 | 1 | 2;
|
|
@@ -23,7 +26,7 @@ type TaraskOptionsStrict = {
|
|
|
23
26
|
OVERRIDE_toTarask?: ToTarask;
|
|
24
27
|
};
|
|
25
28
|
type TaraskOptions = DeepPartial<TaraskOptionsStrict>;
|
|
26
|
-
type Tarask = (text: string, options?: TaraskOptions) => string;
|
|
29
|
+
type Tarask = (text: string, options?: DeepReadonly<TaraskOptions>) => string;
|
|
27
30
|
type Dict<T = RegExp> = [T, string][];
|
|
28
31
|
type ExtendedDict = [
|
|
29
32
|
RegExp,
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
type
|
|
2
|
-
type DeepPartial<T> = T
|
|
1
|
+
type ModifyObjectType<T, TResultObj> = T extends object ? T extends (...args: any[]) => any ? T : TResultObj : T;
|
|
2
|
+
type DeepPartial<T> = ModifyObjectType<T, {
|
|
3
3
|
[P in keyof T]?: DeepPartial<T[P]>;
|
|
4
|
-
}
|
|
4
|
+
}>;
|
|
5
|
+
type DeepReadonly<T> = ModifyObjectType<T, {
|
|
6
|
+
readonly [P in keyof T]: DeepReadonly<T[P]>;
|
|
7
|
+
}>;
|
|
5
8
|
type Alphabet = 0 | 1 | 2 | 3;
|
|
6
9
|
type OptionJ = 0 | 1 | 2;
|
|
7
10
|
type Variation = 0 | 1 | 2;
|
|
@@ -23,7 +26,7 @@ type TaraskOptionsStrict = {
|
|
|
23
26
|
OVERRIDE_toTarask?: ToTarask;
|
|
24
27
|
};
|
|
25
28
|
type TaraskOptions = DeepPartial<TaraskOptionsStrict>;
|
|
26
|
-
type Tarask = (text: string, options?: TaraskOptions) => string;
|
|
29
|
+
type Tarask = (text: string, options?: DeepReadonly<TaraskOptions>) => string;
|
|
27
30
|
type Dict<T = RegExp> = [T, string][];
|
|
28
31
|
type ExtendedDict = [
|
|
29
32
|
RegExp,
|
package/dist/index.js
CHANGED
|
@@ -2134,9 +2134,6 @@ var tarask = (text, options = {}) => {
|
|
|
2134
2134
|
const { abc = 0, j = 0, html = false, nonHtml = false } = options;
|
|
2135
2135
|
const isHtmlObject = isObject(html);
|
|
2136
2136
|
const isNonHtmlObject = isObject(nonHtml);
|
|
2137
|
-
if (isNonHtmlObject) {
|
|
2138
|
-
nonHtml.variations ||= 0;
|
|
2139
|
-
}
|
|
2140
2137
|
const apply = html ? tagApplications.html : tagApplications.nonHtml;
|
|
2141
2138
|
const noFix = [];
|
|
2142
2139
|
const LEFT_ANGLE_BRACKET = html ? "<" : "<";
|
|
@@ -2308,7 +2305,7 @@ var finalizer = {
|
|
|
2308
2305
|
}).replace(/ \n /g, "<br>"),
|
|
2309
2306
|
nonHtml(text, options) {
|
|
2310
2307
|
if (isObject(options) && "variations" in options && options.variations !== VARIATION.ALL) {
|
|
2311
|
-
const WORD_INDEX = options.variations;
|
|
2308
|
+
const WORD_INDEX = options.variations ?? 0;
|
|
2312
2309
|
const replacer = ($0) => $0.slice(1, -1).split("|")[WORD_INDEX];
|
|
2313
2310
|
text = text.replace(
|
|
2314
2311
|
OPTIONAL_WORDS_REGEX,
|