@karta.io/utils 0.15.3 → 0.16.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 (2) hide show
  1. package/dist/index.d.ts +60 -60
  2. package/package.json +7 -6
package/dist/index.d.ts CHANGED
@@ -1,31 +1,31 @@
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 genUUID(): string;
@@ -34,62 +34,62 @@ declare function camelizeKeys(object: Dictionary): Dictionary;
34
34
 
35
35
  declare function validateNumber(value: string | number, defaultValue: number): number;
36
36
 
37
- /**
38
- * Принимает на вход число в виде строки или числа,
39
- * возвращает корректное значение типа Number (убирает лишние пробелы и запятые)
40
- * @example
41
- * // returns 1000
42
- * unformatNumber('1 000');
43
- * @example
44
- * // returns 1000
45
- * unformatNumber('1,000')
46
- * @example
47
- * // returns 1000.123
48
- * unformatNummber('1 000,123')
49
- * @example
50
- * // returns 1000.123
51
- * unformatNummber('1,000.123')
52
- * @param value
53
- * @return number
54
- */
37
+ /**
38
+ * Принимает на вход число в виде строки или числа,
39
+ * возвращает корректное значение типа Number (убирает лишние пробелы и запятые)
40
+ * @example
41
+ * // returns 1000
42
+ * unformatNumber('1 000');
43
+ * @example
44
+ * // returns 1000
45
+ * unformatNumber('1,000')
46
+ * @example
47
+ * // returns 1000.123
48
+ * unformatNummber('1 000,123')
49
+ * @example
50
+ * // returns 1000.123
51
+ * unformatNummber('1,000.123')
52
+ * @param value
53
+ * @return number
54
+ */
55
55
  declare function unformatNumber(value: string | number): string | number;
56
56
 
57
- declare function getPaginationParams({ page, limit, }: {
58
- page: string | number;
59
- limit: string | number;
60
- }): {
61
- limit: number;
62
- offset: number;
63
- };
64
- declare function getPaginationLimit({ limit, }: {
65
- limit: string | number;
66
- }): number;
67
- declare function getPaginationOffset({ page, limit, }: {
68
- page: string | number;
69
- limit: string | number;
70
- }): number;
71
- declare function getPaginationPages({ count, limit, }: {
72
- count: number;
73
- limit: string | number;
57
+ declare function getPaginationParams({ page, limit, }: {
58
+ page: string | number;
59
+ limit: string | number;
60
+ }): {
61
+ limit: number;
62
+ offset: number;
63
+ };
64
+ declare function getPaginationLimit({ limit, }: {
65
+ limit: string | number;
66
+ }): number;
67
+ declare function getPaginationOffset({ page, limit, }: {
68
+ page: string | number;
69
+ limit: string | number;
70
+ }): number;
71
+ declare function getPaginationPages({ count, limit, }: {
72
+ count: number;
73
+ limit: string | number;
74
74
  }): number;
75
75
 
76
76
  declare function parsePhone(phone: string): string;
77
77
 
78
- declare function isElementIgnored({ ignoredClasses, event, }?: {
79
- ignoredClasses?: string[];
80
- event?: Event;
78
+ declare function isElementIgnored({ ignoredClasses, event, }?: {
79
+ ignoredClasses?: string[];
80
+ event?: Event;
81
81
  }): boolean;
82
82
 
83
83
  declare function isEmptyObject(object: {}): boolean;
84
84
 
85
- declare const useClassName: (block: string) => {
86
- b: (blockSuffix?: string) => string;
87
- e: (element?: string) => string;
88
- m: (modifier?: string, condition?: boolean) => string;
89
- em: (element?: string, modifier?: string, condition?: boolean) => string;
90
- mv: (modifier: string, modifierValue: string, condition?: boolean) => string;
91
- cssVar: (object: Record<string, string>) => Record<string, string>;
92
- cssVarName: (name: string) => string;
85
+ declare const useClassName: (block: string) => {
86
+ b: (blockSuffix?: string) => string;
87
+ e: (element?: string) => string;
88
+ m: (modifier?: string, condition?: boolean) => string;
89
+ em: (element?: string, modifier?: string, condition?: boolean) => string;
90
+ mv: (modifier: string, modifierValue: string, condition?: boolean) => string;
91
+ cssVar: (object: Record<string, string>) => Record<string, string>;
92
+ cssVarName: (name: string) => string;
93
93
  };
94
94
 
95
95
  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.15.3",
3
+ "version": "0.16.0",
4
4
  "description": "karta.io utils for admin and application",
5
5
  "author": "Vitaly Blokhin <karambafe@gmail.com>",
6
6
  "homepage": "",
@@ -20,18 +20,18 @@
20
20
  "dist"
21
21
  ],
22
22
  "dependencies": {
23
- "@karta.io/common-data": "^0.15.3",
23
+ "@karta.io/common-data": "^0.16.0",
24
24
  "libphonenumber-js": "1.9.44",
25
25
  "lodash-es": "4.17.21"
26
26
  },
27
27
  "devDependencies": {
28
28
  "@qvant/prettier-config": "0.1.0",
29
- "eslint": "8.11.0",
29
+ "eslint": "8.17.0",
30
30
  "eslint-config-airbnb-base": "15.0.0",
31
31
  "eslint-plugin-import": "2.25.4",
32
- "prettier": "2.6.1",
33
- "typescript": "4.6.2",
34
- "unbuild": "0.7.0",
32
+ "prettier": "2.7.1",
33
+ "typescript": "4.7.3",
34
+ "unbuild": "0.7.4",
35
35
  "vitest": "0.7.10"
36
36
  },
37
37
  "scripts": {
@@ -42,6 +42,7 @@
42
42
  "test": "pnpm lint && vitest run",
43
43
  "prettier": "prettier --check --ignore-unknown \"**/*\"",
44
44
  "prettier:fix": "prettier --write --ignore-unknown \"**/*\"",
45
+ "fix": "pnpm prettier:fix && pnpm lint:fix",
45
46
  "prepush": "pnpm run prettier && pnpm run lint",
46
47
  "pub": "pnpm build && pnpm publish --no-git-checks"
47
48
  }