@karta.io/utils 0.13.0 → 0.13.2
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.d.ts +60 -60
- package/package.json +3 -4
package/dist/index.d.ts
CHANGED
|
@@ -1,93 +1,93 @@
|
|
|
1
1
|
declare function viewExample(value: string): string;
|
|
2
2
|
|
|
3
|
-
declare function formatMoney(value: number | null, currency?: string, options?: {
|
|
4
|
-
locale: string;
|
|
5
|
-
minimumFractionDigits: number;
|
|
6
|
-
maximumFractionDigits: number;
|
|
3
|
+
declare function formatMoney(value: number | null, currency?: string, options?: {
|
|
4
|
+
locale: string;
|
|
5
|
+
minimumFractionDigits: number;
|
|
6
|
+
maximumFractionDigits: number;
|
|
7
7
|
}): string;
|
|
8
8
|
|
|
9
9
|
declare function createClassName(className: string): (...classNames: string[]) => string;
|
|
10
10
|
|
|
11
11
|
declare function genRandomNumber(min: number, max: number): number;
|
|
12
12
|
|
|
13
|
-
interface Options {
|
|
14
|
-
hasOnlyLast4: boolean;
|
|
15
|
-
isHidden: boolean;
|
|
16
|
-
dot: string;
|
|
17
|
-
}
|
|
13
|
+
interface Options {
|
|
14
|
+
hasOnlyLast4: boolean;
|
|
15
|
+
isHidden: boolean;
|
|
16
|
+
dot: string;
|
|
17
|
+
}
|
|
18
18
|
declare function getCardNumber(number: string, options?: Partial<Options>): string;
|
|
19
19
|
|
|
20
20
|
declare function getCountryFromPhone(phone: string): string;
|
|
21
21
|
|
|
22
|
-
interface Dictionary {
|
|
23
|
-
[keys: string | number]: any;
|
|
22
|
+
interface Dictionary {
|
|
23
|
+
[keys: string | number]: any;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
declare function genLoadingTableRows(columns: Dictionary[], limit: number): {
|
|
27
|
-
id: number | undefined;
|
|
28
|
-
key?: undefined;
|
|
26
|
+
declare function genLoadingTableRows(columns: Dictionary[], limit: number): {
|
|
27
|
+
id: number | undefined;
|
|
28
|
+
key?: undefined;
|
|
29
29
|
}[];
|
|
30
30
|
|
|
31
31
|
declare function camelizeKeys(object: Dictionary): Dictionary;
|
|
32
32
|
|
|
33
33
|
declare function validateNumber(value: string | number, defaultValue: number): number;
|
|
34
34
|
|
|
35
|
-
/**
|
|
36
|
-
* Принимает на вход число в виде строки или числа,
|
|
37
|
-
* возвращает корректное значение типа Number (убирает лишние пробелы и запятые)
|
|
38
|
-
* @example
|
|
39
|
-
* // returns 1000
|
|
40
|
-
* unformatNumber('1 000');
|
|
41
|
-
* @example
|
|
42
|
-
* // returns 1000
|
|
43
|
-
* unformatNumber('1,000')
|
|
44
|
-
* @example
|
|
45
|
-
* // returns 1000.123
|
|
46
|
-
* unformatNummber('1 000,123')
|
|
47
|
-
* @example
|
|
48
|
-
* // returns 1000.123
|
|
49
|
-
* unformatNummber('1,000.123')
|
|
50
|
-
* @param value
|
|
51
|
-
* @return number
|
|
52
|
-
*/
|
|
35
|
+
/**
|
|
36
|
+
* Принимает на вход число в виде строки или числа,
|
|
37
|
+
* возвращает корректное значение типа Number (убирает лишние пробелы и запятые)
|
|
38
|
+
* @example
|
|
39
|
+
* // returns 1000
|
|
40
|
+
* unformatNumber('1 000');
|
|
41
|
+
* @example
|
|
42
|
+
* // returns 1000
|
|
43
|
+
* unformatNumber('1,000')
|
|
44
|
+
* @example
|
|
45
|
+
* // returns 1000.123
|
|
46
|
+
* unformatNummber('1 000,123')
|
|
47
|
+
* @example
|
|
48
|
+
* // returns 1000.123
|
|
49
|
+
* unformatNummber('1,000.123')
|
|
50
|
+
* @param value
|
|
51
|
+
* @return number
|
|
52
|
+
*/
|
|
53
53
|
declare function unformatNumber(value: string | number): string | number;
|
|
54
54
|
|
|
55
|
-
declare function getPaginationParams({ page, limit, }: {
|
|
56
|
-
page: string | number;
|
|
57
|
-
limit: string | number;
|
|
58
|
-
}): {
|
|
59
|
-
limit: number;
|
|
60
|
-
offset: number;
|
|
61
|
-
};
|
|
62
|
-
declare function getPaginationLimit({ limit, }: {
|
|
63
|
-
limit: string | number;
|
|
64
|
-
}): number;
|
|
65
|
-
declare function getPaginationOffset({ page, limit, }: {
|
|
66
|
-
page: string | number;
|
|
67
|
-
limit: string | number;
|
|
68
|
-
}): number;
|
|
69
|
-
declare function getPaginationPages({ count, limit, }: {
|
|
70
|
-
count: number;
|
|
71
|
-
limit: string | number;
|
|
55
|
+
declare function getPaginationParams({ page, limit, }: {
|
|
56
|
+
page: string | number;
|
|
57
|
+
limit: string | number;
|
|
58
|
+
}): {
|
|
59
|
+
limit: number;
|
|
60
|
+
offset: number;
|
|
61
|
+
};
|
|
62
|
+
declare function getPaginationLimit({ limit, }: {
|
|
63
|
+
limit: string | number;
|
|
64
|
+
}): number;
|
|
65
|
+
declare function getPaginationOffset({ page, limit, }: {
|
|
66
|
+
page: string | number;
|
|
67
|
+
limit: string | number;
|
|
68
|
+
}): number;
|
|
69
|
+
declare function getPaginationPages({ count, limit, }: {
|
|
70
|
+
count: number;
|
|
71
|
+
limit: string | number;
|
|
72
72
|
}): number;
|
|
73
73
|
|
|
74
74
|
declare function parsePhone(phone: string): string;
|
|
75
75
|
|
|
76
|
-
declare function isElementIgnored({ ignoredClasses, event, }?: {
|
|
77
|
-
ignoredClasses?: string[];
|
|
78
|
-
event?: Event;
|
|
76
|
+
declare function isElementIgnored({ ignoredClasses, event, }?: {
|
|
77
|
+
ignoredClasses?: string[];
|
|
78
|
+
event?: Event;
|
|
79
79
|
}): boolean;
|
|
80
80
|
|
|
81
81
|
declare function isEmptyObject(object: {}): boolean;
|
|
82
82
|
|
|
83
|
-
declare const useClassName: (block: string) => {
|
|
84
|
-
b: (blockSuffix?: string) => string;
|
|
85
|
-
e: (element?: string) => string;
|
|
86
|
-
m: (modifier?: string, condition?: boolean) => string;
|
|
87
|
-
em: (element?: string, modifier?: string, condition?: boolean) => string;
|
|
88
|
-
mv: (modifier: string, modifierValue: string, condition?: boolean) => string;
|
|
89
|
-
cssVar: (object: Record<string, string>) => Record<string, string>;
|
|
90
|
-
cssVarName: (name: string) => string;
|
|
83
|
+
declare const useClassName: (block: string) => {
|
|
84
|
+
b: (blockSuffix?: string) => string;
|
|
85
|
+
e: (element?: string) => string;
|
|
86
|
+
m: (modifier?: string, condition?: boolean) => string;
|
|
87
|
+
em: (element?: string, modifier?: string, condition?: boolean) => string;
|
|
88
|
+
mv: (modifier: string, modifierValue: string, condition?: boolean) => string;
|
|
89
|
+
cssVar: (object: Record<string, string>) => Record<string, string>;
|
|
90
|
+
cssVarName: (name: string) => string;
|
|
91
91
|
};
|
|
92
92
|
|
|
93
93
|
declare function validatePhone(rule: string, value: string): boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@karta.io/utils",
|
|
3
|
-
"version": "0.13.
|
|
3
|
+
"version": "0.13.2",
|
|
4
4
|
"description": "karta.io utils for admin and application",
|
|
5
5
|
"author": "Vitaly Blokhin <karambafe@gmail.com>",
|
|
6
6
|
"homepage": "",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"dist"
|
|
20
20
|
],
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@karta.io/common-data": "^0.13.
|
|
22
|
+
"@karta.io/common-data": "^0.13.2",
|
|
23
23
|
"libphonenumber-js": "1.9.44",
|
|
24
24
|
"lodash-es": "4.17.21"
|
|
25
25
|
},
|
|
@@ -43,6 +43,5 @@
|
|
|
43
43
|
"prettier:fix": "prettier --write --ignore-unknown \"**/*\"",
|
|
44
44
|
"prepush": "pnpm run prettier && pnpm run lint",
|
|
45
45
|
"pub": "pnpm build && pnpm publish --no-git-checks"
|
|
46
|
-
}
|
|
47
|
-
"readme": "# @karta.io/utils\n\nБиблиотека с общими хелперами, мапперами и плагинами\n\n## Хелперы:\n\n- formatMoney\n- createClassName\n- camelizeKeys\n- genLoadingTableRows\n- genRandomNumber\n- getCardNumber\n- getCountryFromPhone\n- getPaginationParams\n- isElementIgnored\n- isEmptyObject\n- pagination\n- parsePhone\n- unformatNumber\n- validateNumber\n\n## Хуки:\n\n- useClassName\n\n## Кастомные правила для валидатора\n\n- validatePhone\n"
|
|
46
|
+
}
|
|
48
47
|
}
|