Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/tknf/japhonex-node
- Owner: tknf
- License: mit
- Created: 2022-03-12T12:18:43.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-03-12T14:08:43.000Z (over 2 years ago)
- Last Synced: 2024-09-15T07:49:12.849Z (2 months ago)
- Topics: japanese, javascript, phonenumber, regex, typescript
- Language: TypeScript
- Size: 118 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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