GeoLeaf Core API - v3.0.0
    Preparing search index...
    • Validates a phone number by shape and digit count.

      Two successive checks: the string may only contain digits, spaces, +, -, ( and ); and once every non-digit is stripped, at least 10 digits must remain. Formatting is therefore free — "+33 6 12 34 56 78" and "06-12-34-56-78" both pass.

      ⚠️ No country-specific rule is applied: a 10-digit sequence passes regardless of whether it could be dialled.

      Parameters

      Returns { valid: boolean; error: string | null }

      { valid, error }; error is null when valid.

      GeoLeafError A ValidationError when invalid and throwOnError is set.

      GeoLeaf.Validators.validatePhone("+33 6 12 34 56 78");
      // Returns: { valid: true, error: null }

      GeoLeaf.Validators.validatePhone("06-12-34-56-78");
      // Returns: { valid: true, error: null }

      // Trop peu de chiffres
      GeoLeaf.Validators.validatePhone("123");
      // Returns: { valid: false, error: 'Phone number must contain at least 10 digits' }