@excofy/utils 1.0.11 → 1.0.12

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/index.cjs CHANGED
@@ -435,6 +435,15 @@ function createValidator() {
435
435
  }
436
436
  return validator;
437
437
  },
438
+ sanitizeAlphaSpaces() {
439
+ if (shouldSkipValidation()) return validator;
440
+ if (typeof current.value === "string") {
441
+ const cleaned = current.value.replace(/[^A-Za-zÀ-ÿ\s]/g, "");
442
+ current.value = cleaned;
443
+ current.inputs[current.field] = cleaned;
444
+ }
445
+ return validator;
446
+ },
438
447
  sanitizeDigits() {
439
448
  if (shouldSkipValidation()) return validator;
440
449
  if (typeof current.value === "string") {
package/dist/index.d.cts CHANGED
@@ -31,6 +31,7 @@ interface ValidatorField {
31
31
  transform<U>(fn: (value: TInputValue) => U): ValidatorField;
32
32
  slug(message: string): ValidatorField;
33
33
  sanitize(): ValidatorField;
34
+ sanitizeAlphaSpaces(): ValidatorField;
34
35
  sanitizeDigits(): ValidatorField;
35
36
  sanitizePreservingNewlines(): ValidatorField;
36
37
  sanitizeHTML(tags?: AllowedTag[]): ValidatorField;
package/dist/index.d.ts CHANGED
@@ -31,6 +31,7 @@ interface ValidatorField {
31
31
  transform<U>(fn: (value: TInputValue) => U): ValidatorField;
32
32
  slug(message: string): ValidatorField;
33
33
  sanitize(): ValidatorField;
34
+ sanitizeAlphaSpaces(): ValidatorField;
34
35
  sanitizeDigits(): ValidatorField;
35
36
  sanitizePreservingNewlines(): ValidatorField;
36
37
  sanitizeHTML(tags?: AllowedTag[]): ValidatorField;
package/dist/index.js CHANGED
@@ -401,6 +401,15 @@ function createValidator() {
401
401
  }
402
402
  return validator;
403
403
  },
404
+ sanitizeAlphaSpaces() {
405
+ if (shouldSkipValidation()) return validator;
406
+ if (typeof current.value === "string") {
407
+ const cleaned = current.value.replace(/[^A-Za-zÀ-ÿ\s]/g, "");
408
+ current.value = cleaned;
409
+ current.inputs[current.field] = cleaned;
410
+ }
411
+ return validator;
412
+ },
404
413
  sanitizeDigits() {
405
414
  if (shouldSkipValidation()) return validator;
406
415
  if (typeof current.value === "string") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@excofy/utils",
3
- "version": "1.0.11",
3
+ "version": "1.0.12",
4
4
  "description": "Biblioteca de utilitários para o Excofy",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
@@ -38,6 +38,7 @@ interface ValidatorField {
38
38
  transform<U>(fn: (value: TInputValue) => U): ValidatorField;
39
39
  slug(message: string): ValidatorField;
40
40
  sanitize(): ValidatorField;
41
+ sanitizeAlphaSpaces(): ValidatorField;
41
42
  sanitizeDigits(): ValidatorField;
42
43
  sanitizePreservingNewlines(): ValidatorField;
43
44
  sanitizeHTML(tags?: AllowedTag[]): ValidatorField;
@@ -408,6 +409,18 @@ export function createValidator<
408
409
  return validator;
409
410
  },
410
411
 
412
+ sanitizeAlphaSpaces() {
413
+ if (shouldSkipValidation()) return validator;
414
+
415
+ if (typeof current.value === 'string') {
416
+ const cleaned = current.value.replace(/[^A-Za-zÀ-ÿ\s]/g, '');
417
+ current.value = cleaned;
418
+ current.inputs[current.field] = cleaned as TRaw[keyof TRaw];
419
+ }
420
+
421
+ return validator;
422
+ },
423
+
411
424
  sanitizeDigits() {
412
425
  if (shouldSkipValidation()) return validator;
413
426