typebox 1.0.78 → 1.0.79
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/build/guard/string.mjs +4 -0
- package/package.json +1 -1
package/build/guard/string.mjs
CHANGED
|
@@ -95,6 +95,8 @@ export function GraphemeCount(value) {
|
|
|
95
95
|
// --------------------------------------------------------------------------
|
|
96
96
|
/** Checks if a string has at least a minimum number of grapheme clusters */
|
|
97
97
|
export function IsMinLength(value, minLength) {
|
|
98
|
+
if (minLength === 0)
|
|
99
|
+
return true; // 0-length
|
|
98
100
|
let count = 0;
|
|
99
101
|
let index = 0;
|
|
100
102
|
while (index < value.length) {
|
|
@@ -125,6 +127,8 @@ export function IsMaxLength(value, maxLength) {
|
|
|
125
127
|
// --------------------------------------------------------------------------
|
|
126
128
|
/** Fast check for minimum grapheme length, falls back to full check if needed */
|
|
127
129
|
export function IsMinLengthFast(value, minLength) {
|
|
130
|
+
if (minLength === 0)
|
|
131
|
+
return true; // 0-length
|
|
128
132
|
let index = 0;
|
|
129
133
|
while (index < value.length) {
|
|
130
134
|
if (IsGraphemeCodePoint(value.charCodeAt(index))) {
|