toEighteen(id)
Convert a 15-digit ID number to 18 digits.
Signature
typescript
function toEighteen(id: string): string | nullParameters
| Parameter | Type | Description |
|---|---|---|
| id | string | 15-digit ID number |
Returns
Returns the converted 18-digit ID number. Returns null if the input is not a valid 15-digit ID.
Live Demo
Example
typescript
import { toEighteen } from 'china-id-card'
toEighteen('110101900101001') // → '110101199001010018'