@etsoo/shared 1.1.34 → 1.1.35

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.
@@ -52,10 +52,7 @@ var DataTypes;
52
52
  /**
53
53
  * Combined type enum
54
54
  */
55
- DataTypes.CombinedEnum = {
56
- ...SimpleEnum,
57
- ...ExtendedEnum
58
- };
55
+ DataTypes.CombinedEnum = Object.assign(Object.assign({}, SimpleEnum), ExtendedEnum);
59
56
  /**
60
57
  * Horizontal align enum
61
58
  */
@@ -47,19 +47,11 @@ var DateUtils;
47
47
  /**
48
48
  * Minute format, YYYY-MM-DD hh:mm
49
49
  */
50
- DateUtils.MinuteFormat = {
51
- ...DateUtils.DayFormat,
52
- hour: '2-digit',
53
- hourCycle: 'h23',
54
- minute: '2-digit'
55
- };
50
+ DateUtils.MinuteFormat = Object.assign(Object.assign({}, DateUtils.DayFormat), { hour: '2-digit', hourCycle: 'h23', minute: '2-digit' });
56
51
  /**
57
52
  * Second format, YYYY-MM-DD hh:mm:ss
58
53
  */
59
- DateUtils.SecondFormat = {
60
- ...DateUtils.MinuteFormat,
61
- second: '2-digit'
62
- };
54
+ DateUtils.SecondFormat = Object.assign(Object.assign({}, DateUtils.MinuteFormat), { second: '2-digit' });
63
55
  /**
64
56
  * Format
65
57
  * @param input Input date time
@@ -92,7 +84,7 @@ var DateUtils;
92
84
  opt = options;
93
85
  }
94
86
  // Clone as new options with time zone
95
- const newOpt = { ...opt, ...(timeZone != null && { timeZone }) };
87
+ const newOpt = Object.assign(Object.assign({}, opt), (timeZone != null && { timeZone }));
96
88
  // Return format result
97
89
  return new Intl.DateTimeFormat(locale, newOpt)
98
90
  .format(parsed)
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.DomUtils = void 0;
4
+ const tslib_1 = require("tslib");
4
5
  const DataTypes_1 = require("./DataTypes");
5
6
  if (typeof navigator === 'undefined') {
6
7
  // Test mock only
@@ -163,7 +164,7 @@ var DomUtils;
163
164
  country =
164
165
  (_b = (_a = new URL(location.href).searchParams.get(DomUtils.CountryField)) !== null && _a !== void 0 ? _a : sessionStorage.getItem(DomUtils.CountryField)) !== null && _b !== void 0 ? _b : localStorage.getItem(DomUtils.CountryField);
165
166
  }
166
- catch {
167
+ catch (_c) {
167
168
  country = null;
168
169
  }
169
170
  // Return
@@ -180,7 +181,7 @@ var DomUtils;
180
181
  culture =
181
182
  (_b = (_a = new URL(location.href).searchParams.get(DomUtils.CultureField)) !== null && _a !== void 0 ? _a : sessionStorage.getItem(DomUtils.CultureField)) !== null && _b !== void 0 ? _b : localStorage.getItem(DomUtils.CultureField);
182
183
  }
183
- catch {
184
+ catch (_c) {
184
185
  culture = null;
185
186
  }
186
187
  // Browser detected
@@ -218,19 +219,21 @@ var DomUtils;
218
219
  * @param file File
219
220
  * @returns Data URL
220
221
  */
221
- async function fileToDataURL(file) {
222
- return new Promise((resolve, reject) => {
223
- const reader = new FileReader();
224
- reader.onerror = reject;
225
- reader.onload = () => {
226
- const data = reader.result;
227
- if (data == null) {
228
- reject();
229
- return;
230
- }
231
- resolve(data);
232
- };
233
- reader.readAsDataURL(file);
222
+ function fileToDataURL(file) {
223
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
224
+ return new Promise((resolve, reject) => {
225
+ const reader = new FileReader();
226
+ reader.onerror = reject;
227
+ reader.onload = () => {
228
+ const data = reader.result;
229
+ if (data == null) {
230
+ reject();
231
+ return;
232
+ }
233
+ resolve(data);
234
+ };
235
+ reader.readAsDataURL(file);
236
+ });
234
237
  });
235
238
  }
236
239
  DomUtils.fileToDataURL = fileToDataURL;
package/lib/cjs/Utils.js CHANGED
@@ -356,7 +356,7 @@ var Utils;
356
356
  // Return
357
357
  return json;
358
358
  }
