# format-phonenumber

> Format phone numbers: 123-456-7890. Validates numbers only and min-max length

Latest version **0.0.1** (published 2017-01-04) · MIT license · 0 weekly downloads

## Install

```sh
npm install format-phonenumber
pnpm add format-phonenumber
yarn add format-phonenumber
bun add format-phonenumber
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.1 |
| Published | 2017-01-04 |
| First published | 2017-01-04 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Jorge Cascante |
| Maintainers | chinaski1979 |
| Keywords | react-component, react, format, phone, number |

## Links

- npm: https://www.npmjs.com/package/format-phonenumber
- Repository: https://github.com/Chinaski1979/format-phone-number
- Homepage: https://github.com/Chinaski1979/format-phone-number#readme
- Issues: https://github.com/Chinaski1979/format-phone-number/issues
- npm.io page: https://npm.io/package/format-phonenumber

## Dependencies (1)

- [babel-runtime](https://npm.io/package/babel-runtime.md) ^6.6.1

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 0.0.1 (latest) — 2017-01-04

## README

# Format-Phone-Number
Format a telephone number 123-345-67890

This is a simple package that provides the format 123-345-67890 to a telephone number.

It includes:
- Validates that input is numbers only (or dashes, as it automatically adds them).
- It has maximum length. (13 characters counting the 10 digits and 2 dashes).

## Usage

1. npm install format-phone-number --save
2. Import FormatPhoneNumber from 'format-phone-number';
3. Provide props: "onChange" (function) and "value" (string).
4. You can pass it a className string and provide any input style.

## Example

```
import React from 'react';
import FormatPhonenumber from 'format-phonenumber';

class AppComponent extends React.Component {

  constructor (props) {
    super(props);
    this.state = {
      phoneNumber : '',
    };
  }

  render() {
    return (
      <div>
        <FormatPhonenumber
          className="input-formatter"
          onChange={this.handleChange} value={this.state.phoneNumber}
        />
      </div>
    );
  }

  handleChange = (value) => {
    this.setState({
      phoneNumber : value
    })
  }
}

export default AppComponent;
```

## License

MIT

---
_Source: https://npm.io/package/format-phonenumber · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
