@dxtmisha/functional-basic 1.7.1 → 1.8.1

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,5 +1,5 @@
1
1
  import { ErrorCenterInstance } from './ErrorCenterInstance';
2
- import { ErrorCenterCauseItem, ErrorCenterCauseList, ErrorCenterGroup, ErrorCenterHandlerCallback, ErrorCenterHandlerList } from '../types/errorCenter';
2
+ import { ErrorCenterCauseItem, ErrorCenterCauseList, ErrorCenterGroup, ErrorCenterHandlerCallback, ErrorCenterHandlerIsConsole, ErrorCenterHandlerList } from '../types/errorCenterTypes';
3
3
  /**
4
4
  * Class for managing error storage and handling.
5
5
  *
@@ -69,6 +69,13 @@ export declare class ErrorCenter {
69
69
  * @param callback callback function / функция обратного вызова
70
70
  */
71
71
  static addCallback(callback: ErrorCenterHandlerCallback): void;
72
+ /**
73
+ * Sets console output flag or filter function.
74
+ *
75
+ * Устанавливает флаг или функцию фильтрации вывода в консоль.
76
+ * @param isConsole console output flag or filter function / флаг или функция вывода в консоль
77
+ */
78
+ static setIsConsole(isConsole: ErrorCenterHandlerIsConsole): void;
72
79
  /**
73
80
  * Triggers error handling for a group.
74
81
  *
@@ -1,4 +1,4 @@
1
- import { ErrorCenterCauseItem, ErrorCenterGroup, ErrorCenterHandlerCallback, ErrorCenterHandlerItem, ErrorCenterHandlerList } from '../types/errorCenter';
1
+ import { ErrorCenterCauseItem, ErrorCenterGroup, ErrorCenterHandlerCallback, ErrorCenterHandlerIsConsole, ErrorCenterHandlerItem, ErrorCenterHandlerList } from '../types/errorCenterTypes';
2
2
  /**
3
3
  * Class for managing and triggering error handlers.
4
4
  *
@@ -9,11 +9,14 @@ export declare class ErrorCenterHandler {
9
9
  protected handlers: ErrorCenterHandlerList;
10
10
  /** Callbacks executed on every error / Обратные вызовы, выполняемые при каждой ошибке */
11
11
  protected callbacks: ErrorCenterHandlerCallback[];
12
+ /** Console output flag or filter function / Флаг или функция фильтрации вывода в консоль */
13
+ protected isConsole: ErrorCenterHandlerIsConsole;
12
14
  /**
13
15
  * Constructor
14
16
  * @param handlers initial handlers list / начальный список обработчиков
17
+ * @param isConsole console output flag or filter function / флаг или функция вывода в консоль
15
18
  */
16
- constructor(handlers?: ErrorCenterHandlerList);
19
+ constructor(handlers?: ErrorCenterHandlerList, isConsole?: ErrorCenterHandlerIsConsole);
17
20
  /**
18
21
  * Checks if handlers exist for a group.
19
22
  *
@@ -55,6 +58,14 @@ export declare class ErrorCenterHandler {
55
58
  * @returns this instance / текущий экземпляр
56
59
  */
57
60
  addCallback(callback: ErrorCenterHandlerCallback): this;
61
+ /**
62
+ * Sets console output flag or filter function.
63
+ *
64
+ * Устанавливает флаг или функцию фильтрации вывода в консоль.
65
+ * @param isConsole console output flag or filter function / флаг или функция вывода в консоль
66
+ * @returns this instance / текущий экземпляр
67
+ */
68
+ setIsConsole(isConsole: ErrorCenterHandlerIsConsole): this;
58
69
  /**
59
70
  * Triggers handlers for a group and logs to console.
60
71
  *
@@ -1,5 +1,5 @@
1
1
  import { ErrorCenterHandler } from './ErrorCenterHandler';
2
- import { ErrorCenterCauseItem, ErrorCenterCauseList, ErrorCenterGroup, ErrorCenterHandlerCallback, ErrorCenterHandlerList } from '../types/errorCenter';
2
+ import { ErrorCenterCauseItem, ErrorCenterCauseList, ErrorCenterGroup, ErrorCenterHandlerCallback, ErrorCenterHandlerIsConsole, ErrorCenterHandlerList } from '../types/errorCenterTypes';
3
3
  /**
4
4
  * Class for managing error storage and handling within an instance.
5
5
  *
@@ -74,6 +74,14 @@ export declare class ErrorCenterInstance {
74
74
  * @returns this instance / текущий экземпляр
75
75
  */
76
76
  addCallback(callback: ErrorCenterHandlerCallback): this;
77
+ /**
78
+ * Sets console output flag or filter function for the handler.
79
+ *
80
+ * Устанавливает флаг или функцию фильтрации вывода в консоль для обработчика.
81
+ * @param isConsole console output flag or filter function / флаг или функция вывода в консоль
82
+ * @returns this instance / текущий экземпляр
83
+ */
84
+ setIsConsole(isConsole: ErrorCenterHandlerIsConsole): this;
77
85
  /**
78
86
  * Triggers error handling for a group.
79
87
  *
@@ -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,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';
@@ -109,6 +110,7 @@ export * from './functions/getObjectByKeys';
109
110
  export * from './functions/getObjectNoUndefined';
110
111
  export * from './functions/getObjectOrNone';
111
112
  export * from './functions/getOnlyText';
113
+ export * from './functions/getRandomItem';
112
114
  export * from './functions/getRandomText';
113
115
  export * from './functions/getRequestString';
114
116
  export * from './functions/getSearchExp';
@@ -157,6 +159,7 @@ export * from './functions/secondToTime';
157
159
  export * from './functions/setElementItem';
158
160
  export * from './functions/setValues';
159
161
  export * from './functions/sleep';
162
+ export * from './functions/sortList';
160
163
  export * from './functions/splice';
161
164
  export * from './functions/strFill';
162
165
  export * from './functions/strSplit';
@@ -167,6 +170,7 @@ export * from './functions/toDate';
167
170
  export * from './functions/toKebabCase';
168
171
  export * from './functions/toNumber';
169
172
  export * from './functions/toNumberByMax';
173
+ export * from './functions/toNumberPositive';
170
174
  export * from './functions/toPercent';
171
175
  export * from './functions/toPercentBy100';
172
176
  export * from './functions/toString';
@@ -176,9 +180,10 @@ export * from './functions/uniqueArray';
176
180
  export * from './functions/writeClipboardData';
177
181
  export * from './types/apiTypes';
178
182
  export * from './types/basicTypes';
179
- export * from './types/errorCenter';
183
+ export * from './types/errorCenterTypes';
180
184
  export * from './types/formattersTypes';
181
185
  export * from './types/geoTypes';
182
186
  export * from './types/metaTypes';
183
187
  export * from './types/searchTypes';
188
+ export * from './types/sortTypes';
184
189
  export * from './types/translateTypes';