@nu-art/ts-common 0.202.106 → 0.202.108
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/package.json
CHANGED
|
@@ -77,15 +77,13 @@ const tsValidateString = (length = -1, mandatory = true) => {
|
|
|
77
77
|
// noinspection SuspiciousTypeOfGuard
|
|
78
78
|
if (typeof input !== 'string')
|
|
79
79
|
return `input is not a string`;
|
|
80
|
-
if (length === -1)
|
|
81
|
-
return;
|
|
82
80
|
if (Array.isArray(length)) {
|
|
83
|
-
if (length[0] > input.length)
|
|
84
|
-
return `input length is lesser than ${length}`;
|
|
85
|
-
if (input.length > length[1])
|
|
86
|
-
return `input length is longer than ${length}`;
|
|
81
|
+
if (length[0] !== -1 && length[0] > input.length)
|
|
82
|
+
return `input length is lesser than ${length[0]}`;
|
|
83
|
+
if (length[1] !== -1 && input.length > length[1])
|
|
84
|
+
return `input length is longer than ${length[1]}`;
|
|
87
85
|
}
|
|
88
|
-
else if (input.length > length)
|
|
86
|
+
else if (length !== -1 && input.length > length)
|
|
89
87
|
return `input length is longer than ${length}`;
|
|
90
88
|
return;
|
|
91
89
|
}];
|