mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-19 09:42:21 +00:00
fix(tools): enforce string schema lengths by Unicode code point
This commit is contained in:
1 parent
6dd4d0156f
commit
2c5fb039ce
4 files changed
+30
-2
No files matched your search
+3
-2
@@ -106,9 +106,10 @@ export function validateValue(schema, value, path = 'arguments') {
|
||||
fail('must be a string');
|
||||
break;
|
||||
}
|
||||
if (schema.minLength != null && value.length < schema.minLength)
|
||||
const length = [...value].length;
|
||||
if (schema.minLength != null && length < schema.minLength)
|
||||
fail(`must be at least ${schema.minLength} characters`);
|
||||
if (schema.maxLength != null && value.length > schema.maxLength)
|
||||
if (schema.maxLength != null && length > schema.maxLength)
|
||||
fail(`must be at most ${schema.maxLength} characters`);
|
||||
if (
|
||||
schema.pattern !== undefined &&
|
||||
|
||||
Reference in new issue
Block a user