snils
The string is a Russian SNILS number with a valid check number: 112-233-445 95.
Signature
ts
function snils(msg?: Message): Action<string>
function isSnils(value: string): booleanParameters
| Parameter | Type | Description |
|---|---|---|
msg | Message | Custom error message |
Error codes
| Code | When | Default message |
|---|---|---|
snils | Invalid checksum or format | Invalid SNILS |
You can change the texts: see Messages & i18n.
Notes
The last two digits are a check number computed from the first nine.
- Spaces and dashes are allowed: a masked value can be validated.
- The
isSnilsfunction is available separately — for checks without a schema. - Format the input with a mask from tinyval-mask.
Example
ts
const Employee = object({ snils: pipe(string(), snils()) });
isSnils('112-233-445 95'); // true