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

    Function isValidPhone

    • Validates any Sri Lankan telephone number (mobile, landline, or recognized short code).

      Parameters

      • phone: unknown

        Phone number in any common format, for example '077 123 4567' or '+94771234567'. Strings and finite numbers are accepted; other types return a failure without throwing.

      Returns boolean

      true for a valid mobile, fixed-line, toll-free number, or public short code.

      isValidPhone('0771234567'); // true
      isValidPhone('+94 11 234 5678'); // true
      isValidPhone('119'); // true
      isValidPhone('12345'); // false