359
- catch {
359
+ catch (_a) {
360
360
  if (defaultValue == null)
361
361
  return input;
362
362
  return defaultValue;
package/lib/cjs/index.js CHANGED
@@ -1,32 +1,19 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
2
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./types/DelayedExecutorType"), exports);
18
- __exportStar(require("./types/EColor"), exports);
19
- __exportStar(require("./types/EHistory"), exports);
20
- __exportStar(require("./types/EventClass"), exports);
21
- __exportStar(require("./types/FormData"), exports);
22
- __exportStar(require("./storage/IStorage"), exports);
23
- __exportStar(require("./storage/WindowStorage"), exports);
24
- __exportStar(require("./DataTypes"), exports);
25
- __exportStar(require("./ColorUtils"), exports);
26
- __exportStar(require("./DateUtils"), exports);
27
- __exportStar(require("./DomUtils"), exports);
28
- __exportStar(require("./ExtendUtils"), exports);
29
- __exportStar(require("./Keyboard"), exports);
30
- __exportStar(require("./NumberUtils"), exports);
31
- __exportStar(require("./StorageUtils"), exports);
32
- __exportStar(require("./Utils"), exports);
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./types/DelayedExecutorType"), exports);
5
+ tslib_1.__exportStar(require("./types/EColor"), exports);
6
+ tslib_1.__exportStar(require("./types/EHistory"), exports);
7
+ tslib_1.__exportStar(require("./types/EventClass"), exports);
8
+ tslib_1.__exportStar(require("./types/FormData"), exports);
9
+ tslib_1.__exportStar(require("./storage/IStorage"), exports);
10
+ tslib_1.__exportStar(require("./storage/WindowStorage"), exports);
11
+ tslib_1.__exportStar(require("./DataTypes"), exports);
12
+ tslib_1.__exportStar(require("./ColorUtils"), exports);
13
+ tslib_1.__exportStar(require("./DateUtils"), exports);
14
+ tslib_1.__exportStar(require("./DomUtils"), exports);
15
+ tslib_1.__exportStar(require("./ExtendUtils"), exports);
16
+ tslib_1.__exportStar(require("./Keyboard"), exports);
17
+ tslib_1.__exportStar(require("./NumberUtils"), exports);
18
+ tslib_1.__exportStar(require("./StorageUtils"), exports);
19
+ tslib_1.__exportStar(require("./Utils"), exports);
@@ -49,10 +49,7 @@ export var DataTypes;
49
49
  /**
50
50
  * Combined type enum
51
51
  */
52
- DataTypes.CombinedEnum = {
53
- ...SimpleEnum,
54
- ...ExtendedEnum
55
- };
52
+ DataTypes.CombinedEnum = Object.assign(Object.assign({}, SimpleEnum), ExtendedEnum);
56
53
  /**
57
54
  * Horizontal align enum
58
55
  */
@@ -44,19 +44,11 @@ export var DateUtils;
44
44
  /**
45
45
  * Minute format, YYYY-MM-DD hh:mm
46
46
  */
47
- DateUtils.MinuteFormat = {
48
- ...DateUtils.DayFormat,
49
- hour: '2-digit',
50
- hourCycle: 'h23',
51
- minute: '2-digit'
52
- };
47
+ DateUtils.MinuteFormat = Object.assign(Object.assign({}, DateUtils.DayFormat), { hour: '2-digit', hourCycle: 'h23', minute: '2-digit' });
53
48
  /**
54
49
  * Second format, YYYY-MM-DD hh:mm:ss
55
50
  */
56
- DateUtils.SecondFormat = {
57
- ...DateUtils.MinuteFormat,
58
- second: '2-digit'
59
- };
51
+ DateUtils.SecondFormat = Object.assign(Object.assign({}, DateUtils.MinuteFormat), { second: '2-digit' });
60
52
  /**
61
53
  * Format
62
54
  * @param input Input date time
@@ -89,7 +81,7 @@ export var DateUtils;
89
81
  opt = options;
90
82
  }
91
83
  // Clone as new options with time zone
92
- const newOpt = { ...opt, ...(timeZone != null && { timeZone }) };
84
+ const newOpt = Object.assign(Object.assign({}, opt), (timeZone != null && { timeZone }));
93
85
  // Return format result
94
86
  return new Intl.DateTimeFormat(locale, newOpt)
95
87
  .format(parsed)
@@ -1,3 +1,4 @@
1
+ import { __awaiter } from "tslib";
1
2
  import { DataTypes } from './DataTypes';
2
3
  if (typeof navigator === 'undefined') {
3
4
  // Test mock only
@@ -160,7 +161,7 @@ export var DomUtils;
160
161
  country =
161
162
  (_b = (_a = new URL(location.href).searchParams.get(DomUtils.CountryField)) !== null && _a !== void 0 ? _a : sessionStorage.getItem(DomUtils.CountryField)) !== null && _b !== void 0 ? _b : localStorage.getItem(DomUtils.CountryField);
162
163
  }
163
- catch {
164
+ catch (_c) {
164
165
  country = null;
165
166
  }
166
167
  // Return
@@ -177,7 +178,7 @@ export var DomUtils;
177
178
  culture =
178
179
  (_b = (_a = new URL(location.href).searchParams.get(DomUtils.CultureField)) !== null && _a !== void 0 ? _a : sessionStorage.getItem(DomUtils.CultureField)) !== null && _b !== void 0 ? _b : localStorage.getItem(DomUtils.CultureField);
179
180
  }
180
- catch {
181
+ catch (_c) {
181
182
  culture = null;
182
183
  }
183
184
  // Browser detected
@@ -215,19 +216,21 @@ export var DomUtils;
215
216
  * @param file File
216
217
  * @returns Data URL
217
218
  */
218
- async function fileToDataURL(file) {
219
- return new Promise((resolve, reject) => {
220
- const reader = new FileReader();
221
- reader.onerror = reject;
222
- reader.onload = () => {
223
- const data = reader.result;
224
- if (data == null) {
225
- reject();
226
- return;
227
- }
228
- resolve(data);
229
- };
230
- reader.readAsDataURL(file);
219
+ function fileToDataURL(file) {
220
+ return __awaiter(this, void 0, void 0, function* () {
221
+ return new Promise((resolve, reject) => {
222
+ const reader = new FileReader();
223
+ reader.onerror = reject;
224
+ reader.onload = () => {
225
+ const data = reader.result;
226
+ if (data == null) {
227
+ reject();
228
+ return;
229
+ }
230
+ resolve(data);
231
+ };
232
+ reader.readAsDataURL(file);
233
+ });
231
234
  });
232
235
  }
233
236
  DomUtils.fileToDataURL = fileToDataURL;
package/lib/mjs/Utils.js CHANGED
@@ -353,7 +353,7 @@ export var Utils;
353
353
  // Return
354
354
  return json;
355
355
  }
356
- catch {
356
+ catch (_a) {
357
357
  if (defaultValue == null)
358
358
  return input;
359
359
  return defaultValue;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/shared",
3
- "version": "1.1.34",
3
+ "version": "1.1.35",
4
4
  "description": "TypeScript shared utilities and functions",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/mjs/index.js",
@@ -54,14 +54,16 @@
54
54
  "homepage": "https://github.com/ETSOO/Shared#readme",
55
55
  "dependencies": {},
56
56
  "devDependencies": {
57
- "@types/jest": "^27.4.1",
58
- "@typescript-eslint/eslint-plugin": "^5.21.0",
59
- "@typescript-eslint/parser": "^5.21.0",
60
- "eslint": "^8.14.0",
57
+ "@types/jest": "^27.5.0",
58
+ "@typescript-eslint/eslint-plugin": "^5.23.0",
59
+ "@typescript-eslint/parser": "^5.23.0",
60
+ "eslint": "^8.15.0",
61
61
  "eslint-config-airbnb-base": "^15.0.0",
62
62
  "eslint-plugin-import": "^2.26.0",
63
- "jest": "^27.5.1",
64
- "ts-jest": "^27.1.4",
63
+ "jest": "^28.1.0",
64
+ "jest-environment-jsdom": "^28.1.0",
65
+ "ts-jest": "^28.0.2",
66
+ "tslib": "^2.4.0",
65
67
  "typescript": "^4.6.4"
66
68
  }
67
69
  }
package/tsconfig.cjs.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "compilerOptions": {
3
3
  /* Visit https://aka.ms/tsconfig.json to read more about this file */
4
- "target": "ES2019",
4
+ "target": "ES6",
5
5
  "module": "commonjs",
6
6
  "moduleResolution": "node",
7
7
  "isolatedModules": true,
@@ -11,6 +11,8 @@
11
11
  "strict": true,
12
12
  "esModuleInterop": true,
13
13
  "skipLibCheck": true,
14
+ "importHelpers": true,
15
+ "downlevelIteration": true,
14
16
  "forceConsistentCasingInFileNames": true,
15
17
  "lib": ["dom", "dom.iterable", "esnext"]
16
18
  },
package/tsconfig.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "compilerOptions": {
3
3
  /* Visit https://aka.ms/tsconfig.json to read more about this file */
4
- "target": "ES2019",
4
+ "target": "ES6",
5
5
  "module": "ESNext",
6
6
  "moduleResolution": "node",
7
7
  "isolatedModules": true,
@@ -11,6 +11,8 @@
11
11
  "strict": true,
12
12
  "esModuleInterop": true,
13
13
  "skipLibCheck": true,
14
+ "importHelpers": true,
15
+ "downlevelIteration": true,
14
16
  "forceConsistentCasingInFileNames": true,
15
17
  "lib": ["dom", "dom.iterable", "esnext"]
16
18
  },