@powfix/core-js 0.11.10 → 0.11.11

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.
@@ -0,0 +1,5 @@
1
+ import { AxiosHeaderValue } from "axios";
2
+ export declare class AxiosUtils {
3
+ static headerValue2String(value: AxiosHeaderValue | undefined): string | null;
4
+ static headerValue2Number(value: AxiosHeaderValue | undefined): number | null;
5
+ }
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AxiosUtils = void 0;
4
+ class AxiosUtils {
5
+ static headerValue2String(value) {
6
+ if (value === undefined) {
7
+ return null;
8
+ }
9
+ if (value === null || typeof value === 'string') {
10
+ return value;
11
+ }
12
+ if (Array.isArray(value)) {
13
+ if (value.length > 0) {
14
+ for (const e of value) {
15
+ if (typeof e === 'string') {
16
+ return e;
17
+ }
18
+ }
19
+ // There is no any values having string type
20
+ return null;
21
+ }
22
+ else {
23
+ return null;
24
+ }
25
+ }
26
+ return String(value);
27
+ }
28
+ static headerValue2Number(value) {
29
+ if (value === undefined) {
30
+ return null;
31
+ }
32
+ if (value === null || typeof value === 'number') {
33
+ return value;
34
+ }
35
+ if (Array.isArray(value)) {
36
+ if (value.length > 0) {
37
+ for (const e of value) {
38
+ if (typeof e === 'number') {
39
+ return e;
40
+ }
41
+ }
42
+ // There is no any values having string type
43
+ return null;
44
+ }
45
+ else {
46
+ return null;
47
+ }
48
+ }
49
+ const result = Number(value);
50
+ return isNaN(result) ? null : result;
51
+ }
52
+ }
53
+ exports.AxiosUtils = AxiosUtils;
@@ -1,7 +1,8 @@
1
1
  export * from './global';
2
+ export * from './ArrayUtils';
3
+ export * from './AxiosUtils';
2
4
  export * from './StringUtils';
3
5
  export * from './UuidUtils';
4
- export * from './ArrayUtils';
5
6
  export * from './BooleanUtils';
6
7
  export * from './CoordinateUtils';
7
8
  export * from './DateUtils';
@@ -15,9 +15,10 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./global"), exports);
18
+ __exportStar(require("./ArrayUtils"), exports);
19
+ __exportStar(require("./AxiosUtils"), exports);
18
20
  __exportStar(require("./StringUtils"), exports);
19
21
  __exportStar(require("./UuidUtils"), exports);
20
- __exportStar(require("./ArrayUtils"), exports);
21
22
  __exportStar(require("./BooleanUtils"), exports);
22
23
  __exportStar(require("./CoordinateUtils"), exports);
23
24
  __exportStar(require("./DateUtils"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powfix/core-js",
3
- "version": "0.11.10",
3
+ "version": "0.11.11",
4
4
  "description": "core package",
5
5
  "author": "Kwon Kyung-Min <powfix@gmail.com>",
6
6
  "private": false,