@krainovsd/js-helpers 0.2.2 → 0.3.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/lib/cjs/{index.cjs → index.js} +58 -98
- package/lib/cjs/index.js.map +1 -0
- package/lib/esm/index.js +1 -96
- package/lib/esm/index.js.map +1 -1
- package/package.json +17 -19
- package/tmp/index.d.ts +2 -3
- package/tmp/lib/api/index.d.ts +1 -1
- package/tmp/lib/index.d.ts +6 -5
- package/lib/cjs/index.cjs.map +0 -1
package/lib/esm/index.js
CHANGED
|
@@ -45,20 +45,6 @@ const FIELD_TYPES = {
|
|
|
45
45
|
Array: "array",
|
|
46
46
|
};
|
|
47
47
|
|
|
48
|
-
const index$6 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
|
|
49
|
-
__proto__: null,
|
|
50
|
-
API_MIDDLEWARES,
|
|
51
|
-
COLOR_FORMATS,
|
|
52
|
-
DATE_TYPES,
|
|
53
|
-
FIELD_TYPES,
|
|
54
|
-
IS_BROWSER,
|
|
55
|
-
IS_BUN,
|
|
56
|
-
IS_DENO,
|
|
57
|
-
IS_JEST,
|
|
58
|
-
IS_NODE,
|
|
59
|
-
IS_WEB_WORKER
|
|
60
|
-
}, Symbol.toStringTag, { value: 'Module' }));
|
|
61
|
-
|
|
62
48
|
const waitUntil = (condition, checkInterval = 100) => {
|
|
63
49
|
return new Promise((resolve) => {
|
|
64
50
|
const interval = setInterval(() => {
|
|
@@ -1854,21 +1840,6 @@ function isDate(value) {
|
|
|
1854
1840
|
return false;
|
|
1855
1841
|
}
|
|
1856
1842
|
|
|
1857
|
-
const index$5 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
|
|
1858
|
-
__proto__: null,
|
|
1859
|
-
checkType,
|
|
1860
|
-
isArray,
|
|
1861
|
-
isBoolean,
|
|
1862
|
-
isDate,
|
|
1863
|
-
isId,
|
|
1864
|
-
isNull,
|
|
1865
|
-
isNullable,
|
|
1866
|
-
isNumber,
|
|
1867
|
-
isObject,
|
|
1868
|
-
isString,
|
|
1869
|
-
isUndefined
|
|
1870
|
-
}, Symbol.toStringTag, { value: 'Module' }));
|
|
1871
|
-
|
|
1872
1843
|
function getByPath(data, path, defaultValue = undefined) {
|
|
1873
1844
|
if ((!isObject(data) && !isArray(data)) || !isString(path))
|
|
1874
1845
|
return defaultValue;
|
|
@@ -2050,19 +2021,6 @@ function dateFormat(date, format) {
|
|
|
2050
2021
|
return dayjs(correctDate).format(format);
|
|
2051
2022
|
}
|
|
2052
2023
|
|
|
2053
|
-
const index$4 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
|
|
2054
|
-
__proto__: null,
|
|
2055
|
-
dateDifference,
|
|
2056
|
-
dateFormat,
|
|
2057
|
-
getDateByRules,
|
|
2058
|
-
getToday,
|
|
2059
|
-
getTomorrow,
|
|
2060
|
-
getYesterday,
|
|
2061
|
-
isToday,
|
|
2062
|
-
isTomorrow,
|
|
2063
|
-
isYesterday
|
|
2064
|
-
}, Symbol.toStringTag, { value: 'Module' }));
|
|
2065
|
-
|
|
2066
2024
|
function transformToNumber(value) {
|
|
2067
2025
|
let result;
|
|
2068
2026
|
if (isString(value))
|
|
@@ -2499,26 +2457,6 @@ function limitStreamOfRequests({ countRequests, maxCountInParallel, promiseGette
|
|
|
2499
2457
|
};
|
|
2500
2458
|
}
|
|
2501
2459
|
|
|
2502
|
-
const index$3 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
|
|
2503
|
-
__proto__: null,
|
|
2504
|
-
arrayToMapByKey,
|
|
2505
|
-
buildQueryString,
|
|
2506
|
-
createURLWithParams,
|
|
2507
|
-
fieldViewFormat,
|
|
2508
|
-
getByPath,
|
|
2509
|
-
getFileNameFromHeader,
|
|
2510
|
-
jsonParse,
|
|
2511
|
-
limitStreamOfRequests,
|
|
2512
|
-
randomNumber,
|
|
2513
|
-
randomString,
|
|
2514
|
-
setByPath,
|
|
2515
|
-
syncObjectValues,
|
|
2516
|
-
transformToNumber,
|
|
2517
|
-
trimUrl,
|
|
2518
|
-
wait,
|
|
2519
|
-
waitUntil
|
|
2520
|
-
}, Symbol.toStringTag, { value: 'Module' }));
|
|
2521
|
-
|
|
2522
2460
|
function downloadFile({ data, fileName, mimeType }) {
|
|
2523
2461
|
if (!IS_BROWSER && !IS_JEST)
|
|
2524
2462
|
return null;
|
|
@@ -2572,13 +2510,6 @@ function readFile(file) {
|
|
|
2572
2510
|
});
|
|
2573
2511
|
}
|
|
2574
2512
|
|
|
2575
|
-
const index$2 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
|
|
2576
|
-
__proto__: null,
|
|
2577
|
-
downloadFile,
|
|
2578
|
-
downloadJson,
|
|
2579
|
-
readFile
|
|
2580
|
-
}, Symbol.toStringTag, { value: 'Module' }));
|
|
2581
|
-
|
|
2582
2513
|
const tokenRequest = async (options) => {
|
|
2583
2514
|
try {
|
|
2584
2515
|
const response = await fetch(options.authTokenUrl, {
|
|
@@ -2802,12 +2733,6 @@ function generateRequestsInstance(activeMiddlewares, middlewareOptions) {
|
|
|
2802
2733
|
};
|
|
2803
2734
|
}
|
|
2804
2735
|
|
|
2805
|
-
const index$1 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
|
|
2806
|
-
__proto__: null,
|
|
2807
|
-
ResponseError,
|
|
2808
|
-
generateRequestsInstance
|
|
2809
|
-
}, Symbol.toStringTag, { value: 'Module' }));
|
|
2810
|
-
|
|
2811
2736
|
function getColorFormat(color) {
|
|
2812
2737
|
if (color.startsWith("#")) {
|
|
2813
2738
|
return COLOR_FORMATS.Hex;
|
|
@@ -2885,25 +2810,5 @@ function transformToColor(currentColor, defaultColor = "black", defaultFormat =
|
|
|
2885
2810
|
return correctColor;
|
|
2886
2811
|
}
|
|
2887
2812
|
|
|
2888
|
-
|
|
2889
|
-
__proto__: null,
|
|
2890
|
-
getColorFormat,
|
|
2891
|
-
takeOpacityColors,
|
|
2892
|
-
transformHEXtoRGB,
|
|
2893
|
-
transformRGBAtoRGB,
|
|
2894
|
-
transformRGBtoRGBA,
|
|
2895
|
-
transformToColor
|
|
2896
|
-
}, Symbol.toStringTag, { value: 'Module' }));
|
|
2897
|
-
|
|
2898
|
-
const libs = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
|
|
2899
|
-
__proto__: null,
|
|
2900
|
-
api: index$1,
|
|
2901
|
-
browser: index$2,
|
|
2902
|
-
colors: index,
|
|
2903
|
-
constants: index$6,
|
|
2904
|
-
date: index$4,
|
|
2905
|
-
utils: index$3
|
|
2906
|
-
}, Symbol.toStringTag, { value: 'Module' }));
|
|
2907
|
-
|
|
2908
|
-
export { libs as helpers, index$5 as typings };
|
|
2813
|
+
export { API_MIDDLEWARES, COLOR_FORMATS, DATE_TYPES, FIELD_TYPES, IS_BROWSER, IS_BUN, IS_DENO, IS_JEST, IS_NODE, IS_WEB_WORKER, ResponseError, arrayToMapByKey, buildQueryString, checkType, createURLWithParams, dateDifference, dateFormat, downloadFile, downloadJson, fieldViewFormat, generateRequestsInstance, getByPath, getColorFormat, getDateByRules, getFileNameFromHeader, getToday, getTomorrow, getYesterday, isArray, isBoolean, isDate, isId, isNull, isNullable, isNumber, isObject, isString, isToday, isTomorrow, isUndefined, isYesterday, jsonParse, limitStreamOfRequests, randomNumber, randomString, readFile, setByPath, syncObjectValues, takeOpacityColors, transformHEXtoRGB, transformRGBAtoRGB, transformRGBtoRGBA, transformToColor, transformToNumber, trimUrl, wait, waitUntil };
|
|
2909
2814
|
//# sourceMappingURL=index.js.map
|