{"id":20333087,"url":"https://github.com/jaebradley/phone-number-prop-type","last_synced_at":"2026-05-07T12:34:05.718Z","repository":{"id":27564256,"uuid":"114421278","full_name":"jaebradley/phone-number-prop-type","owner":"jaebradley","description":"Phone Number React Prop Type","archived":false,"fork":false,"pushed_at":"2022-12-06T15:41:15.000Z","size":1000,"stargazers_count":1,"open_issues_count":4,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-14T17:42:16.890Z","etag":null,"topics":["phone-number","proptype-validators","proptypes","react"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jaebradley.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-12-16T00:09:07.000Z","updated_at":"2023-03-04T05:45:07.000Z","dependencies_parsed_at":"2023-01-14T07:01:23.881Z","dependency_job_id":null,"html_url":"https://github.com/jaebradley/phone-number-prop-type","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaebradley%2Fphone-number-prop-type","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaebradley%2Fphone-number-prop-type/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaebradley%2Fphone-number-prop-type/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaebradley%2Fphone-number-prop-type/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jaebradley","download_url":"https://codeload.github.com/jaebradley/phone-number-prop-type/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241852146,"owners_count":20030966,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["phone-number","proptype-validators","proptypes","react"],"created_at":"2024-11-14T20:29:16.681Z","updated_at":"2025-12-02T12:06:44.949Z","avatar_url":"https://github.com/jaebradley.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.org/jaebradley/phone-number-prop-type.svg?branch=master)](https://travis-ci.org/jaebradley/phone-number-prop-type)\n[![codecov](https://codecov.io/gh/jaebradley/phone-number-prop-type/branch/master/graph/badge.svg)](https://codecov.io/gh/jaebradley/phone-number-prop-type)\n[![npm](https://img.shields.io/npm/v/phone-number-prop-type.svg)](https://www.npmjs.com/package/phone-number-prop-type)\n[![npm](https://img.shields.io/npm/dt/phone-number-prop-type.svg)](https://www.npmjs.com/package/phone-number-prop-type)\n\n# Phone Number Prop Type\n\n## Why are `Prop Types` important?\n[`Prop Types`](https://reactjs.org/docs/typechecking-with-proptypes.html) kind've [serve as the interface layer for your component](https://wecodetheweb.com/2015/06/02/why-react-proptypes-are-important/) - what data does my component depend on and what is the expected format of that data?\n\nThus, defining and validating props accurately can add value from a readability and debugging point of view.\n\n## What this package does\nThis package is used to validate if a React prop value is a valid phone number. Currently, there is no phone number prop type defined by [the `prop-types` package](https://www.npmjs.com/package/prop-types). While using `PropType.string` works, why not be as specific as possible when validating your props?\n\nAdditionally, though [it's relatively straightforward to create a custom prop type validator](https://www.ian-thomas.net/custom-proptype-validation-with-react/), if you need to implement similar prop type checking in multiple packages, you might not want to repeat yourself.\n\nThis package depends on the [`google-libphonenumber`](https://www.npmjs.com/package/google-libphonenumber) package. `google-libphonenumber` **will only validate [`E.164` formatted](https://en.wikipedia.org/wiki/E.164)) phone numbers**.\n\n## Installation\n\n```bash\nnpm install phone-number-prop-type --save\n```\n\n## Usage\n\n```javascript\nimport React from 'react';\nimport PropTypes from 'prop-types';\nimport phoneNumberPropType from 'phone-number-prop-type';\n\nconst PhoneNumber = ({ phoneNumber }) =\u003e \u003ch1\u003eHere is my phone number: {phoneNumber}!\u003c/h1\u003e;\n\nPhoneNumber.defaultProps = {\n  phoneNumber: '+1 555-555-555',\n}\n\nPhoneNumber.propTypes = {\n  phoneNumber: phoneNumberPropType,\n}\n\nexport default PhoneNumber;\n```\n\n[`stackblitz` Example](https://stackblitz.com/edit/react-phone-number-prop-type-1?embed=1\u0026file=index.js\u0026view=editor)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaebradley%2Fphone-number-prop-type","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjaebradley%2Fphone-number-prop-type","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaebradley%2Fphone-number-prop-type/lists"}