Skip to content

isValid(id) ​

Quickly check whether an ID number is valid.

Signature ​

typescript
function isValid(id: string): boolean;

Parameters ​

ParameterTypeDescription
idstringID number

Returns ​

Returns true if the ID number format is valid, false otherwise.

Live Demo ​

Example ​

typescript
import { isValid } from 'china-id-card';

isValid('622922197808118498'); // → true
isValid('123456789012345678'); // → false

基于 GB 11643-1999 标准