Skip to content

[RFC]: add assert/is-phone-number #3195

@ghost

Description

Description

Description

This RFC proposes adding new function for validating the phone number

The stdlib.js library offers a wide range of utility functions, including robust checks for various data formats such as email addresses (is-email-address) and others. However, it currently lacks a utility function to validate phone numbers, which is a common requirement in many applications.
To fill this gap, I propose adding a new function, is-phone-number, to the /assert/ module.

Expected Behavior:

The is-phone-number function should:

  • Accept a string input.
  • Validate the input against commonly used phone number formats.
  • Support international and local phone number patterns.
  • Return true if the input is a valid phone number, and false otherwise.

Related Issues

Related issues # , # , and # .

Questions

No.

Other

No.

Checklist

  • I have read and understood the Code of Conduct.
  • Searched for existing issues and pull requests.
  • The issue name begins with RFC:.

Metadata

Metadata

Assignees

No one assigned

    Labels

    FeatureIssue or pull request for adding a new feature.Needs DiscussionNeeds further discussion.RFCRequest for comments. Feature requests and proposed changes.UtilitiesIssue or pull request concerning general utilities.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions