@karta.io/utils 1.0.0-beta.10 → 1.0.0-beta.12

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 CHANGED
@@ -48,8 +48,9 @@ function AppComponentsResolver(options = {}) {
48
48
  }
49
49
 
50
50
  function camelizeKeys(object) {
51
- if (Array.isArray(object))
51
+ if (Array.isArray(object)) {
52
52
  return object.map((v) => camelizeKeys(v));
53
+ }
53
54
  if (object !== null && object.constructor === Object) {
54
55
  return Object.keys(object).reduce(
55
56
  (result, key) => ({
@@ -232,8 +233,9 @@ function parsePhone(phone) {
232
233
  }
233
234
 
234
235
  function snakelizeKeys(prop) {
235
- if (Array.isArray(prop))
236
+ if (Array.isArray(prop)) {
236
237
  return prop.map((item) => snakelizeKeys(item));
238
+ }
237
239
  if (prop !== null && prop !== void 0 && prop.constructor === Object) {
238
240
  return Object.keys(prop).reduce(
239
241
  (accum, current) => ({
package/dist/index.d.cts CHANGED
@@ -23,7 +23,7 @@ interface ResponseError {
23
23
  data: Record<string, string | string[]> | null;
24
24
  }
25
25
 
26
- declare function camelizeKeys(object: Dictionary): Dictionary;
26
+ declare function camelizeKeys<T extends Record<string, any> = Dictionary>(object: Dictionary): T;
27
27
 
28
28
  interface Options$3 {
29
29
  labelType: 'key' | 'value';
@@ -93,7 +93,7 @@ declare function getPaginationPages({ count, limit, }: {
93
93
  declare function parsePhone(phone: string | null | undefined): string;
94
94
 
95
95
  type SnakelizeKeysProp = Record<string | number, any>;
96
- declare function snakelizeKeys(prop: SnakelizeKeysProp): SnakelizeKeysProp;
96
+ declare function snakelizeKeys<T extends Record<string, any> = SnakelizeKeysProp>(prop: SnakelizeKeysProp): T;
97
97
 
98
98
  /**
99
99
  * Принимает на вход число в виде строки или числа,
package/dist/index.d.mts CHANGED
@@ -23,7 +23,7 @@ interface ResponseError {
23
23
  data: Record<string, string | string[]> | null;
24
24
  }
25
25
 
26
- declare function camelizeKeys(object: Dictionary): Dictionary;
26
+ declare function camelizeKeys<T extends Record<string, any> = Dictionary>(object: Dictionary): T;
27
27
 
28
28
  interface Options$3 {
29
29
  labelType: 'key' | 'value';
@@ -93,7 +93,7 @@ declare function getPaginationPages({ count, limit, }: {
93
93
  declare function parsePhone(phone: string | null | undefined): string;
94
94
 
95
95
  type SnakelizeKeysProp = Record<string | number, any>;
96
- declare function snakelizeKeys(prop: SnakelizeKeysProp): SnakelizeKeysProp;
96
+ declare function snakelizeKeys<T extends Record<string, any> = SnakelizeKeysProp>(prop: SnakelizeKeysProp): T;
97
97
 
98
98
  /**
99
99
  * Принимает на вход число в виде строки или числа,
package/dist/index.d.ts CHANGED
@@ -23,7 +23,7 @@ interface ResponseError {
23
23
  data: Record<string, string | string[]> | null;
24
24
  }
25
25
 
26
- declare function camelizeKeys(object: Dictionary): Dictionary;
26
+ declare function camelizeKeys<T extends Record<string, any> = Dictionary>(object: Dictionary): T;
27
27
 
28
28
  interface Options$3 {
29
29
  labelType: 'key' | 'value';
@@ -93,7 +93,7 @@ declare function getPaginationPages({ count, limit, }: {
93
93
  declare function parsePhone(phone: string | null | undefined): string;
94
94
 
95
95
  type SnakelizeKeysProp = Record<string | number, any>;
96
- declare function snakelizeKeys(prop: SnakelizeKeysProp): SnakelizeKeysProp;
96
+ declare function snakelizeKeys<T extends Record<string, any> = SnakelizeKeysProp>(prop: SnakelizeKeysProp): T;
97
97
 
98
98
  /**
99
99
  * Принимает на вход число в виде строки или числа,
package/dist/index.mjs CHANGED
@@ -30,8 +30,9 @@ function AppComponentsResolver(options = {}) {
30
30
  }
31
31
 
32
32
  function camelizeKeys(object) {
33
- if (Array.isArray(object))
33
+ if (Array.isArray(object)) {
34
34
  return object.map((v) => camelizeKeys(v));
35
+ }
35
36
  if (object !== null && object.constructor === Object) {
36
37
  return Object.keys(object).reduce(
37
38
  (result, key) => ({
@@ -214,8 +215,9 @@ function parsePhone(phone) {
214
215
  }
215
216
 
216
217
  function snakelizeKeys(prop) {
217
- if (Array.isArray(prop))
218
+ if (Array.isArray(prop)) {
218
219
  return prop.map((item) => snakelizeKeys(item));
220
+ }
219
221
  if (prop !== null && prop !== void 0 && prop.constructor === Object) {
220
222
  return Object.keys(prop).reduce(
221
223
  (accum, current) => ({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@karta.io/utils",
3
- "version": "1.0.0-beta.10",
3
+ "version": "1.0.0-beta.12",
4
4
  "description": "karta.io utils for admin and application",
5
5
  "author": "Vitaly Blokhin <karambafe@gmail.com>",
6
6
  "homepage": "",
@@ -25,7 +25,7 @@
25
25
  "vue": "3.x"
26
26
  },
27
27
  "dependencies": {
28
- "@karta.io/common-data": "^1.0.0-beta.10",
28
+ "@karta.io/common-data": "^1.0.0-beta.12",
29
29
  "@tanstack/vue-query": "5.x",
30
30
  "@vueuse/core": "10.7.2",
31
31
  "async-validator": "4.2.5",