@followupus/common 0.4.0 → 0.6.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/dist/shared/index.d.ts
CHANGED
package/dist/shared/index.js
CHANGED
package/dist/shared/shared.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as _ from "lodash";
|
|
2
2
|
import dayjs from "dayjs";
|
|
3
3
|
export const COLUMN_TYPES = {
|
|
4
4
|
NUMBER: "number",
|
|
@@ -195,11 +195,11 @@ const isInConditionValues = (itemVal, valueType, condition) => {
|
|
|
195
195
|
condition.value.some((val) => Array.isArray(itemVal) && itemVal?.includes(val)));
|
|
196
196
|
case "object":
|
|
197
197
|
return ((condition.blank && !itemVal) ||
|
|
198
|
-
!!condition.value.find((val) => isEqual(val, itemVal)));
|
|
198
|
+
!!condition.value.find((val) => _.isEqual(val, itemVal)));
|
|
199
199
|
case "objectArray":
|
|
200
200
|
return ((condition.blank && !itemVal?.length) ||
|
|
201
201
|
condition.value.some((val) => Array.isArray(itemVal) &&
|
|
202
|
-
itemVal.find((existVal) => isEqual(val, existVal))));
|
|
202
|
+
itemVal.find((existVal) => _.isEqual(val, existVal))));
|
|
203
203
|
default:
|
|
204
204
|
break;
|
|
205
205
|
}
|
|
@@ -259,7 +259,7 @@ const isEquals = (itemVal, valueType, condition) => {
|
|
|
259
259
|
case "string":
|
|
260
260
|
return !!itemVal && checkVal === itemVal;
|
|
261
261
|
case "object":
|
|
262
|
-
return isEqual(itemVal, checkVal);
|
|
262
|
+
return _.isEqual(itemVal, checkVal);
|
|
263
263
|
default:
|
|
264
264
|
break;
|
|
265
265
|
}
|
package/dist/utils/validator.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import OriginSchema from "async-validator";
|
|
2
|
+
// @ts-ignore
|
|
3
|
+
const Schema = OriginSchema.default ?? OriginSchema;
|
|
2
4
|
const descriptor = {
|
|
3
5
|
email: {
|
|
4
6
|
type: "email",
|
|
@@ -17,19 +19,19 @@ const descriptor = {
|
|
|
17
19
|
};
|
|
18
20
|
const validator = new Schema(descriptor);
|
|
19
21
|
export const isValidEmail = async (email) => {
|
|
20
|
-
await validator.validate({ email }).catch(err => {
|
|
22
|
+
await validator.validate({ email }).catch((err) => {
|
|
21
23
|
throw err;
|
|
22
24
|
});
|
|
23
25
|
return true;
|
|
24
26
|
};
|
|
25
27
|
export const isValidUrl = async (url) => {
|
|
26
|
-
await validator.validate({ url }).catch(err => {
|
|
28
|
+
await validator.validate({ url }).catch((err) => {
|
|
27
29
|
throw err;
|
|
28
30
|
});
|
|
29
31
|
return true;
|
|
30
32
|
};
|
|
31
33
|
export const isValidPhone = async (phone) => {
|
|
32
|
-
await validator.validate({ phone }).catch(err => {
|
|
34
|
+
await validator.validate({ phone }).catch((err) => {
|
|
33
35
|
throw err;
|
|
34
36
|
});
|
|
35
37
|
return true;
|