# phoneparser

> A parser for phone numbers.

Latest version **3.0.2** (published 2020-10-13) · MIT license · 0 weekly downloads

## Install

```sh
npm install phoneparser
pnpm add phoneparser
yarn add phoneparser
bun add phoneparser
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.0.2 |
| Published | 2020-10-13 |
| First published | 2016-04-22 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 14.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Andy Burke |
| Maintainers | andyburke |
| Keywords | phone, phone numbers, numbers, parser, area code, code, mobile, landline |

## Links

- npm: https://www.npmjs.com/package/phoneparser
- Repository: https://github.com/andyburke/phoneparser
- Homepage: https://github.com/andyburke/phoneparser#readme
- Issues: https://github.com/andyburke/phoneparser/issues
- npm.io page: https://npm.io/package/phoneparser

## Dependencies (2)

- [extend](https://npm.io/package/extend.md) ^3.0.2
- [countrydata](https://npm.io/package/countrydata.md) ^3.0.0

## Alternatives

- [babylon](https://npm.io/package/babylon.md) — 5.1M weekly downloads
- [csscolorparser](https://npm.io/package/csscolorparser.md) — 3.7M weekly downloads
- [expr-eval-fork](https://npm.io/package/expr-eval-fork.md) — 1.5M weekly downloads
- [@leeoniya/ufuzzy](https://npm.io/package/@leeoniya/ufuzzy.md) — 247.7K weekly downloads
- [xml-parser](https://npm.io/package/xml-parser.md) — 78.4K weekly downloads

## Recent versions

- 3.0.2 (latest) — 2020-10-13
- 3.0.1 — 2020-09-30
- 3.0.0 — 2020-08-25
- 2.1.1 — 2020-07-13
- 2.1.0 — 2016-10-11
- 2.0.0 — 2016-05-03
- 1.0.0 — 2016-04-22

## README

## phoneparser

A parser for phone numbers.

## Code Example

```javascript
const phoneparser = require( 'phoneparser' );

const phone = phoneparser.parse( '93712345678' );
console.log( JSON.stringify( phone, null, 4 ) );
```

Output:

```json
{
    "valid": true,
    "normalized": "+93712345678",
    "stripped": "93712345678",
    "localized": {
        "stripped": "712345678"
    },
    "info": {
        "prefix": "7",
        "type": "mobile"
    },
    "country": {
        "name": {
            "de": "Afghanistan",
            "es": "Afganistán",
            "fr": "Afghanistan",
            "ja": "アフガニスタン",
            "it": "Afghanistan",
            "en": "Afghanistan"
        },
        "iso3166": {
            "alpha2": "AF",
            "alpha3": "AFG",
            "independent": true,
            "name": "Afghanistan",
            "numeric": 4,
            "currency": {
                "name": "Afghani",
                "code": "AFN",
                "numeric": 971,
                "minor_unit": 2
            }
        },
        "phone": {
            "code": "93",
            "lengths": [
                9
            ],
            "prefixes": {
                "7": {
                    "type": "mobile"
                }
            }
        },
        "latitude": 33,
        "longitude": 65,
        "timezones": [
            "UTC+04:30"
        ],
        "area": 652230,
        "population": 26023100,
        "region": "Asia",
        "subregion": "Southern Asia"
    }
}
```

## Installation

```bash
npm install --save phoneparser
```

## Tests

```bash
npm run test
```

## Contributing

Contributions are encouraged and appreciated. To make the process as quick and painless as possible for everyone involved, here's a checklist that will make a pull request easily accepted:

1. Implement your new feature or bugfix
2. Add or update tests to ensure coverage
3. Ensure your code passes jshint according to the .jshintrc
4. Ensure your code is formatted according to the .jsbeautifyrc
5. Submit

## License

MIT

## Inspiration

https://github.com/aftership/phone

Inspired by the 'phone' library. Many thanks to aftership.com for a great example.

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