lanka-validations - v2.1.0
    Preparing search index...

    Function validatePhone

    • Detailed validation returning structured ValidationResult with error code and messages.

      Parameters

      • phone: unknown

        Phone number in any common format. Strings and finite numbers are accepted; other types return a failure without throwing.

      Returns ValidationResult<PhoneInfo>

      { isValid: true, data } with PhoneInfo, or { isValid: false, error, errors, code }.

      validatePhone('0771234567').isValid; // true
      validatePhone('12345').isValid; // false