Gusex.Validators.Nip (gusex v1.3.0)

Copy Markdown View Source

Module for handling Polish NIP (Tax Identification Number) validation. This module provides functions to validate NIP numbers according to the official rules. NIP is a 10-digit number where the last digit is a checksum calculated from the first nine digits. The checksum is calculated using a specific set of factors applied to the first nine digits.

Summary

Functions

Strips common separators (spaces, hyphens, dashes) from a NIP string, returning the digits-only form.

Validates a NIP number. Accepts a string representation of the NIP. Returns true if valid, false otherwise.

Functions

normalise(nip)

@spec normalise(String.t()) :: String.t()

Strips common separators (spaces, hyphens, dashes) from a NIP string, returning the digits-only form.

valid?(nip)

@spec valid?(String.t()) :: boolean()

Validates a NIP number. Accepts a string representation of the NIP. Returns true if valid, false otherwise.