@dxtmisha/functional-basic 1.7.1 → 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.
- package/CHANGELOG.md +10 -0
- package/README.md +2 -0
- package/ai-description.md +4 -16
- package/ai-doc.md +33 -112
- package/ai-types.md +660 -767
- package/dist/functions/domContentLoaded.d.ts +13 -0
- package/dist/functions/getRandomItem.d.ts +10 -0
- package/dist/functions/sortList.d.ts +11 -0
- package/dist/functions/toNumberPositive.d.ts +9 -0
- package/dist/library.d.ts +5 -0
- package/dist/library.js +584 -531
- package/dist/types/sortTypes.d.ts +20 -0
- package/package.json +17 -5
|
@@ -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';
|
|
@@ -181,4 +185,5 @@ 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';
|