@rocketlink/crm-model 1.0.288 → 1.0.289
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"normalizeUtil.d.ts","sourceRoot":"","sources":["../../src/util/normalizeUtil.ts"],"names":[],"mappings":"AAGA,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,GAAG,MAAM,GAAG,SAAS,CAEpF;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,IAAI,GAAG,SAAS,GAAG,IAAI,GAAG,IAAI,GAAG,SAAS,CAE9E;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,GAAG,MAAM,GAAG,SAAS,
|
|
1
|
+
{"version":3,"file":"normalizeUtil.d.ts","sourceRoot":"","sources":["../../src/util/normalizeUtil.ts"],"names":[],"mappings":"AAGA,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,GAAG,MAAM,GAAG,SAAS,CAEpF;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,IAAI,GAAG,SAAS,GAAG,IAAI,GAAG,IAAI,GAAG,SAAS,CAE9E;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,GAAG,MAAM,GAAG,SAAS,CASpF;AAGD,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,IAAI,GAAG,MAAM,GAAG,SAAS,GAAG,IAAI,EAAE,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAoBxH"}
|
|
@@ -13,8 +13,12 @@ function normalizeDate(value) {
|
|
|
13
13
|
return value === null ? undefined : value;
|
|
14
14
|
}
|
|
15
15
|
function normalizeNumber(value) {
|
|
16
|
-
if (
|
|
17
|
-
return
|
|
16
|
+
if (value === '' || value === null || value === undefined) {
|
|
17
|
+
return undefined;
|
|
18
|
+
}
|
|
19
|
+
const num = Number(value);
|
|
20
|
+
if (!isNaN(num)) {
|
|
21
|
+
return num;
|
|
18
22
|
}
|
|
19
23
|
return undefined;
|
|
20
24
|
}
|
package/package.json
CHANGED
|
@@ -10,8 +10,12 @@ export function normalizeDate(value: Date | undefined | null): Date | undefined
|
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
export function normalizeNumber(value: string | undefined | null): number | undefined {
|
|
13
|
-
if (
|
|
14
|
-
return
|
|
13
|
+
if (value === '' || value === null || value === undefined) {
|
|
14
|
+
return undefined
|
|
15
|
+
}
|
|
16
|
+
const num = Number(value)
|
|
17
|
+
if (!isNaN(num)) {
|
|
18
|
+
return num
|
|
15
19
|
}
|
|
16
20
|
return undefined
|
|
17
21
|
}
|