denwa-web-shared 1.0.15 → 1.0.17

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.
@@ -77,8 +77,9 @@ const updateTextByTemplate = ({
77
77
  SUBDOMAIN_NAME,
78
78
  SUBDOMAIN_MASK
79
79
  }) => {
80
+ const key = SUBDOMAIN_NAME[subdomain];
81
+ if (!subdomain || !key) return text;
80
82
  const subdomainData = getByKey(SUBDOMAIN_NAME, subdomain);
81
- if (!subdomain) return text;
82
83
  let result = text;
83
84
  const { name, declination, region, regionDeclination } = subdomainData;
84
85
  const cityReg = new RegExp(SUBDOMAIN_MASK.CITY, "g");
@@ -254,6 +255,15 @@ const generatePaginationArray = (pagination, baseUrl, initialParams) => {
254
255
  lastPage
255
256
  };
256
257
  };
258
+ const arrayToKeyValueObject = (arr) => {
259
+ return arr.reduce(
260
+ (acc, item) => {
261
+ acc[item] = item;
262
+ return acc;
263
+ },
264
+ {}
265
+ );
266
+ };
257
267
  function r(e) {
258
268
  var t, f, n = "";
259
269
  if ("string" == typeof e || "number" == typeof e) n += e;
@@ -6686,6 +6696,7 @@ const BasePicture = ({
6686
6696
  exports.BasePicture = BasePicture;
6687
6697
  exports.THEME = THEME;
6688
6698
  exports.TIME = TIME;
6699
+ exports.arrayToKeyValueObject = arrayToKeyValueObject;
6689
6700
  exports.checkCorrectImageObject = checkCorrectImageObject;
6690
6701
  exports.cn = cn;
6691
6702
  exports.convertPhoneMask = convertPhoneMask;
@@ -75,8 +75,9 @@ const updateTextByTemplate = ({
75
75
  SUBDOMAIN_NAME,
76
76
  SUBDOMAIN_MASK
77
77
  }) => {
78
+ const key = SUBDOMAIN_NAME[subdomain];
79
+ if (!subdomain || !key) return text;
78
80
  const subdomainData = getByKey(SUBDOMAIN_NAME, subdomain);
79
- if (!subdomain) return text;
80
81
  let result = text;
81
82
  const { name, declination, region, regionDeclination } = subdomainData;
82
83
  const cityReg = new RegExp(SUBDOMAIN_MASK.CITY, "g");
@@ -252,6 +253,15 @@ const generatePaginationArray = (pagination, baseUrl, initialParams) => {
252
253
  lastPage
253
254
  };
254
255
  };
256
+ const arrayToKeyValueObject = (arr) => {
257
+ return arr.reduce(
258
+ (acc, item) => {
259
+ acc[item] = item;
260
+ return acc;
261
+ },
262
+ {}
263
+ );
264
+ };
255
265
  function r(e) {
256
266
  var t, f, n = "";
257
267
  if ("string" == typeof e || "number" == typeof e) n += e;
@@ -6685,6 +6695,7 @@ export {
6685
6695
  BasePicture,
6686
6696
  THEME,
6687
6697
  TIME,
6698
+ arrayToKeyValueObject,
6688
6699
  checkCorrectImageObject,
6689
6700
  cn,
6690
6701
  convertPhoneMask,
@@ -124,3 +124,8 @@ export declare const prepareColor: ({ color1, color2, notFoundText, COLORS_NAMES
124
124
  * @param initialParams - Параметры url
125
125
  */
126
126
  export declare const generatePaginationArray: (pagination: IPaginate | null, baseUrl: string, initialParams: Record<string, string>) => PaginationResult;
127
+ /**
128
+ * @description Превращение массива в объект ключ-значение
129
+ * @param arr - Массив
130
+ */
131
+ export declare const arrayToKeyValueObject: <T extends string>(arr: T[]) => Record<T, T>;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "denwa-web-shared",
3
3
  "private": false,
4
- "version": "1.0.15",
4
+ "version": "1.0.17",
5
5
  "type": "module",
6
6
  "author": "Denwa",
7
7
  "main": "dist/denwa-web-shared.cjs.js",