@umituz/react-native-validation 1.3.2 → 1.4.0

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umituz/react-native-validation",
3
- "version": "1.3.2",
3
+ "version": "1.4.0",
4
4
  "description": "Comprehensive validation and sanitization utilities for React Native forms",
5
5
  "main": "./src/index.ts",
6
6
  "types": "./src/index.ts",
package/src/index.ts CHANGED
@@ -13,8 +13,6 @@ export type { ValidationResult } from './domain/entities/ValidationResult';
13
13
  // Infrastructure Layer - Validators
14
14
  export {
15
15
  validateEmail,
16
- validatePassword,
17
- validatePasswordConfirmation,
18
16
  validateRequired,
19
17
  validateName,
20
18
  validatePhone,
@@ -76,3 +76,4 @@ export function getImageMimeType(uri: string): string | null {
76
76
  return getMimeTypeFromExtension(uri);
77
77
  }
78
78
 
79
+
@@ -40,3 +40,4 @@ export const MIME_TYPE_TO_EXTENSION: Record<string, string> = {
40
40
  [IMAGE_MIME_TYPES.GIF]: 'gif',
41
41
  };
42
42
 
43
+
@@ -21,83 +21,6 @@ export const validateEmail = (email: string): ValidationResult => {
21
21
  return { isValid: true };
22
22
  };
23
23
 
24
- /**
25
- * Validate password strength
26
- * @param password - Password to validate
27
- * @param minLength - Minimum password length (default: 8)
28
- * @param requireUppercase - Require uppercase letter (default: true)
29
- * @param requireLowercase - Require lowercase letter (default: true)
30
- * @param requireNumber - Require number (default: true)
31
- */
32
- export const validatePassword = (
33
- password: string,
34
- options?: {
35
- minLength?: number;
36
- requireUppercase?: boolean;
37
- requireLowercase?: boolean;
38
- requireNumber?: boolean;
39
- }
40
- ): ValidationResult => {
41
- const {
42
- minLength = 8,
43
- requireUppercase = true,
44
- requireLowercase = true,
45
- requireNumber = true,
46
- } = options || {};
47
-
48
- if (!password || password.trim() === '') {
49
- return { isValid: false, error: 'Password is required' };
50
- }
51
-
52
- if (password.length < minLength) {
53
- return {
54
- isValid: false,
55
- error: `Password must be at least ${minLength} characters`,
56
- };
57
- }
58
-
59
- if (requireUppercase && !/[A-Z]/.test(password)) {
60
- return {
61
- isValid: false,
62
- error: 'Password must contain at least one uppercase letter',
63
- };
64
- }
65
-
66
- if (requireLowercase && !/[a-z]/.test(password)) {
67
- return {
68
- isValid: false,
69
- error: 'Password must contain at least one lowercase letter',
70
- };
71
- }
72
-
73
- if (requireNumber && !/[0-9]/.test(password)) {
74
- return {
75
- isValid: false,
76
- error: 'Password must contain at least one number',
77
- };
78
- }
79
-
80
- return { isValid: true };
81
- };
82
-
83
- /**
84
- * Validate password confirmation
85
- */
86
- export const validatePasswordConfirmation = (
87
- password: string,
88
- confirmPassword: string
89
- ): ValidationResult => {
90
- if (!confirmPassword) {
91
- return { isValid: false, error: 'Please confirm your password' };
92
- }
93
-
94
- if (password !== confirmPassword) {
95
- return { isValid: false, error: 'Passwords do not match' };
96
- }
97
-
98
- return { isValid: true };
99
- };
100
-
101
24
  /**
102
25
  * Validate required field
103
26
  */