@dxtmisha/functional-basic 1.6.4 → 1.8.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.
@@ -1,3 +1,4 @@
1
+ import { GeoInstance } from './GeoInstance';
1
2
  import { LoadingInstance } from './LoadingInstance';
2
3
  import { ErrorCenterInstance } from './ErrorCenterInstance';
3
4
  import { ApiDefault } from './ApiDefault';
@@ -36,6 +37,8 @@ export type ApiInstanceOptions = {
36
37
  */
37
38
  export declare class ApiInstance {
38
39
  protected url: string;
40
+ /** Geo class instance / Экземпляр класса Geo */
41
+ protected geo: GeoInstance;
39
42
  /** Headers / Заголовки */
40
43
  protected headers: ApiHeaders;
41
44
  /** Default request parameters / Параметры запроса по умолчанию */
@@ -54,9 +54,10 @@ export declare class ServerStorage {
54
54
  * @param key unique storage key / уникальный ключ хранилища
55
55
  * @param value function that returns the value to save / функция, возвращающая значение для сохранения
56
56
  * @param hydration whether the value should be included in hydration / должно ли значение быть включено в гидратацию
57
+ * @param storageList optional storage list / необязательный список хранилища
57
58
  * @returns saved value / сохраненное значение
58
59
  */
59
- static set<T = any>(key: string, value: () => T, hydration?: boolean): T;
60
+ static set<T = any>(key: string, value: () => T, hydration?: boolean, storageList?: ServerStorageList): T;
60
61
  /**
61
62
  * Sets the visibility of error messages.
62
63
  *
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Executes a callback function when the DOMContentLoaded event is fired.
3
+ * If the DOM is already loaded (readyState is 'interactive' or 'complete') or if executing in a non-DOM environment,
4
+ * the callback is executed immediately.
5
+ *
6
+ * Выполняет функцию обратного вызова при наступлении события DOMContentLoaded.
7
+ * Если DOM уже загружен (readyState равен 'interactive' или 'complete') или код выполняется вне браузера,
8
+ * функция обратного вызова выполняется немедленно.
9
+ *
10
+ * @param callback function to execute when DOM is loaded / функция для выполнения при загрузке DOM
11
+ * @returns promise resolving to the callback result / промис, разрешающийся результатом выполнения функции
12
+ */
13
+ export declare function domContentLoaded<T = void>(callback: () => T | Promise<T>): Promise<T>;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Returns the last element of an array or object.
3
+ *
4
+ * Возвращает последний элемент массива или объекта.
5
+ * @param value input value / входное значение
6
+ * @returns last element of the array or object / последний элемент массива или объекта
7
+ */
8
+ export declare function getLast<T>(value: T | T[] | Record<string, T>): T | undefined;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Returns a random element from an array, object, or value.
3
+ * If the input is empty or invalid, returns undefined.
4
+ *
5
+ * Возвращает случайный элемент из массива, объекта или значения.
6
+ * Если массив/объект пуст или значение отсутствует, возвращает undefined.
7
+ * @param value input array, object, or value / входной массив, объект или значение
8
+ * @returns random element or undefined if empty / случайный элемент или undefined, если пусто
9
+ */
10
+ export declare function getRandomItem<T>(value?: T | T[] | Record<string, T>): T | undefined;
@@ -0,0 +1,11 @@
1
+ import { SortColumnItem, SortFunction } from '../types/sortTypes';
2
+ /**
3
+ * Sorts an array of items by one or more column paths, directions, or a custom comparison function.
4
+ *
5
+ * Сортирует массив элементов по одному или нескольким путям колонок, направлениям или пользовательской функции сравнения.
6
+ * @param list input list array of items / входной список элементов
7
+ * @param sortColumns list of column sorting specifications / список спецификаций сортировки колонок
8
+ * @param customSort optional custom comparison function / необязательная пользовательская функция сравнения
9
+ * @returns new sorted array of items / новый отсортированный массив элементов
10
+ */
11
+ export declare function sortList<T = any>(list: T[], sortColumns: SortColumnItem[], customSort?: SortFunction<T>): T[];
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Converts a value to a positive finite number (> 0), or returns default value (0) if invalid.
3
+ *
4
+ * Преобразует значение в конечное положительное число (> 0) или возвращает значение по умолчанию (0), если невалидно.
5
+ * @param value input value / входное значение
6
+ * @param defaultValue default fallback value if invalid / значение по умолчанию, если невалидно
7
+ * @returns parsed positive number or defaultValue / распарсенное положительное число или defaultValue
8
+ */
9
+ export declare function toNumberPositive(value?: number | string | null, defaultValue?: number): number;
package/dist/library.d.ts CHANGED
@@ -68,6 +68,7 @@ export * from './functions/capitalize';
68
68
  export * from './functions/copyObject';
69
69
  export * from './functions/copyObjectLite';
70
70
  export * from './functions/createElement';
71
+ export * from './functions/domContentLoaded';
71
72
  export * from './functions/domQuerySelector';
72
73
  export * from './functions/domQuerySelectorAll';
73
74
  export * from './functions/encodeAttribute';
@@ -97,6 +98,7 @@ export * from './functions/getFirst';
97
98
  export * from './functions/getHydrationData';
98
99
  export * from './functions/getItemByPath';
99
100
  export * from './functions/getKey';
101
+ export * from './functions/getLast';
100
102
  export * from './functions/getLength';
101
103
  export * from './functions/getLengthOfAllArray';
102
104
  export * from './functions/getMaxLengthAllArray';
@@ -108,6 +110,7 @@ export * from './functions/getObjectByKeys';
108
110
  export * from './functions/getObjectNoUndefined';
109
111
  export * from './functions/getObjectOrNone';
110
112
  export * from './functions/getOnlyText';
113
+ export * from './functions/getRandomItem';
111
114
  export * from './functions/getRandomText';
112
115
  export * from './functions/getRequestString';
113
116
  export * from './functions/getSearchExp';
@@ -156,6 +159,7 @@ export * from './functions/secondToTime';
156
159
  export * from './functions/setElementItem';
157
160
  export * from './functions/setValues';
158
161
  export * from './functions/sleep';
162
+ export * from './functions/sortList';
159
163
  export * from './functions/splice';
160
164
  export * from './functions/strFill';
161
165
  export * from './functions/strSplit';
@@ -166,6 +170,7 @@ export * from './functions/toDate';
166
170
  export * from './functions/toKebabCase';
167
171
  export * from './functions/toNumber';
168
172
  export * from './functions/toNumberByMax';
173
+ export * from './functions/toNumberPositive';
169
174
  export * from './functions/toPercent';
170
175
  export * from './functions/toPercentBy100';
171
176
  export * from './functions/toString';
@@ -180,4 +185,5 @@ export * from './types/formattersTypes';
180
185
  export * from './types/geoTypes';
181
186
  export * from './types/metaTypes';
182
187
  export * from './types/searchTypes';
188
+ export * from './types/sortTypes';
183
189
  export * from './types/translateTypes';