@carecard/validate 3.0.7 → 3.0.10
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/index.js +3 -3
- package/lib/validateProperties.js +2 -10
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
const validate = require( './lib/validate' );
|
|
2
|
-
const
|
|
2
|
+
const validateProperties = require( './lib/validateProperties' );
|
|
3
3
|
|
|
4
4
|
module.exports = {
|
|
5
5
|
validate,
|
|
6
|
-
validateProperties
|
|
6
|
+
validateProperties,
|
|
7
7
|
...validate,
|
|
8
|
-
...
|
|
8
|
+
...validateProperties
|
|
9
9
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
// Validate the property values format.
|
|
2
2
|
const {
|
|
3
|
-
isUsernameString,
|
|
4
3
|
isEmailString,
|
|
5
4
|
isPhoneNumber,
|
|
6
5
|
isUrlSafeString,
|
|
@@ -27,6 +26,7 @@ function validateProperties(obj = {}) {
|
|
|
27
26
|
switch (key) {
|
|
28
27
|
case 'first_name':
|
|
29
28
|
case 'firstName':
|
|
29
|
+
case 'username':
|
|
30
30
|
case 'new_status':
|
|
31
31
|
case 'newStatus':
|
|
32
32
|
case 'description':
|
|
@@ -46,24 +46,16 @@ function validateProperties(obj = {}) {
|
|
|
46
46
|
returnObj[key] = value;
|
|
47
47
|
}
|
|
48
48
|
break;
|
|
49
|
-
case 'username':
|
|
50
|
-
if (isUsernameString(value)) {
|
|
51
|
-
returnObj[key] = value;
|
|
52
|
-
}
|
|
53
|
-
break;
|
|
54
49
|
case 'search_string':
|
|
55
50
|
case 'searchString':
|
|
56
51
|
if (isSafeSearchString(value)) {
|
|
57
|
-
console.log('isSafeSearchString VALID:', value);
|
|
58
52
|
returnObj[key] = value;
|
|
59
|
-
} else {
|
|
60
|
-
console.log('isSafeSearchString INVALID:', value);
|
|
61
53
|
}
|
|
62
54
|
break;
|
|
63
55
|
case 'password':
|
|
64
56
|
case 'new_password':
|
|
65
57
|
case 'newPassword':
|
|
66
|
-
if (isSimplePasswordString(value)) {
|
|
58
|
+
if (isString6To16CharacterLong(value) && isSimplePasswordString(value)) {
|
|
67
59
|
returnObj[key] = value;
|
|
68
60
|
}
|
|
69
61
|
break;
|