Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/tknf/japhonex-node

Regex builder and validator for japanese phone number
https://github.com/tknf/japhonex-node

japanese javascript phonenumber regex typescript

Last synced: 8 days ago
JSON representation

Regex builder and validator for japanese phone number

Awesome Lists containing this project

README

        

# Japhonex Node

Japanese phone number checker for Node.

## Installation
```bash
$ npm i @tknf/japhonex
# or
$ yarn add @tknf/japhonex
```

## Usage
In your app you can do something like:
```js
import { japhonex } from "@tknf/japhonex";

const regex = japhonex({ hyphen: "optinal" });
regex.test("");
```

### Hyphen validation patterns
### Optional (default)
```js
const regex = japhonex({ hyphen: "optional" });
// 0xx-xxxx-xxxx or 0xxxxxxxxxx
```
### Required
```js
const regex = japhonex({ hyphen: "requied" });
// 0xx-xxxx-xxxx
```
### No hyphen
```js
const regex = japhonex({ hyphen: false });
// 0xxxxxxxxxx
```

## Licence
MIT