@randyd45/curp-validation v1.0.2
Curp validation usage
CURP object
To star using this library you must import the module and instantiate a new CURP object like this.
import {CURP} from "curp-validation";
let curp = new CURP("CUAJ980602MQRRRSXX");
The curp object is the main class that handles all the name, lastname and birthday verification.
Valid format
This functionality verifies that the CURP input has a valid state, birthday, sex, and overall valid format. the function returns a true if the input is valid and false otherwise.
curp.isFormatValid()
Valid name
this functionality verifies if the name is valid accoding to the CURP input, this function returns true if it is valid and false otherwise.
curp.isNameValid("MARIA JOSE")
Valid lastname
this functionality verifies if the lastname is valid accoding to the CURP input, this function returns true if it is valid and false otherwise.
curp.isFirstLastnameValid("DE LA CRUZ")
Valid second lastname
this functionality verifies if the second lastname is valid accoding to the CURP input, this function returns true if it is valid and false otherwise.
curp.isSecondLastnameValid("ARELLANO")
Valid birthday
this functionality verifies if a birthday is valid accoding to the CURP input, this function returns true if it is valid and false otherwise.
curp.isBirthdayValid(98, 6, 2)
Extract birthday
this functionality extracts the birthday of the input curp.
curp.extractBirthday()